Still problems to play soundfiles

Hi!

I still have problems to play a raw audio file.

This is my code:
-------------- snip ---------------------------
Sound_AudioInfo *WantedSpec_HZ;
Sound_Sample *sample;

Sound_Init();

WantedSpec_HZ =
(Sound_AudioInfo*)malloc(sizeof(Sound_AudioInfo));
WantedSpec_HZ->rate = 44100;
WantedSpec_HZ->format = AUDIO_U16MSB;
WantedSpec_HZ->channels = 1;

sample =
Sound_NewSampleFromFile(UserSystemPtr->Sfx.SampleSlots[Pos_HZ],
WantedSpec_HZ, 8192);
Sound_DecodeAll(sample);
Sound_FreeSample(sample);
Sound_Quit();
------------------- snip ---------------
A soundfile can be downloaded on
http://athene.dnsalias.org/MausKlick.raw.gz
The file is a 16 bit sound file in big-endian format (created on an
Amiga).

Currently I get no errors with the code above but I cannot hear any
noise :frowning:
I think it is yet not necessary to turn big-endian into little-endian
because I just want to hear a kind of noise.

So I hope someone can give me a hint.

Thanks and regards,
Hauke–
Aus Ben Hur (1959): Wer nicht fuer Rom ist, ist gegen Rom
George W. Bush (2002): Wer nicht fuer uns ist, ist gegen uns

You will need to specify the RAW decoder explicitly. It is not used unless
you force it to be used, because there is no way to autodetect RAW audio.On Saturday 15 November 2003 12:10 pm, Hauke J. Zuehl wrote:

Hi!

I still have problems to play a raw audio file.

This is my code:
-------------- snip ---------------------------
Sound_AudioInfo *WantedSpec_HZ;
Sound_Sample *sample;

Sound_Init();

WantedSpec_HZ =
(Sound_AudioInfo*)malloc(sizeof(Sound_AudioInfo));
WantedSpec_HZ->rate = 44100;
WantedSpec_HZ->format = AUDIO_U16MSB;
WantedSpec_HZ->channels = 1;

sample =
Sound_NewSampleFromFile(UserSystemPtr->Sfx.SampleSlots[Pos_HZ],
WantedSpec_HZ, 8192);
Sound_DecodeAll(sample);
Sound_FreeSample(sample);
Sound_Quit();
------------------- snip ---------------
A soundfile can be downloaded on
http://athene.dnsalias.org/MausKlick.raw.gz
The file is a 16 bit sound file in big-endian format (created on an
Amiga).

Currently I get no errors with the code above but I cannot hear any
noise :frowning:
I think it is yet not necessary to turn big-endian into little-endian
because I just want to hear a kind of noise.

So I hope someone can give me a hint.

Thanks and regards,
Hauke

Sound_Init();

WantedSpec_HZ =
(Sound_AudioInfo*)malloc(sizeof(Sound_AudioInfo));
WantedSpec_HZ->rate = 44100;
WantedSpec_HZ->format = AUDIO_U16MSB;
WantedSpec_HZ->channels = 1;

The file sounds like it should be AUDIO_S16MSB (at least, that sounds
like a click and not static here, unlike AUDIO_U16MSB).

sample =
Sound_NewSampleFromFile(UserSystemPtr->Sfx.SampleSlots[Pos_HZ],
WantedSpec_HZ, 8192);
Sound_DecodeAll(sample);
Sound_FreeSample(sample);
Sound_Quit();

You didn’t do anything with the audio data. SDL_sound just decodes the
sound file to a buffer in memory. It doesn’t actually play it to the
audio device.

You need to use SDL’s audio subsystem to play the decoded audio.

You might be more interested in SDL_mixer at this time.

–ryan.

Hi :slight_smile:

The file sounds like it should be AUDIO_S16MSB (at least, that sounds
like a click and not static here, unlike AUDIO_U16MSB).

Well, okay I can change it immediately :slight_smile:

You didn’t do anything with the audio data. SDL_sound just decodes the
sound file to a buffer in memory. It doesn’t actually play it to the
audio device.

You need to use SDL’s audio subsystem to play the decoded audio.

Argggh!
Okay :)))

You might be more interested in SDL_mixer at this time.

Ahhhmmm…yes :))

Thanks and regards,
HaukeAm Sam, 2003-11-15 um 20.28 schrieb Ryan C. Gordon:

Aus Ben Hur (1959): Wer nicht fuer Rom ist, ist gegen Rom
George W. Bush (2002): Wer nicht fuer uns ist, ist gegen uns