summaryrefslogtreecommitdiff
path: root/main.h
diff options
context:
space:
mode:
authornotaz2011-09-06 20:18:34 +0300
committernotaz2011-09-08 00:48:33 +0300
commit2f1c528a6c37558760b28638d271f5ff9ba45e4f (patch)
treecf0efc8e28469726fd231e54f8655ae94ecdc891 /main.h
parenta231964c3570be4cf3d2efd023090b6a9e730935 (diff)
downloadpicogpsp-2f1c528a6c37558760b28638d271f5ff9ba45e4f.tar.gz
picogpsp-2f1c528a6c37558760b28638d271f5ff9ba45e4f.tar.bz2
picogpsp-2f1c528a6c37558760b28638d271f5ff9ba45e4f.zip
tweak sound buffering and timing to better match pandora's refresh.
this also changes how direct sound channels are started and sample step precision is increased to hopefully fix gbc + direct channel desync that has been reported on the forums.
Diffstat (limited to 'main.h')
-rw-r--r--main.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/main.h b/main.h
index 6cd471e..671974c 100644
--- a/main.h
+++ b/main.h
@@ -48,7 +48,7 @@ typedef struct
u32 reload;
u32 prescale;
u32 stop_cpu_ticks;
- fixed16_16 frequency_step;
+ fixed8_24 frequency_step;
timer_ds_channel_type direct_sound_channels;
timer_irq_type irq;
timer_status_type status;
@@ -132,8 +132,7 @@ static u32 prescale_table[] = { 0, 6, 8, 10 };
if(timer[timer_number].direct_sound_channels & (0x01 << channel)) \
{ \
direct_sound_channel[channel].buffer_index = \
- (direct_sound_channel[channel].buffer_index + buffer_adjust) % \
- BUFFER_SIZE; \
+ (gbc_sound_buffer_index + buffer_adjust) % BUFFER_SIZE; \
} \
#define trigger_timer(timer_number) \
@@ -164,8 +163,8 @@ static u32 prescale_table[] = { 0, 6, 8, 10 };
if(timer_number < 2) \
{ \
u32 buffer_adjust = \
- (u32)(((float)(cpu_ticks - timer[timer_number].stop_cpu_ticks) * \
- sound_frequency) / 16777216.0) * 2; \
+ (u32)(((float)(cpu_ticks - gbc_sound_last_cpu_ticks) * \
+ sound_frequency) / GBC_BASE_RATE) * 2; \
\
sound_update_frequency_step(timer_number); \
adjust_sound_buffer(timer_number, 0); \