View Full Version : How to play multiple wav file ?

07-19-08, 12:15 AM
I use PIKAGrandPrix1.3 and Pika Analog board to make simple call center .
I want play multiple wav file .
I need sample about
IN TPikaHandle channelHandle,
IN PKX_TAudioData * data,
IN PK_U32 flags

07-21-08, 08:20 AM
With the High-Level API, GrandPrix, there are two methods to play audio on a channel.

(method 1) A single file can be played to a channel by calling PKX_CHANNEL_PlayFile( ).

(method 2) Any number of audio data blocks (either a memory buffer or an audio file) can be added to a queue using PKX_CHANNEL_PlayAddData( ), and then played using PKX_CHANNEL_Play( ).

To use method (2) to play multiple WAV files, call PKX_CHANNEL_PlayAddData once for each file. Once you have added all files to the queue, call PKX_CHANNEL_Play to play the contents of the queue to the specified channel.

Here is a general example using method 2:

// 1. create the audioData structure for the data block to be added to the queue
PKX_TAudioData audioData;
memset(&audioData, 0, sizeof(PKX_TAudioData));
audioData.location.filename = <filename>
audioData.length = <length of audio data, in bytes>
audioData.typeFlags = PKX_AUDIO_DATA_TYPE_FILE

// 2. add the file to the queue
PK_STATUS status;
status = PKX_CHANNEL_PlayAddData(channelHandle, &audioData, PKX_AUDIO_WAVE_HEADER | PKX_AUDIO_SAMPLING_RATE_8KHZ);

// 3. repeat steps 1 and 2 above for each file

// 4. create the terminating conditions (none in this case) for the Play command
PKX_TTermCond termCond;
memset(&termCond, 0, sizeof(PKX_TTermCond));

// 5. Start playing the queued buffer
status = PKX_CHANNEL_Play(channelHandle, &termCond);