Return imediately if trying to set an unknown format

This commit is contained in:
Chris Robinson 2009-09-21 02:53:33 -07:00
parent 0ae02e8ad4
commit e11b59a80f
6 changed files with 25 additions and 13 deletions

View File

@ -425,8 +425,8 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
data->format = SND_PCM_FORMAT_FLOAT;
break;
default:
data->format = SND_PCM_FORMAT_UNKNOWN;
AL_PRINT("Unknown format?! %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
return ALC_FALSE;
}
allowmmap = GetConfigValueBool("alsa", "mmap", 1);
@ -624,8 +624,10 @@ open_alsa:
data->format = SND_PCM_FORMAT_FLOAT;
break;
default:
data->format = SND_PCM_FORMAT_UNKNOWN;
AL_PRINT("Unknown format?! %x\n", pDevice->Format);
AL_PRINT("Unknown format: 0x%x\n", pDevice->Format);
psnd_pcm_close(data->pcmHandle);
free(data);
return ALC_FALSE;
}
err = NULL;

View File

@ -237,6 +237,11 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_5POINT1, 0);
else if(device->Format == AL_FORMAT_71CHN8 || device->Format == AL_FORMAT_71CHN16)
speakers = DSSPEAKER_COMBINED(DSSPEAKER_7POINT1, 0);
else
{
AL_PRINT("Unknown format: 0x%x\n", device->Format);
return ALC_FALSE;
}
}
if(SUCCEEDED(hr))
{

View File

@ -217,8 +217,8 @@ static ALCboolean oss_reset_playback(ALCdevice *device)
ossFormat = AFMT_S16_NE;
break;
default:
ossFormat = -1;
AL_PRINT("Unknown format?! %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
return ALC_FALSE;
}
periods = device->NumUpdates;
@ -337,8 +337,10 @@ static ALCboolean oss_open_capture(ALCdevice *device, const ALCchar *deviceName)
ossFormat = AFMT_S16_NE;
break;
default:
ossFormat = -1;
AL_PRINT("Unknown format?! %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
close(data->fd);
free(data);
return ALC_FALSE;
}
periods = 4;

View File

@ -105,8 +105,10 @@ static ALCboolean pa_open_playback(ALCdevice *device, const ALCchar *deviceName)
outParams.sampleFormat = paFloat32;
break;
default:
outParams.sampleFormat = -1;
AL_PRINT("Unknown format?! %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
device->ExtraData = NULL;
free(data);
return ALC_FALSE;
}
outParams.channelCount = aluChannelsFromFormat(device->Format);

View File

@ -366,7 +366,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
data->spec.format = PA_SAMPLE_FLOAT32NE;
break;
default:
AL_PRINT("Unknown format: %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
ppa_threaded_mainloop_unlock(data->loop);
return ALC_FALSE;
}
@ -495,7 +495,7 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
data->spec.format = PA_SAMPLE_FLOAT32NE;
break;
default:
AL_PRINT("Unknown format: %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
ppa_threaded_mainloop_unlock(data->loop);
pulse_close(device);
free(device->szDeviceName);

View File

@ -159,7 +159,8 @@ static ALCboolean solaris_reset_playback(ALCdevice *device)
info.play.encoding = AUDIO_ENCODING_LINEAR;
break;
default:
AL_PRINT("Unknown format?! %x\n", device->Format);
AL_PRINT("Unknown format: 0x%x\n", device->Format);
return ALC_FALSE;
}
numChannels = aluChannelsFromFormat(device->Format);