#141498 - ingramb - Wed Sep 26, 2007 9:40 am
Still working on sound streaming. I have several different streaming channels, with 2 possible frequencies. So I need 2 timers for each different frequency, like so (all of this is on the arm7):
My timer interrupt handlers look like this:
Everything is fine if I just use timer0 and timer1. I don't have any audio streaming hooked up to timer2 and timer3 yet, but if I even enable them, the audio I have gets hosed. It's like the timer3Handler is causing everything to get out of sync.
But this doesn't make sense to me, because at worst, the timer1Handler will only be delayed a few instructions by the timer3Handler. And I'm only polling these counters on the arm9 once per vblank, so if the counter is slightly delayed, it shouldn't matter (as long as the timer resets itself and continues counting with no delay).
Any ideas as to what's causing this?
Code: |
TIMER_DATA(0) = TIMER_FREQ(freq1);
TIMER_CR(0) = TIMER_ENABLE; TIMER_DATA(1) = 65536 - streamSize1; TIMER_CR(1) = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; TIMER_DATA(2) = TIMER_FREQ(freq2); TIMER_CR(2) = TIMER_ENABLE; TIMER_DATA(3) = 65536 - streamSize2; TIMER_CR(3) = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE; |
My timer interrupt handlers look like this:
Code: |
void Timer1Handler()
{ NEOIPC->audioStreamCount++; } void Timer3Handler() { NEOIPC->audioStreamCount2++; } |
Everything is fine if I just use timer0 and timer1. I don't have any audio streaming hooked up to timer2 and timer3 yet, but if I even enable them, the audio I have gets hosed. It's like the timer3Handler is causing everything to get out of sync.
But this doesn't make sense to me, because at worst, the timer1Handler will only be delayed a few instructions by the timer3Handler. And I'm only polling these counters on the arm9 once per vblank, so if the counter is slightly delayed, it shouldn't matter (as long as the timer resets itself and continues counting with no delay).
Any ideas as to what's causing this?