diff options
author | Chris Robinson <[email protected]> | 2014-11-25 22:20:00 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-11-25 22:20:00 -0800 |
commit | bdbf6613ef4d57f15f5e7e3cbc31211a0c57e575 (patch) | |
tree | 298b76ea7a08d4625deca17ec41db90635dae956 /Alc/backends | |
parent | be476b372993647376de5d6133bd37e7fa77df17 (diff) |
Support B-Format output with the wave file writer
Diffstat (limited to 'Alc/backends')
-rw-r--r-- | Alc/backends/coreaudio.c | 1 | ||||
-rw-r--r-- | Alc/backends/dsound.c | 5 | ||||
-rw-r--r-- | Alc/backends/mmdevapi.c | 3 | ||||
-rw-r--r-- | Alc/backends/opensl.c | 1 | ||||
-rw-r--r-- | Alc/backends/pulseaudio.c | 3 | ||||
-rw-r--r-- | Alc/backends/wave.c | 20 | ||||
-rw-r--r-- | Alc/backends/winmm.c | 1 |
7 files changed, 33 insertions, 1 deletions
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c index b38cc4ee..43e881da 100644 --- a/Alc/backends/coreaudio.c +++ b/Alc/backends/coreaudio.c @@ -522,6 +522,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: + case DevFmtBFormat3D: ERR("%s not supported\n", DevFmtChannelsString(device->FmtChans)); goto error; } diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c index 378c0798..fee1fd98 100644 --- a/Alc/backends/dsound.c +++ b/Alc/backends/dsound.c @@ -468,6 +468,9 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) case DevFmtMono: OutputType.dwChannelMask = SPEAKER_FRONT_CENTER; break; + case DevFmtBFormat3D: + device->FmtChans = DevFmtStereo; + /*fall-through*/ case DevFmtStereo: OutputType.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; @@ -780,6 +783,8 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT; break; + case DevFmtBFormat3D: + break; } InputType.Format.wFormatTag = WAVE_FORMAT_PCM; diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index e79122af..95a0948c 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -816,6 +816,9 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) OutputType.Format.nChannels = 1; OutputType.dwChannelMask = MONO; break; + case DevFmtBFormat3D: + device->FmtChans = DevFmtStereo; + /*fall-through*/ case DevFmtStereo: OutputType.Format.nChannels = 2; OutputType.dwChannelMask = STEREO; diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c index 6a022753..1043359c 100644 --- a/Alc/backends/opensl.c +++ b/Alc/backends/opensl.c @@ -79,6 +79,7 @@ static SLuint32 GetChannelMask(enum DevFmtChannels chans) SL_SPEAKER_FRONT_CENTER|SL_SPEAKER_LOW_FREQUENCY| SL_SPEAKER_BACK_LEFT|SL_SPEAKER_BACK_RIGHT| SL_SPEAKER_SIDE_LEFT|SL_SPEAKER_SIDE_RIGHT; + case DevFmtBFormat3D: break; } return 0; } diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 783ed3ce..7ad7dd18 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -956,6 +956,9 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) case DevFmtMono: mapname = "mono"; break; + case DevFmtBFormat3D: + device->FmtChans = DevFmtStereo; + /*fall-through*/ case DevFmtStereo: mapname = "front-left,front-right"; break; diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c index 6999f0cb..bfe0e2cf 100644 --- a/Alc/backends/wave.c +++ b/Alc/backends/wave.c @@ -44,6 +44,15 @@ static const ALubyte SUBTYPE_FLOAT[] = { 0x00, 0x38, 0x9b, 0x71 }; +static const ALubyte SUBTYPE_BFORMAT_PCM[] = { + 0x01, 0x00, 0x00, 0x00, 0x21, 0x07, 0xd3, 0x11, 0x86, 0x44, 0xc8, 0xc1, + 0xca, 0x00, 0x00, 0x00 +}; + +static const ALubyte SUBTYPE_BFORMAT_FLOAT[] = { + 0x03, 0x00, 0x00, 0x00, 0x21, 0x07, 0xd3, 0x11, 0x86, 0x44, 0xc8, 0xc1, + 0xca, 0x00, 0x00, 0x00 +}; static void fwrite16le(ALushort val, FILE *f) { @@ -233,11 +242,15 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ALuint channels=0, bits=0, chanmask=0; + int isbformat = 0; size_t val; fseek(self->mFile, 0, SEEK_SET); clearerr(self->mFile); + if(GetConfigValueBool("wave", "bformat", 0)) + device->FmtChans = DevFmtBFormat3D; + switch(device->FmtType) { case DevFmtByte: @@ -264,6 +277,10 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break; case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break; case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; + case DevFmtBFormat3D: + isbformat = 1; + chanmask = 0; + break; } bits = BytesFromDevFmt(device->FmtType) * 8; channels = ChannelsFromDevFmt(device->FmtChans); @@ -295,7 +312,8 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) // 32-bit val, channel mask fwrite32le(chanmask, self->mFile); // 16 byte GUID, sub-type format - val = fwrite(((bits==32) ? SUBTYPE_FLOAT : SUBTYPE_PCM), 1, 16, self->mFile); + val = fwrite(((bits==32) ? (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) : + (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM)), 1, 16, self->mFile); (void)val; fprintf(self->mFile, "data"); diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c index 74d3f858..fe2701b0 100644 --- a/Alc/backends/winmm.c +++ b/Alc/backends/winmm.c @@ -561,6 +561,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: + case DevFmtBFormat3D: return ALC_INVALID_ENUM; } |