Hi Henk,

Despite the sample code you attached, I still can't
get SndPlayPCM to work.

I constantly get BadParam Error.

I have tried both IMA/ADPCM and M$/ADPCM, but no luck.

Do you mind putting together a sample app with sample wave ?

Thanks.
Alex
([EMAIL PROTECTED])


Henk Jonas wrote:



As send in a personal email already:

Alexander,

Look at the docs for Sony's sound manager:

Figure 9-2 Structure of a PCM(ADPCM) Record Without Sub-records

so you need ADPCM format, which is a special codec for wave files.

Then you have the SndPcmFormatType:

This structure specifies the PCM data format.
typedef struct _tagSndPcmFormatType {
UInt16 formatTag;
UInt16 numOfChan;
UInt32 samplePerSec;
UInt16 bitPerSample;
UInt32 dataSize;
} SndPcmFormatType;
Field Descriptions
* formatTag Specifies the PCM data type.
Only �0x0020� is supported.
* numOfChan Number of PCM data channels.
Only �1� is supported.
* samplePerSec Sampling rate of the PCM data.
Only �4000� and �8000� are supported.
* bitPerSample Number of bits per sample in the PCM data.
Only �4� is supported.
* dataSize PCM data size. If there are data in sub-records, the total size is shown.

You should look out for an external program to convert your audio files to ADPCM format. GoldWave can do it, but is shareware. If you find something for free, please let me know...
To my code snippet:

type is just the argument which I use to know which sound I should play. Is something like:

if (type == SOUND_1)
play_sound_1
else if (type == SOUND_2)
play_sound_2
... and so on.


volume_setting is a number between 0 and 64 and is the volume to use for playing.

soundTrefferPtr is the locked resource ptr and 0x2c is the offset of the start of the real samples inside a wave file.

The code snippet is from my game basketball, which you can download at palmgear.

Henk

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to