aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/alsa.c18
-rw-r--r--Alc/backends/coreaudio.c41
-rw-r--r--Alc/backends/mmdevapi.c100
-rw-r--r--Alc/backends/oss.c8
-rw-r--r--Alc/backends/portaudio.c8
-rw-r--r--Alc/backends/pulseaudio.c4
-rw-r--r--Alc/backends/sndio.c30
-rw-r--r--Alc/backends/solaris.c8
-rw-r--r--Alc/backends/winmm.c8
9 files changed, 38 insertions, 187 deletions
diff --git a/Alc/backends/alsa.c b/Alc/backends/alsa.c
index 362b25da..b20e6ed3 100644
--- a/Alc/backends/alsa.c
+++ b/Alc/backends/alsa.c
@@ -689,19 +689,10 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
if((i=snd_pcm_hw_params_set_channels(data->pcmHandle, p, 1)) < 0)
err = "set channels";
else
- {
- if((device->Flags&DEVICE_CHANNELS_REQUEST))
- ERR("Failed to set %s, got Mono instead\n", DevFmtChannelsString(device->FmtChans));
device->FmtChans = DevFmtMono;
- }
}
else
- {
- if((device->Flags&DEVICE_CHANNELS_REQUEST))
- ERR("Failed to set %s, got Stereo instead\n", DevFmtChannelsString(device->FmtChans));
device->FmtChans = DevFmtStereo;
- }
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
if(i >= 0 && (i=snd_pcm_hw_params_set_rate_resample(data->pcmHandle, p, 0)) < 0)
{
@@ -755,14 +746,7 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
snd_pcm_sw_params_free(sp);
- if(device->Frequency != rate)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set %dhz, got %dhz instead\n", device->Frequency, rate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = rate;
- }
-
+ device->Frequency = rate;
SetDefaultChannelOrder(device);
data->size = snd_pcm_frames_to_bytes(data->pcmHandle, periodSizeInFrames);
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index 7ac43325..ad5f0c16 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -238,10 +238,6 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if(device->Frequency != streamFormat.mSampleRate)
{
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("CoreAudio does not support changing sample rates (wanted %dhz, got %dhz)\n", device->Frequency, streamFormat.mSampleRate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
-
device->UpdateSize = (ALuint)((ALuint64)device->UpdateSize *
streamFormat.mSampleRate /
device->Frequency);
@@ -253,62 +249,25 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
switch(streamFormat.mChannelsPerFrame)
{
case 1:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtMono)
- {
- ERR("Failed to set %s, got Mono instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtMono;
break;
case 2:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtStereo)
- {
- ERR("Failed to set %s, got Stereo instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtStereo;
break;
case 4:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtQuad)
- {
- ERR("Failed to set %s, got Quad instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtQuad;
break;
case 6:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtX51)
- {
- ERR("Failed to set %s, got 5.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtX51;
break;
case 7:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtX61)
- {
- ERR("Failed to set %s, got 6.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtX61;
break;
case 8:
- if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
- device->FmtChans != DevFmtX71)
- {
- ERR("Failed to set %s, got 7.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- }
device->FmtChans = DevFmtX71;
break;
default:
ERR("Unhandled channel count (%d), using Stereo\n", streamFormat.mChannelsPerFrame);
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
device->FmtChans = DevFmtStereo;
streamFormat.mChannelsPerFrame = 2;
break;
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 275a839a..f171c059 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -329,94 +329,54 @@ static HRESULT DoReset(ALCdevice *device)
CoTaskMemFree(wfx);
wfx = NULL;
- if(device->Frequency != OutputType.Format.nSamplesPerSec)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set %dhz, got %ldhz instead\n", device->Frequency, OutputType.Format.nSamplesPerSec);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = OutputType.Format.nSamplesPerSec;
- }
-
- if(!((device->FmtChans == DevFmtMono && OutputType.Format.nChannels == 1 && OutputType.dwChannelMask == MONO) ||
- (device->FmtChans == DevFmtStereo && OutputType.Format.nChannels == 2 && OutputType.dwChannelMask == STEREO) ||
- (device->FmtChans == DevFmtQuad && OutputType.Format.nChannels == 4 && OutputType.dwChannelMask == QUAD) ||
- (device->FmtChans == DevFmtX51 && OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1) ||
- (device->FmtChans == DevFmtX51Side && OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE) ||
- (device->FmtChans == DevFmtX61 && OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1) ||
- (device->FmtChans == DevFmtX71 && OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)))
+ device->Frequency = OutputType.Format.nSamplesPerSec;
+ if(OutputType.Format.nChannels == 1 && OutputType.dwChannelMask == MONO)
+ device->FmtChans = DevFmtMono;
+ else if(OutputType.Format.nChannels == 2 && OutputType.dwChannelMask == STEREO)
+ device->FmtChans = DevFmtStereo;
+ else if(OutputType.Format.nChannels == 4 && OutputType.dwChannelMask == QUAD)
+ device->FmtChans = DevFmtQuad;
+ else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1)
+ device->FmtChans = DevFmtX51;
+ else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE)
+ device->FmtChans = DevFmtX51Side;
+ else if(OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1)
+ device->FmtChans = DevFmtX61;
+ else if(OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)
+ device->FmtChans = DevFmtX71;
+ else
{
- if((device->Flags&DEVICE_CHANNELS_REQUEST))
- ERR("Failed to set %s, got %d channels (0x%08lx) instead\n", DevFmtChannelsString(device->FmtChans), OutputType.Format.nChannels, OutputType.dwChannelMask);
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
-
- if(OutputType.Format.nChannels == 1 && OutputType.dwChannelMask == MONO)
- device->FmtChans = DevFmtMono;
- else if(OutputType.Format.nChannels == 2 && OutputType.dwChannelMask == STEREO)
- device->FmtChans = DevFmtStereo;
- else if(OutputType.Format.nChannels == 4 && OutputType.dwChannelMask == QUAD)
- device->FmtChans = DevFmtQuad;
- else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1)
- device->FmtChans = DevFmtX51;
- else if(OutputType.Format.nChannels == 6 && OutputType.dwChannelMask == X5DOT1SIDE)
- device->FmtChans = DevFmtX51Side;
- else if(OutputType.Format.nChannels == 7 && OutputType.dwChannelMask == X6DOT1)
- device->FmtChans = DevFmtX61;
- else if(OutputType.Format.nChannels == 8 && OutputType.dwChannelMask == X7DOT1)
- device->FmtChans = DevFmtX71;
- else
- {
- ERR("Unhandled extensible channels: %d -- 0x%08lx\n", OutputType.Format.nChannels, OutputType.dwChannelMask);
- device->FmtChans = DevFmtStereo;
- OutputType.Format.nChannels = 2;
- OutputType.dwChannelMask = STEREO;
- }
+ ERR("Unhandled extensible channels: %d -- 0x%08lx\n", OutputType.Format.nChannels, OutputType.dwChannelMask);
+ device->FmtChans = DevFmtStereo;
+ OutputType.Format.nChannels = 2;
+ OutputType.dwChannelMask = STEREO;
}
if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
{
- if(OutputType.Samples.wValidBitsPerSample == 0)
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
- if(OutputType.Samples.wValidBitsPerSample != OutputType.Format.wBitsPerSample ||
- !((device->FmtType == DevFmtUByte && OutputType.Format.wBitsPerSample == 8) ||
- (device->FmtType == DevFmtShort && OutputType.Format.wBitsPerSample == 16)))
+ if(OutputType.Format.wBitsPerSample == 8)
+ device->FmtType = DevFmtUByte;
+ else if(OutputType.Format.wBitsPerSample == 16)
+ device->FmtType = DevFmtShort;
+ else
{
- ERR("Failed to set %s samples, got %d/%d-bit instead\n", DevFmtTypeString(device->FmtType), OutputType.Samples.wValidBitsPerSample, OutputType.Format.wBitsPerSample);
- if(OutputType.Format.wBitsPerSample == 8)
- device->FmtType = DevFmtUByte;
- else if(OutputType.Format.wBitsPerSample == 16)
- device->FmtType = DevFmtShort;
- else
- {
- device->FmtType = DevFmtShort;
- OutputType.Format.wBitsPerSample = 16;
- }
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
+ device->FmtType = DevFmtShort;
+ OutputType.Format.wBitsPerSample = 16;
}
}
else if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT))
{
- if(OutputType.Samples.wValidBitsPerSample == 0)
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
- if(OutputType.Samples.wValidBitsPerSample != OutputType.Format.wBitsPerSample ||
- !((device->FmtType == DevFmtFloat && OutputType.Format.wBitsPerSample == 32)))
- {
- ERR("Failed to set %s samples, got %d/%d-bit instead\n", DevFmtTypeString(device->FmtType), OutputType.Samples.wValidBitsPerSample, OutputType.Format.wBitsPerSample);
- if(OutputType.Format.wBitsPerSample != 32)
- {
- device->FmtType = DevFmtFloat;
- OutputType.Format.wBitsPerSample = 32;
- }
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
- }
+ device->FmtType = DevFmtFloat;
+ OutputType.Format.wBitsPerSample = 32;
}
else
{
ERR("Unhandled format sub-type\n");
device->FmtType = DevFmtShort;
OutputType.Format.wBitsPerSample = 16;
- OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
}
+ OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample;
}
SetDefaultWFXChannelOrder(device);
diff --git a/Alc/backends/oss.c b/Alc/backends/oss.c
index 9206343b..a5adc6ee 100644
--- a/Alc/backends/oss.c
+++ b/Alc/backends/oss.c
@@ -262,13 +262,7 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
return ALC_FALSE;
}
- if(device->Frequency != (ALuint)ossSpeed)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set %dhz, got %dhz instead\n", device->Frequency, ossSpeed);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = ossSpeed;
- }
+ device->Frequency = ossSpeed;
device->UpdateSize = info.fragsize / frameSize;
device->NumUpdates = info.fragments + 1;
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index a24e2aaf..bb4f9d94 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -254,13 +254,7 @@ static ALCboolean pa_reset_playback(ALCdevice *device)
PaError err;
streamInfo = Pa_GetStreamInfo(data->stream);
- if(device->Frequency != streamInfo->sampleRate)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("PortAudio does not support changing sample rates (wanted %dhz, got %.1fhz)\n", device->Frequency, streamInfo->sampleRate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = streamInfo->sampleRate;
- }
+ device->Frequency = streamInfo->sampleRate;
device->UpdateSize = data->update_size;
err = Pa_StartStream(data->stream);
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index ee7a633f..b8a7aa50 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -989,10 +989,6 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
{
pa_operation *o;
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set frequency %dhz, got %dhz instead\n", device->Frequency, data->spec.rate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
-
/* Server updated our playback rate, so modify the buffer attribs
* accordingly. */
data->attr.minreq = (ALuint64)(data->attr.minreq/data->frame_size) *
diff --git a/Alc/backends/sndio.c b/Alc/backends/sndio.c
index 3a5e768f..40632528 100644
--- a/Alc/backends/sndio.c
+++ b/Alc/backends/sndio.c
@@ -208,7 +208,6 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
sio_initpar(&par);
par.rate = device->Frequency;
-
par.pchan = ((device->FmtChans != DevFmtMono) ? 2 : 1);
switch(device->FmtType)
@@ -222,8 +221,6 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
par.sig = 0;
break;
case DevFmtFloat:
- device->FmtType = DevFmtShort;
- /* fall-through */
case DevFmtShort:
par.bits = 16;
par.sig = 1;
@@ -239,40 +236,21 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
par.appbufsz = device->UpdateSize * (device->NumUpdates-1);
if(!par.appbufsz) par.appbufsz = device->UpdateSize;
-
if(!sio_setpar(data->sndHandle, &par) || !sio_getpar(data->sndHandle, &par))
{
ERR("Failed to set device parameters\n");
return ALC_FALSE;
}
- if(par.rate != device->Frequency)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set frequency %uhz, got %uhz instead\n", device->Frequency, par.rate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = par.rate;
- }
-
- if(par.pchan != ChannelsFromDevFmt(device->FmtChans))
- {
- if(par.pchan != 1 && par.pchan != 2)
- {
- ERR("Unhandled channel count: %u\n", par.pchan);
- return ALC_FALSE;
- }
- if((device->Flags&DEVICE_CHANNELS_REQUEST))
- ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(device->FmtChans), par.pchan);
- device->Flags &= ~DEVICE_CHANNELS_REQUEST;
- device->FmtChans = ((par.pchan==1) ? DevFmtMono : DevFmtStereo);
- }
-
if(par.bits != par.bps*8)
{
ERR("Padded samples not supported (%u of %u bits)\n", par.bits, par.bps*8);
return ALC_FALSE;
}
+ device->Frequency = par.rate;
+ device->FmtChans = ((par.pchan==1) ? DevFmtMono : DevFmtStereo);
+
if(par.bits == 8 && par.sig == 1)
device->FmtType = DevFmtByte;
else if(par.bits == 8 && par.sig == 0)
@@ -287,13 +265,11 @@ static ALCboolean sndio_reset_playback(ALCdevice *device)
return ALC_FALSE;
}
-
device->UpdateSize = par.round;
device->NumUpdates = (par.bufsz/par.round) + 1;
SetDefaultChannelOrder(device);
-
if(!sio_start(data->sndHandle))
{
ERR("Error starting playback\n");
diff --git a/Alc/backends/solaris.c b/Alc/backends/solaris.c
index 1ac1f9fb..ac756854 100644
--- a/Alc/backends/solaris.c
+++ b/Alc/backends/solaris.c
@@ -192,13 +192,7 @@ static ALCboolean solaris_reset_playback(ALCdevice *device)
return ALC_FALSE;
}
- if(device->Frequency != info.play.sample_rate)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("Failed to set requested frequency %dhz, got %dhz instead\n", device->Frequency, info.play.sample_rate);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = info.play.sample_rate;
- }
+ device->Frequency = info.play.sample_rate;
device->UpdateSize = (info.play.buffer_size/device->NumUpdates) + 1;
data->data_size = device->UpdateSize * frameSize;
diff --git a/Alc/backends/winmm.c b/Alc/backends/winmm.c
index 8dbe6ef2..265dfc83 100644
--- a/Alc/backends/winmm.c
+++ b/Alc/backends/winmm.c
@@ -430,13 +430,7 @@ static ALCboolean WinMMResetPlayback(ALCdevice *device)
device->UpdateSize = (ALuint)((ALuint64)device->UpdateSize *
pData->Frequency / device->Frequency);
- if(device->Frequency != pData->Frequency)
- {
- if((device->Flags&DEVICE_FREQUENCY_REQUEST))
- ERR("WinMM does not support changing sample rates (wanted %dhz, got %dhz)\n", device->Frequency, pData->Frequency);
- device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
- device->Frequency = pData->Frequency;
- }
+ device->Frequency = pData->Frequency;
SetDefaultWFXChannelOrder(device);