What's the format of `AUDIO_S16SYS'?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, people:

I'm quite new to audios, could anyone please tell me what's the format

of `AUDIO_S16SYS’? Are they ADPCM samples? I’ve seem some audio
decoder(such as ffmpeg) send the decoded stream and then use SDL to
display sound:

/* prepare audio output */
if (enc->codec_type == CODEC_TYPE_AUDIO) {
    wanted_spec.freq = enc->sample_rate;
    wanted_spec.format = AUDIO_S16SYS;
    /* hack for AC3. XXX: suppress that */
    if (enc->channels > 2)
        enc->channels = 2;
    wanted_spec.channels = enc->channels;
    wanted_spec.silence = 0;
    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
    wanted_spec.callback = sdl_audio_callback;
    wanted_spec.userdata = is;
    if (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
        fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
        return -1;
    }
    is->audio_hw_buf_size = spec.size;
}

Sorry for my bad english -_-

    • sigsegv
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDl9dMzm46SfqoYmQRAjeMAKCkROtGKLPZmio3MXeW+aW83PrFRwCeJZI1
rBTE9dEdhnkzFDvQf+WQbFY=
=Pxda
-----END PGP SIGNATURE-----

I’m quite new to audios, could anyone please tell me what’s the format
of `AUDIO_S16SYS’? Are they ADPCM samples? I’ve seem some audio
decoder(such as ffmpeg) send the decoded stream and then use SDL to
display sound:

They are raw samples (“PCM”), signed 16 bit integers per channel (so 32
bits per sample frame if you’re in stereo mode, etc), and in the byte
order of the platform running the program.

SDL by itself doesn’t decode most higher-level formats (just
uncompressed .WAV, IMA-ADPCM and MS-ADPCM .WAV in SDL_LoadWAV)…if you
want to handle any serious formats, like MP3 or OGG, you have to look
elsewhere for something to build on top of SDL…SDL mostly just plays
noise, but supplying the noise is up to the application.

–ryan.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ryan C. Gordon wrote:

I’m quite new to audios, could anyone please tell me what’s the format
of `AUDIO_S16SYS’? Are they ADPCM samples? I’ve seem some audio
decoder(such as ffmpeg) send the decoded stream and then use SDL to
display sound:

They are raw samples (“PCM”), signed 16 bit integers per channel (so 32
bits per sample frame if you’re in stereo mode, etc), and in the byte
order of the platform running the program.

SDL by itself doesn’t decode most higher-level formats (just
uncompressed .WAV, IMA-ADPCM and MS-ADPCM .WAV in SDL_LoadWAV)…if you
want to handle any serious formats, like MP3 or OGG, you have to look
elsewhere for something to build on top of SDL…SDL mostly just plays
noise, but supplying the noise is up to the application.

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks Ryan, the answer is exactly what I need :=)


    • sigsegv
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.2 (MingW32)

iD8DBQFDmAzhzm46SfqoYmQRAi7FAKCSlcuZ90KyILvYvzRXccK0BW+aogCgkd+x
LAOFXCBVYj6Y/Fbi9jOBgrU=
=0iIb
-----END PGP SIGNATURE-----