Don't try to set the device's sample rate if it already matches. This fixes an annoying pause in playing audio whenever the game is started.
This commit is contained in:
@@ -113,12 +113,25 @@ RString RageSoundDriver_AU::Init()
|
|||||||
{
|
{
|
||||||
LOG->Warn( WERROR("No output device", error) );
|
LOG->Warn( WERROR("No output device", error) );
|
||||||
}
|
}
|
||||||
else if( (error = AudioDeviceSetProperty(OutputDevice, NULL, 0, false, kAudioDevicePropertyNominalSampleRate,
|
else
|
||||||
|
{
|
||||||
|
Float64 rate = 0.0;
|
||||||
|
size = sizeof( Float64 );
|
||||||
|
if( (error = AudioDeviceGetProperty(OutputDevice, 0, false, kAudioDevicePropertyNominalSampleRate,
|
||||||
|
&size, &rate)) )
|
||||||
|
{
|
||||||
|
LOG->Warn( WERROR("Couldn't get the device's sample rate", error) );
|
||||||
|
}
|
||||||
|
else if( rate != streamFormat.mSampleRate )
|
||||||
|
{
|
||||||
|
if( (error = AudioDeviceSetProperty(OutputDevice, NULL, 0, false, kAudioDevicePropertyNominalSampleRate,
|
||||||
sizeof(Float64), &streamFormat.mSampleRate)) )
|
sizeof(Float64), &streamFormat.mSampleRate)) )
|
||||||
{
|
{
|
||||||
LOG->Warn( WERROR("Couldn't set the device's sample rate", error) );
|
LOG->Warn( WERROR("Couldn't set the device's sample rate", error) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
error = AudioUnitSetProperty( m_OutputUnit,
|
error = AudioUnitSetProperty( m_OutputUnit,
|
||||||
|
|||||||
Reference in New Issue
Block a user