The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Porting SDL audio callback program to embedded system
bazz


Joined: 25 Oct 2010
Posts: 31
I currently have an SDL application to uses the SDL audio callback function to fill the buffer with samples.. I have a function play() that will fill the buffer from inside the callback..

I am planning on porting my application to an embedded system, and I won't be able to take SDL with me, as I am shooting for a minimalist design.

I was wondering how will I be calling play() now? Since I will no longer have the aid of an automatic SDL callback function..
I figured it out
bazz


Joined: 25 Oct 2010
Posts: 31
It is very implementation specific, but I figured out the answer I needed, for the Samsung S3C44B0X SoC. I'm leaving it here in case anyone stumbles onto this topic.. but in my case, there was an IIS (Inter-IC Sound) bus interface that I used, which DMA'd a memory buffer of samples at a specified sample rate to an external DAC 'codec' chip. That in turn was connected to the speakers and headphones.

The DAC codec chip takes a clock that is sub divided from the master clock, in my case the clock rate for 32,000 Hz sample rate was 8.192 MHz.. and I needed to make sure my master clock was a multiple of that number since I only had whole number clock divisors.

So all I head to do was fill the buffer and then DMA would take care of the rest.. Right now I'm using 2 buffers as a 'flip' method, one to play, one to fill, but I'm interested in making a more of a circular buffer that will work with the preferred DMA size so that I can better optimize how much I can fill.