diff options
author | Ryan C. Gordon <icculus@icculus.org> | 2013-07-14 13:27:54 -0400 |
---|---|---|
committer | Ryan C. Gordon <icculus@icculus.org> | 2013-07-14 13:27:54 -0400 |
commit | 2d418d0dffa014daf8f524dd968a935aec358a76 (patch) | |
tree | 3de99a95b5fd36b0703d8862be678ed957d656c6 /src/audio/directsound/SDL_directsound.c | |
parent | 450f022d3a32d61ab0a97d3bf9f6ca244a28244e (diff) | |
download | sdl-2d418d0dffa014daf8f524dd968a935aec358a76.tar.gz |
Implement float32 support for winmm and directsound targets (Thanks, John!).
Fixes Bugzilla #1657.
Diffstat (limited to 'src/audio/directsound/SDL_directsound.c')
-rw-r--r-- | src/audio/directsound/SDL_directsound.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index e320056b5..f08204494 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -30,6 +30,10 @@ #include "../SDL_audio_c.h" #include "SDL_directsound.h" +#ifndef WAVE_FORMAT_IEEE_FLOAT +#define WAVE_FORMAT_IEEE_FLOAT 0x0003 +#endif + /* DirectX function pointers for audio */ static void* DSoundDLL = NULL; typedef HRESULT(WINAPI*fnDirectSoundCreate8)(LPGUID,LPDIRECTSOUND*,LPUNKNOWN); @@ -466,6 +470,7 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) case AUDIO_U8: case AUDIO_S16: case AUDIO_S32: + case AUDIO_F32: this->spec.format = test_format; valid_format = 1; break; @@ -479,7 +484,12 @@ DSOUND_OpenDevice(_THIS, const char *devname, int iscapture) } SDL_memset(&waveformat, 0, sizeof(waveformat)); - waveformat.wFormatTag = WAVE_FORMAT_PCM; + + if (SDL_AUDIO_ISFLOAT(this->spec.format)) + waveformat.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + else + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); waveformat.nChannels = this->spec.channels; waveformat.nSamplesPerSec = this->spec.freq; |