aboutsummaryrefslogtreecommitdiff
path: root/libopna/opnassg.c
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-03-17 22:32:52 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-03-17 22:32:52 +0900
commit893a411ff3eb6ffdeba62acae34ac5511466599f (patch)
treeeebdfae8771fbf3c8b27eb279137c3b6579d8e04 /libopna/opnassg.c
parent41ebb5a449feea3ead78398a3e225c10fd3fc303 (diff)
libopna: ssg tone period access function
Diffstat (limited to 'libopna/opnassg.c')
-rw-r--r--libopna/opnassg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libopna/opnassg.c b/libopna/opnassg.c
index 3c5b108..223758c 100644
--- a/libopna/opnassg.c
+++ b/libopna/opnassg.c
@@ -108,8 +108,10 @@ unsigned opna_ssg_readreg(const struct opna_ssg *ssg, unsigned reg) {
return ssg->regs[reg];
}
-static int opna_ssg_tone_period(const struct opna_ssg *ssg, int chan) {
- return ssg->regs[0+chan*2] | ((ssg->regs[1+chan*2] & 0xf) << 8);
+unsigned opna_ssg_tone_period(const struct opna_ssg *ssg, int ch) {
+ if (ch < 0) return 0;
+ if (ch >= 3) return 0;
+ return ssg->regs[0+ch*2] | ((ssg->regs[1+ch*2] & 0xf) << 8);
}
static bool opna_ssg_chan_env(const struct opna_ssg *ssg, int chan) {