Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4901

SDK • Re: PCM playback issues

$
0
0
What I've done is initialised all the sound in audio_init and this sets a flag so that keyboard_tasks can call audio_update without the sound driver being setup. but once I've initialised it then it crashes. The audio update is just this so far.

Code:

bool audio_update(){  if (!SOUND_INIT) return true;  uint16_t *ptr = (first ? soundBuffer2 : soundBuffer16);  for(uint32_t f=0;f<NUMSAMPLES;f++,ptr++)  {    *ptr = PSG_calc(psg0) + PT52SG_calc(ptsg) + SNG_calc(sng);  }  return true;}
I never changed the buffer sizes. I wanted to see if I could get something and then tweak it instead I got nothing. I was thinking to make keyboard_tasks run twice as fast but use a variable to divide the speed for the other tasks. I'm also slightly concerned that reading a file from disk is going to mess the timing but I haven't gotten that far yet. The buffer size is 2560 (uint16_t) in pico_sound the values is 8800 * 2 buffers so I'm way undersized. So going to 17600 seems like what I should do there is enough spare memory on the RP2350 do do this statically still so I'll try this first. if however I crank the DMA refill faster then I can use a smaller buffer for the RP2040.

Statistics: Posted by DarkElvenAngel — Sat Oct 26, 2024 1:58 pm



Viewing all articles
Browse latest Browse all 4901

Trending Articles