aboutsummaryrefslogtreecommitdiff
path: root/source/nds
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-08 15:04:53 -0500
committerNebuleon Fumika2013-01-08 15:04:53 -0500
commit1beb671de1d39964ad3453e28fd48a117046a8cb (patch)
tree8a27664cf771d2a1df399c23acf5546b1e9a2613 /source/nds
parent12c5afbe60035f52da6ae33e853ea01fe075d06c (diff)
downloadsnes9x2005-1beb671de1d39964ad3453e28fd48a117046a8cb.tar.gz
snes9x2005-1beb671de1d39964ad3453e28fd48a117046a8cb.tar.bz2
snes9x2005-1beb671de1d39964ad3453e28fd48a117046a8cb.zip
Configurable interrupt interval for the sound timer. Right now, only 22050 Hz audio at 2000-microsecond intervals works.
Diffstat (limited to 'source/nds')
-rw-r--r--source/nds/ds2sound.h14
-rw-r--r--source/nds/entry.cpp4
2 files changed, 10 insertions, 8 deletions
diff --git a/source/nds/ds2sound.h b/source/nds/ds2sound.h
index 089afb6..b901939 100644
--- a/source/nds/ds2sound.h
+++ b/source/nds/ds2sound.h
@@ -1,12 +1,11 @@
// The sound buffer sizes used on the DS2's side, for each value of
// Settings.SoundPlaybackRate.
-#define DS2_BUFFER_SIZE_1 256
-#define DS2_BUFFER_SIZE_2 256
-#define DS2_BUFFER_SIZE_3 256
-#define DS2_BUFFER_SIZE_4 512
-#define DS2_BUFFER_SIZE_5 512
-#define DS2_BUFFER_SIZE_6 1024
-#define DS2_BUFFER_SIZE_7 1024
+#define DS2_BUFFER_SIZE_4 512 /* tested working */
+// Others don't work, or don't work well.
+
+// In microseconds.
+#define INTERRUPT_TIME_4 2000 /* tested working */
+// Others don't work, or don't work well.
// The sampling rate for the sound, in Hz, for each value of
// Settings.SoundPlaybackRate.
@@ -19,6 +18,7 @@
#define SND_SAMPLE_RATE_7 48000
// Settings in use. The number should match in all three settings.
+#define INTERRUPT_TIME INTERRUPT_TIME_4
#define DS2_BUFFER_SIZE DS2_BUFFER_SIZE_4
#define SND_SAMPLE_RATE SND_SAMPLE_RATE_4
#define SNES9X_SRATE_ID 4
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index f14c917..a666a0b 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -538,7 +538,7 @@ int sfc_main (int argc, char **argv)
Settings.SoundBufferSize);
// Start a timer for the sound
initTimer(0 /* timer channel, 0 or 1 */,
- 2000 /* period in microseconds */,
+ INTERRUPT_TIME /* period in microseconds */,
NDSSFCProduceSound /* timer function, void (unsigned int) */,
0 /* programmer-specified argument to ^ */);
runTimer(0 /* timer channel, 0 or 1 */);
@@ -1157,6 +1157,8 @@ void NDSSFCProduceSound (unsigned int unused)
/* All data sent. */
}
+ IsSoundGenerated = FALSE;
+
so.samples_mixed_so_far -= sample_count;
}