summaryrefslogtreecommitdiff
path: root/sound.c
diff options
context:
space:
mode:
authoraliaspider2014-12-09 05:36:30 +0100
committeraliaspider2014-12-09 05:36:30 +0100
commitcd185c849b428b2d673fe94809b3ec62f376c0cb (patch)
treeb7f8725cc83e29f39c264fef5332556e5af32505 /sound.c
parentb69fee8b3139eb26405c20aa3adde166f9034b59 (diff)
downloadpicogpsp-cd185c849b428b2d673fe94809b3ec62f376c0cb.tar.gz
picogpsp-cd185c849b428b2d673fe94809b3ec62f376c0cb.tar.bz2
picogpsp-cd185c849b428b2d673fe94809b3ec62f376c0cb.zip
enable sound ( still broken )
Diffstat (limited to 'sound.c')
-rw-r--r--sound.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sound.c b/sound.c
index 1683f9f..5d7d475 100644
--- a/sound.c
+++ b/sound.c
@@ -27,7 +27,11 @@ u32 global_enable_audio = 1;
direct_sound_struct direct_sound_channel[2];
gbc_sound_struct gbc_sound_channel[4];
+#ifdef __LIBRETRO__
+u32 sound_frequency = GBA_SOUND_FREQUENCY;
+#else
u32 sound_frequency = 44100;
+#endif
#ifndef __LIBRETRO__
SDL_mutex *sound_mutex;
@@ -604,7 +608,7 @@ void update_gbc_sound(u32 cpu_ticks)
source[i] = 0; \
} \
-
+#ifndef __LIBRETRO__
void sound_callback(void *userdata, u8 *stream, int length)
{
u32 sample_length = length / 2;
@@ -614,7 +618,6 @@ void sound_callback(void *userdata, u8 *stream, int length)
s16 *source;
s32 current_sample;
-#ifndef __LIBRETRO__
SDL_LockMutex(sound_mutex);
while(((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) <
@@ -622,7 +625,6 @@ void sound_callback(void *userdata, u8 *stream, int length)
{
SDL_CondWait(sound_cv, sound_mutex);
}
-#endif
if(global_enable_audio)
{
@@ -657,12 +659,11 @@ void sound_callback(void *userdata, u8 *stream, int length)
}
}
-#ifndef __LIBRETRO__
SDL_CondSignal(sound_cv);
SDL_UnlockMutex(sound_mutex);
-#endif
}
+#endif
// Special thanks to blarrg for the LSFR frequency used in Meridian, as posted
// on the forum at http://meridian.overclocked.org:
@@ -852,12 +853,13 @@ void render_audio(void)
u32 i;
s32 current_sample;
- return;
+// return;
- while (((gbc_sound_buffer_index - sound_buffer_base) % BUFFER_SIZE) > 512) {
+ while (((gbc_sound_buffer_index - sound_buffer_base) & BUFFER_SIZE_MASK) > 512) {
sound_copy(sound_buffer_base, 512, normal);
audio_batch_cb(stream_base, 256);
sound_buffer_base += 512;
+ sound_buffer_base &= BUFFER_SIZE_MASK;
}
}
#endif