aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-18 03:33:14 -0500
committerNebuleon Fumika2013-01-18 03:33:14 -0500
commit0d5be16895ec6ffe9536c52774c4bf0645224f21 (patch)
tree2bc304f99c278b30dbe064530e306c2d9cdfd7e7 /source
parentbf5cb54162afa5390eab1ae155a9defd44d0f898 (diff)
downloadsnesemu-0d5be16895ec6ffe9536c52774c4bf0645224f21.tar.gz
snesemu-0d5be16895ec6ffe9536c52774c4bf0645224f21.tar.bz2
snesemu-0d5be16895ec6ffe9536c52774c4bf0645224f21.zip
Revert "Reinstate timer-interrupt audio."
This reverts commit 944d9a729455de435c3d200752308ceedf250196. Conflicts: source/nds/entry.cpp
Diffstat (limited to 'source')
-rw-r--r--source/nds/entry.cpp48
-rw-r--r--source/nds/gui.c3
2 files changed, 6 insertions, 45 deletions
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 1301ba7..cef73c1 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -24,7 +24,6 @@
#include "ds2sound.h"
void S9xProcessSound (unsigned int);
-void NDSSFCProduceSound (unsigned int);
char *rom_filename = NULL;
char *SDD1_pack = NULL;
@@ -535,13 +534,6 @@ int sfc_main (int argc, char **argv)
TRUE,
#endif
Settings.SoundBufferSize);
- // Start a timer for the sound
- initTimer(0 /* timer channel, 0 or 1 */,
- INTERRUPT_TIME /* period in microseconds */,
- NDSSFCProduceSound /* timer function, void (unsigned int) */,
- 0 /* programmer-specified argument to ^ */);
- runTimer(0 /* timer channel, 0 or 1 */);
-
#ifdef GFX_MULTI_FORMAT
// S9xSetRenderPixelFormat (RGB565);
S9xSetRenderPixelFormat (BGR555);
@@ -854,18 +846,6 @@ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
return (TRUE);
}
-/*
- * In the interrupt model, calls to NDSSFCProduceSound could happen even
- * when the CPU or APU is being reset or reloaded from a file. Prevent
- * glitches and/or crashes (!) from occurring while sound is not being
- * generated.
- */
-static volatile bool8 IsSoundGenerated = FALSE;
-/*
- * Also prevent an interrupt from triggering on top of another one.
- */
-static volatile bool8 InInterrupt = FALSE;
-
void S9xGenerateSound ()
{
block_signal = TRUE;
@@ -932,16 +912,13 @@ void S9xGenerateSound ()
} while (samples_to_write > 0);
}
- IsSoundGenerated = TRUE;
-
end:
if (pending_signal)
{
block_signal = FALSE;
pending_signal = FALSE;
- // S9xProcessSound (0);
- NDSSFCProduceSound (0);
+ S9xProcessSound (0);
}
else
block_signal = FALSE;
@@ -949,31 +926,22 @@ end:
void S9xProcessSound (unsigned int)
{
- // Nothing here! See the interrupt handling code below.
-}
-
-void NDSSFCProduceSound (unsigned int unused)
-{
- if (InInterrupt)
- return;
-
- InInterrupt = TRUE;
if (DelayingForEarlyFrame)
set_cpu_clock(clock_speed_number);
if (block_signal)
{
pending_signal = TRUE;
- goto end;
+ return;
}
unsigned short *audiobuff;
- if (Settings.Paused || !IsSoundGenerated || so.mute_sound || !game_enable_audio)
- goto end;
+ if (Settings.Paused || so.mute_sound || !game_enable_audio)
+ return;
if(ds2_checkAudiobuff() > 4)
- goto end;
+ return;
/* Number of samples to generate now */
int sample_count;
@@ -993,7 +961,7 @@ void NDSSFCProduceSound (unsigned int unused)
audiobuff = (unsigned short*)ds2_getAudiobuff();
if(NULL == audiobuff) //There are audio queue in sending or wait to send
{
- goto end;
+ return;
}
/* If we need more audio samples */
@@ -1108,15 +1076,11 @@ void NDSSFCProduceSound (unsigned int unused)
/* All data sent. */
}
- IsSoundGenerated = FALSE;
-
so.samples_mixed_so_far -= sample_count;
end:
if (DelayingForEarlyFrame)
ds2_setCPUclocklevel(0);
-
- InInterrupt = FALSE;
}
/*
diff --git a/source/nds/gui.c b/source/nds/gui.c
index f668a5f..a7cd357 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -1654,7 +1654,6 @@ unsigned int frame_interval;
--------------------------------------------------------*/
u32 menu(u16 *screen)
{
- stopTimer(0 /* timer interrupt channel for sound */);
gui_action_type gui_action;
u32 i;
u32 repeat;
@@ -3863,8 +3862,6 @@ u32 menu(u16 *screen)
set_cpu_clock(clock_speed_number);
- runTimer(0 /* timer interrupt channel for sound */);
-
return return_value;
}