aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-02-14 11:44:57 -0800
committerChris Robinson <[email protected]>2012-02-14 11:44:57 -0800
commit1140b3ae837437966c9d2474fca8aa17d8193aa5 (patch)
tree6006870627cde536874d1b4aa9fe487655296534 /Alc/backends
parent5e1d1a52bae6d22565bdfe7042da29e61197d36c (diff)
Support signed and unsigned 32-bit int output
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/alsa.c14
-rw-r--r--Alc/backends/coreaudio.c13
-rw-r--r--Alc/backends/dsound.c4
-rw-r--r--Alc/backends/mmdevapi.c10
-rw-r--r--Alc/backends/oss.c4
-rw-r--r--Alc/backends/portaudio.c12
-rw-r--r--Alc/backends/pulseaudio.c10
-rw-r--r--Alc/backends/sndio.c12
-rw-r--r--Alc/backends/solaris.c6
-rw-r--r--Alc/backends/wave.c4
-rw-r--r--Alc/backends/winmm.c4
11 files changed, 90 insertions, 3 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 4bca3845..ffc3519a 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -657,6 +657,12 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
case DevFmtUShort:
format = SND_PCM_FORMAT_U16;
break;
+ case DevFmtInt:
+ format = SND_PCM_FORMAT_S32;
+ break;
+ case DevFmtUInt:
+ format = SND_PCM_FORMAT_U32;
+ break;
case DevFmtFloat:
format = SND_PCM_FORMAT_FLOAT;
break;
@@ -692,6 +698,8 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
enum DevFmtType fmttype;
} formatlist[] = {
{ SND_PCM_FORMAT_FLOAT, DevFmtFloat },
+ { SND_PCM_FORMAT_S32, DevFmtInt },
+ { SND_PCM_FORMAT_U32, DevFmtUInt },
{ SND_PCM_FORMAT_S16, DevFmtShort },
{ SND_PCM_FORMAT_U16, DevFmtUShort },
{ SND_PCM_FORMAT_S8, DevFmtByte },
@@ -908,6 +916,12 @@ static ALCenum alsa_open_capture(ALCdevice *pDevice, const ALCchar *deviceName)
case DevFmtUShort:
format = SND_PCM_FORMAT_U16;
break;
+ case DevFmtInt:
+ format = SND_PCM_FORMAT_S32;
+ break;
+ case DevFmtUInt:
+ format = SND_PCM_FORMAT_U32;
+ break;
case DevFmtFloat:
format = SND_PCM_FORMAT_FLOAT;
break;
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index ad5f0c16..0a1c1e76 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -296,6 +296,14 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
streamFormat.mBytesPerPacket = 2 * streamFormat.mChannelsPerFrame;
streamFormat.mBytesPerFrame = 2 * streamFormat.mChannelsPerFrame;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ /* fall-through */
+ case DevFmtInt:
+ streamFormat.mBitsPerChannel = 32;
+ streamFormat.mBytesPerPacket = 2 * streamFormat.mChannelsPerFrame;
+ streamFormat.mBytesPerFrame = 2 * streamFormat.mChannelsPerFrame;
+ break;
}
streamFormat.mFormatID = kAudioFormatLinearPCM;
streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger |
@@ -455,12 +463,17 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
requestedFormat.mBitsPerChannel = 16;
requestedFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
break;
+ case DevFmtInt:
+ requestedFormat.mBitsPerChannel = 32;
+ requestedFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
+ break;
case DevFmtFloat:
requestedFormat.mBitsPerChannel = 32;
requestedFormat.mFormatFlags = kAudioFormatFlagIsPacked;
break;
case DevFmtByte:
case DevFmtUShort:
+ case DevFmtUInt:
ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType));
goto error;
}
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 84b7377a..51fd8d9b 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -396,8 +396,12 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device)
case DevFmtUShort:
device->FmtType = DevFmtShort;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ break;
case DevFmtUByte:
case DevFmtShort:
+ case DevFmtInt:
case DevFmtFloat:
break;
}
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index f171c059..c6a25f81 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -294,6 +294,14 @@ static HRESULT DoReset(ALCdevice *device)
OutputType.Samples.wValidBitsPerSample = 16;
OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ /* fall-through */
+ case DevFmtInt:
+ OutputType.Format.wBitsPerSample = 32;
+ OutputType.Samples.wValidBitsPerSample = 32;
+ OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ break;
case DevFmtFloat:
OutputType.Format.wBitsPerSample = 32;
OutputType.Samples.wValidBitsPerSample = 32;
@@ -358,6 +366,8 @@ static HRESULT DoReset(ALCdevice *device)
device->FmtType = DevFmtUByte;
else if(OutputType.Format.wBitsPerSample == 16)
device->FmtType = DevFmtShort;
+ else if(OutputType.Format.wBitsPerSample == 32)
+ device->FmtType = DevFmtInt;
else
{
device->FmtType = DevFmtShort;
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index a5adc6ee..0e4a5393 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -206,6 +206,8 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
ossFormat = AFMT_U8;
break;
case DevFmtUShort:
+ case DevFmtInt:
+ case DevFmtUInt:
case DevFmtFloat:
device->FmtType = DevFmtShort;
/* fall-through */
@@ -347,6 +349,8 @@ static ALCenum oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
ossFormat = AFMT_S16_NE;
break;
case DevFmtUShort:
+ case DevFmtInt:
+ case DevFmtUInt:
case DevFmtFloat:
free(data);
ERR("%s capture samples not supported on OSS\n", DevFmtTypeString(device->FmtType));
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index bb4f9d94..bd3bb4d8 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -192,6 +192,12 @@ retry_open:
case DevFmtShort:
outParams.sampleFormat = paInt16;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ /* fall-through */
+ case DevFmtInt:
+ outParams.sampleFormat = paInt32;
+ break;
case DevFmtFloat:
outParams.sampleFormat = paFloat32;
break;
@@ -316,11 +322,15 @@ static ALCenum pa_open_capture(ALCdevice *device, const ALCchar *deviceName)
case DevFmtShort:
inParams.sampleFormat = paInt16;
break;
+ case DevFmtInt:
+ inParams.sampleFormat = paInt32;
+ break;
case DevFmtFloat:
inParams.sampleFormat = paFloat32;
break;
+ case DevFmtUInt:
case DevFmtUShort:
- ERR("Unsigned short samples not supported\n");
+ ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType));
goto error;
}
inParams.channelCount = ChannelsFromDevFmt(device->FmtChans);
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index b8a7aa50..041dfe83 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -953,6 +953,12 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
case DevFmtShort:
data->spec.format = PA_SAMPLE_S16NE;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ /* fall-through */
+ case DevFmtInt:
+ data->spec.format = PA_SAMPLE_S32NE;
+ break;
case DevFmtFloat:
data->spec.format = PA_SAMPLE_FLOAT32NE;
break;
@@ -1150,11 +1156,15 @@ static ALCenum pulse_open_capture(ALCdevice *device, const ALCchar *device_name)
case DevFmtShort:
data->spec.format = PA_SAMPLE_S16NE;
break;
+ case DevFmtInt:
+ data->spec.format = PA_SAMPLE_S32NE;
+ break;
case DevFmtFloat:
data->spec.format = PA_SAMPLE_FLOAT32NE;
break;
case DevFmtByte:
case DevFmtUShort:
+ case DevFmtUInt:
ERR("Capture format type %#x capture not supported on PulseAudio\n", device->FmtType);
pa_threaded_mainloop_unlock(data->loop);
goto fail;
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c
index 40632528..af4ba387 100644
--- a/Alc/backends/sndio.c
+++ b/Alc/backends/sndio.c
@@ -229,6 +229,14 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
par.bits = 16;
par.sig = 0;
break;
+ case DevFmtInt:
+ par.bits = 32;
+ par.sig = 1;
+ break;
+ case DevFmtUInt:
+ par.bits = 32;
+ par.sig = 0;
+ break;
}
par.le = SIO_LE_NATIVE;
@@ -259,6 +267,10 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
device->FmtType = DevFmtShort;
else if(par.bits == 16 && par.sig == 0)
device->FmtType = DevFmtUShort;
+ else if(par.bits == 32 && par.sig == 1)
+ device->FmtType = DevFmtInt;
+ else if(par.bits == 32 && par.sig == 0)
+ device->FmtType = DevFmtUInt;
else
{
ERR("Unhandled sample format: %s %u-bit\n", (par.sig?"signed":"unsigned"), par.bits);
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index ac756854..445ec9ef 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -156,6 +156,8 @@ static ALCboolean solaris_reset_playback(ALCdevice *device)
info.play.encoding = AUDIO_ENCODING_LINEAR8;
break;
case DevFmtUShort:
+ case DevFmtInt:
+ case DevFmtUInt:
case DevFmtFloat:
device->FmtType = DevFmtShort;
/* fall-through */
@@ -185,7 +187,9 @@ static ALCboolean solaris_reset_playback(ALCdevice *device)
(info.play.precision == 8 && info.play.encoding == AUDIO_ENCODING_LINEAR8 &&
device->FmtType == DevFmtUByte) ||
(info.play.precision == 16 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
- device->FmtType == DevFmtShort)))
+ device->FmtType == DevFmtShort) ||
+ (info.play.precision == 32 && info.play.encoding == AUDIO_ENCODING_LINEAR &&
+ device->FmtType == DevFmtInt)))
{
ERR("Could not set %#x sample type, got %d (%#x)\n",
device->FmtType, info.play.precision, info.play.encoding);
diff --git a/Alc/backends/wave.c b/Alc/backends/wave.c
index ae0ef2be..568091c8 100644
--- a/Alc/backends/wave.c
+++ b/Alc/backends/wave.c
@@ -214,8 +214,12 @@ static ALCboolean wave_reset_playback(ALCdevice *device)
case DevFmtUShort:
device->FmtType = DevFmtShort;
break;
+ case DevFmtUInt:
+ device->FmtType = DevFmtInt;
+ break;
case DevFmtUByte:
case DevFmtShort:
+ case DevFmtInt:
case DevFmtFloat:
break;
}
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index df43a81d..ee2c3a34 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -327,6 +327,8 @@ static ALCenum WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceName)
case DevFmtByte:
pDevice->FmtType = DevFmtUByte;
break;
+ case DevFmtInt:
+ case DevFmtUInt:
case DevFmtUShort:
pDevice->FmtType = DevFmtShort;
break;
@@ -518,7 +520,7 @@ static ALCenum WinMMOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName)
if((pDevice->FmtChans != DevFmtMono && pDevice->FmtChans != DevFmtStereo) ||
(pDevice->FmtType != DevFmtUByte && pDevice->FmtType != DevFmtShort &&
- pDevice->FmtType != DevFmtFloat))
+ pDevice->FmtType != DevFmtInt && pDevice->FmtType != DevFmtFloat))
goto failure;
memset(&wfexCaptureFormat, 0, sizeof(WAVEFORMATEX));