Use channel config strings in log output

This commit is contained in:
Chris Robinson
2011-05-15 04:49:18 -07:00
parent b3902c8950
commit 143c08bfcb
4 changed files with 27 additions and 21 deletions
+13 -7
View File
@@ -606,17 +606,23 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
/* set channels (implicitly sets frame bits) */
if(i >= 0 && (i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, ChannelsFromDevFmt(device->FmtChans))) < 0)
{
device->FmtChans = DevFmtStereo;
if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 2)) < 0)
{
device->FmtChans = DevFmtMono;
if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 1)) < 0)
err = "set channels";
else if((device->Flags&DEVICE_CHANNELS_REQUEST))
AL_PRINT("Failed to set requested channel config %#x, got mono instead\n", device->FmtChans);
else
{
if((device->Flags&DEVICE_CHANNELS_REQUEST))
AL_PRINT("Failed to set %s, got Mono instead\n", DevFmtChannelsString(device->FmtChans));
device->FmtChans = DevFmtMono;
}
}
else
{
if((device->Flags&DEVICE_CHANNELS_REQUEST))
AL_PRINT("Failed to set %s, got Stereo instead\n", DevFmtChannelsString(device->FmtChans));
device->FmtChans = DevFmtStereo;
}
else if((device->Flags&DEVICE_CHANNELS_REQUEST))
AL_PRINT("Failed to set requested channel config %#x, got stereo instead\n", device->FmtChans);
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
if(i >= 0 && (i=psnd_pcm_hw_params_set_rate_resample(data->pcmHandle, p, 0)) < 0)
@@ -672,7 +678,7 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
if(device->Frequency != rate)
{
if((device->Flags&DEVICE_FREQUENCY_REQUEST))
AL_PRINT("Failed to set requested frequency %dhz, got %dhz instead\n", device->Frequency, rate);
AL_PRINT("Failed to set %dhz, got %dhz instead\n", device->Frequency, rate);
device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
device->Frequency = rate;
}
+7 -7
View File
@@ -175,7 +175,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtMono)
{
AL_PRINT("Failed to set requested channel config %#x, got mono instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got Mono instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtMono;
@@ -184,7 +184,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtStereo)
{
AL_PRINT("Failed to set requested channel config %#x, got stereo instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got Stereo instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtStereo;
@@ -193,7 +193,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtQuad)
{
AL_PRINT("Failed to set requested channel config %#x, got quad instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got Quad instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtQuad;
@@ -202,7 +202,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtX51)
{
AL_PRINT("Failed to set requested channel config %#x, got 5.1 instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got 5.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtX51;
@@ -211,7 +211,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtX61)
{
AL_PRINT("Failed to set requested channel config %#x, got 6.1 instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got 6.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtX61;
@@ -220,13 +220,13 @@ static ALCboolean ca_reset_playback(ALCdevice *device)
if((device->Flags&DEVICE_CHANNELS_REQUEST) &&
device->FmtChans != DevFmtX71)
{
AL_PRINT("Failed to set requested channel config %#x, got 7.1 instead\n", device->FmtChans);
AL_PRINT("Failed to set %s, got 7.1 Surround instead\n", DevFmtChannelsString(device->FmtChans));
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
device->FmtChans = DevFmtX71;
break;
default:
AL_PRINT("Unhandled channel count (%d), using stereo\n", streamFormat.mChannelsPerFrame);
AL_PRINT("Unhandled channel count (%d), using Stereo\n", streamFormat.mChannelsPerFrame);
device->Flags &= ~DEVICE_CHANNELS_REQUEST;
device->FmtChans = DevFmtStereo;
streamFormat.mChannelsPerFrame = 2;
+6 -6
View File
@@ -250,7 +250,7 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels)
{
AL_PRINT("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), numChannels);
AL_PRINT("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels);
return ALC_FALSE;
}
@@ -258,14 +258,14 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
(ossFormat == AFMT_U8 && device->FmtType == DevFmtUByte) ||
(ossFormat == AFMT_S16_NE && device->FmtType == DevFmtShort)))
{
AL_PRINT("Could not set %#x format type, got OSS format %#x\n", device->FmtType, ossFormat);
AL_PRINT("Failed to set %s output, got OSS format %#x\n", DevFmtTypeString(device->FmtType), ossFormat);
return ALC_FALSE;
}
if(device->Frequency != (ALuint)ossSpeed)
{
if((device->Flags&DEVICE_FREQUENCY_REQUEST))
AL_PRINT("Failed to set requested frequency %dhz, got %dhz instead\n", device->Frequency, ossSpeed);
AL_PRINT("Failed to set %dhz, got %dhz instead\n", device->Frequency, ossSpeed);
device->Flags &= ~DEVICE_FREQUENCY_REQUEST;
device->Frequency = ossSpeed;
}
@@ -354,7 +354,7 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
case DevFmtUShort:
case DevFmtFloat:
free(data);
AL_PRINT("Format type %#x capture not supported on OSS\n", device->FmtType);
AL_PRINT("%s capture samples not supported on OSS\n", DevFmtTypeString(device->FmtType));
return ALC_FALSE;
}
@@ -391,7 +391,7 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels)
{
AL_PRINT("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), numChannels);
AL_PRINT("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels);
close(data->fd);
free(data);
return ALC_FALSE;
@@ -401,7 +401,7 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
(ossFormat == AFMT_U8 && device->FmtType == DevFmtUByte) ||
(ossFormat == AFMT_S16_NE && device->FmtType == DevFmtShort)))
{
AL_PRINT("Could not set %#x format type, got OSS format %#x\n", device->FmtType, ossFormat);
AL_PRINT("Failed to set %s output, got OSS format %#x\n", DevFmtTypeString(device->FmtType), ossFormat);
close(data->fd);
free(data);
return ALC_FALSE;
+1 -1
View File
@@ -341,7 +341,7 @@ static ALCboolean WinMMOpenPlayback(ALCdevice *pDevice, const ALCchar *deviceNam
if((pDevice->Flags&DEVICE_CHANNELS_REQUEST) &&
pDevice->FmtChans != DevFmtStereo)
{
AL_PRINT("Failed to set requested channel config %#x, got stereo instead\n", pDevice->FmtChans);
AL_PRINT("Failed to set %s, got Stereo instead\n", DevFmtChannelsString(pDevice->FmtChans));
pDevice->Flags &= ~DEVICE_CHANNELS_REQUEST;
}
pDevice->FmtChans = DevFmtStereo;