Avoid printing messages about device parameter changes in the backends

This commit is contained in:
Chris Robinson 2012-01-17 16:38:58 -08:00
parent 5a2a534240
commit ae7b61b040
9 changed files with 38 additions and 187 deletions

View File

@ -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);

View File

@ -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;

View File

@ -329,94 +329,54 @@ static HRESULT DoReset(ALCdevice *device)
CoTaskMemFree(wfx);
wfx = NULL;
if(device->Frequency != OutputType.Format.nSamplesPerSec)
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_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)))
{
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);

View File

@ -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;

View File

@ -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);

View File

@ -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) *

View File

@ -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");

View File

@ -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;

View File

@ -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);