PDA

View Full Version : Programming with the ALSA API.



WebmasterMattD
01-24-2003, 06:54 PM
I have started playing around with the ALSA API, though there are a couple of things that puzzle me.

At the moment what I have is this



fstream wavFileReader;
char *data[ 8092 ];

wavFileReader.open( "wavFile.wav", ios::binary );

snd_pcm_writei( pcm_handle, data, frames );

while( !wavFileReader.eof() )
{
wavFileReader >> setw( 8091 ) >> data;
snd_pcm_writei( pcm_handle, data, frames );
}



pcm_handle is a structure that is used for the alsa sound lib, and I doubt if it would be required to give the entire setup of it.

the snd_pcm_writei() function returns the number of frames that has actualy been written to the sound card. Though this is what I have no idea about.

What is a typical value for the number of frames to write to the sound card? ( eg SB Live )

in the ALSA code that I have been looking at, it defines the number of frames to be:


int periodsize = 8192;
int frames = periodsize >> 2; // C Style code

Though I have no idea what this actualy does.

Any help would be good.

The documentation that I have been reading from can be found at
http://www.suse.de/~mana/alsa090_howto.html

Later,