SDL AudioThread error May 01, 2010 09:26PM | Registered: 15 years ago Posts: 74 |
Re: SDL AudioThread error May 01, 2010 11:03PM | Moderator Registered: 15 years ago Posts: 703 |
Re: SDL AudioThread error May 01, 2010 11:59PM | Registered: 15 years ago Posts: 74 |
/**************************************************************************** * Audio Threading ***************************************************************************/ static void * AudioThread (void *arg) { while (1) { if(stopaudio) break; whichab ^= 1; memset(dma_buffers[whichab], 0, sizeof(dma_buffers[0])); // Is the device ready? if (current_audio && (!current_audio->paused)) { // Is conversion required? if (current_audio->convert.needed) { SDL_mutexP(current_audio->mixer_lock); // Get the client to produce audio current_audio->spec.callback( current_audio->spec.userdata, current_audio->convert.buf, current_audio->convert.len); SDL_mutexV(current_audio->mixer_lock); // Convert the audio SDL_ConvertAudio(¤t_audio->convert); // Copy from SDL buffer to DMA buffer memcpy(dma_buffers[whichab], current_audio->convert.buf, current_audio->convert.len_cvt); } else { SDL_mutexP(current_audio->mixer_lock); current_audio->spec.callback( current_audio->spec.userdata, (Uint8 *)dma_buffers[whichab], SAMPLES_PER_DMA_BUFFER*4); SDL_mutexV(current_audio->mixer_lock); } } LWP_ThreadSleep (audioqueue); } return NULL; }On line SDL_mutexV(current_audio->mixer_lock);
Re: SDL AudioThread error May 02, 2010 12:08AM | Moderator Registered: 15 years ago Posts: 703 |
Re: SDL AudioThread error May 02, 2010 10:17AM | Registered: 15 years ago Posts: 74 |