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


Alexander Galkin wrote:
Thank you very much for your response. It is actually first time I got any
useful information on this subject. One important detail, however. We do not
have adpcm data. Instead we have 8 kHz and 16 kHz mono regular Windows PCM
data. Also in your code snippet what are 'type' and 'volume_setting'. I
would be very thankful to you if you send me an example how to play raw PCM
data on Sony Clie.

Thank you in advance.



"Henk Jonas" <[EMAIL PROTECTED]> wrote in message
news:105758@palm-dev-forum...


Alexander Galkin wrote:

[...]
seems deals with PCM audio, but there is no documentation about it. Does

any

one have any information about how to play raw PCM on Palm OS 5 powered

Sony

Clie.
[...]
Yes, I think so:



else if (SonySMLibRefNum)
{
// This structure specifies the PCM data format.
SndPcmFormatType format;
// This structure is passed to the SndPlayPcm function as the value
of the selP parameter.
SndPcmOptionsType options;

format.formatTag = 0x20;
format.numOfChan = 1;
format.samplePerSec = 8000;
format.bitPerSample = 4;

if (volume_setting < 0)
options.amplitude = SoundAmp;
else
options.amplitude = volume_setting;
options.pan = 0;
options.interruptible = true;
options.dwStartMilliSec = 0;
options.dwEndMilliSec = sndSmfPlayAllMilliSec;

if ((type == SOUND_TREFFER) && soundTrefferPtr)
{
format.dataSize = soundTrefferSize - 0x2c;
SndPlayPcm(SonySMLibRefNum, NULL, sndPcmCmdPlay, soundTrefferPtr +
0x2c, &format, &options, NULL, true);
bSoundPlayed = true;
}


The sounds are adpcm files with 4 bit and 8 kHz.

Henk


--
-------------------------------------------------------------------------
[EMAIL PROTECTED]                                       www.metaviewsoft.de

<A HREF="http://www.handango.com/PlatformTopSoftware.jsp?authorId=95946";>
<IMG SRC="http://user.cs.tu-berlin.de/~jonash/werbung_palmos.jpg";></A>
-------------------------------------------------------------------------








--
-------------------------------------------------------------------------
[EMAIL PROTECTED]                                       www.metaviewsoft.de

<A HREF="http://www.handango.com/PlatformTopSoftware.jsp?authorId=95946";>
<IMG SRC="http://user.cs.tu-berlin.de/~jonash/werbung_palmos.jpg";></A>
-------------------------------------------------------------------------


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

Reply via email to