Fixed indentation issues accidentally introduced
This commit is contained in:
@@ -41,7 +41,7 @@ static inline RString FourCCToString( uint32_t num )
|
||||
}
|
||||
|
||||
RageSoundDriver_AU::RageSoundDriver_AU() : m_OutputUnit(NULL), m_iSampleRate(0), m_bDone(false), m_bStarted(false),
|
||||
m_pIOThread(NULL), m_pNotificationThread(NULL), m_Semaphore("Sound")
|
||||
m_pIOThread(NULL), m_pNotificationThread(NULL), m_Semaphore("Sound")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -98,12 +98,12 @@ static void SetSampleRate( AudioUnit au, Float64 desiredRate )
|
||||
/* XXX: If the desired rate is supported by the device, then change it, if not
|
||||
* then we should select the "best" rate. I don't really know what such a best
|
||||
* rate would be. The rate closest to the desired value? A multiple of 2?
|
||||
* For now give up if the desired sample rate isn't available. */
|
||||
* For now give up if the desired sample rate isn't available. */
|
||||
}
|
||||
delete[] ranges;
|
||||
if( bestRate == 0.0 )
|
||||
return;
|
||||
|
||||
|
||||
if( (error = AudioDeviceSetProperty(OutputDevice, NULL, 0, false, kAudioDevicePropertyNominalSampleRate,
|
||||
sizeof(Float64), &bestRate)) )
|
||||
{
|
||||
@@ -123,7 +123,7 @@ RString RageSoundDriver_AU::Init()
|
||||
|
||||
Component comp = FindNextComponent( NULL, &desc );
|
||||
|
||||
if( comp == NULL )
|
||||
if( comp == NULL )
|
||||
return "Failed to find the default output unit.";
|
||||
|
||||
OSStatus error = OpenAComponent( comp, &m_OutputUnit );
|
||||
@@ -136,12 +136,12 @@ RString RageSoundDriver_AU::Init()
|
||||
input.inputProc = Render;
|
||||
input.inputProcRefCon = this;
|
||||
|
||||
error = AudioUnitSetProperty( m_OutputUnit,
|
||||
kAudioUnitProperty_SetRenderCallback,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&input,
|
||||
sizeof(input) );
|
||||
error = AudioUnitSetProperty( m_OutputUnit,
|
||||
kAudioUnitProperty_SetRenderCallback,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&input,
|
||||
sizeof(input) );
|
||||
if( error != noErr )
|
||||
return ERROR( "Failed to set render callback", error );
|
||||
|
||||
@@ -163,33 +163,33 @@ RString RageSoundDriver_AU::Init()
|
||||
|
||||
// Try to set the hardware sample rate.
|
||||
SetSampleRate( m_OutputUnit, streamFormat.mSampleRate );
|
||||
|
||||
|
||||
|
||||
|
||||
error = AudioUnitSetProperty( m_OutputUnit,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&streamFormat,
|
||||
sizeof(AudioStreamBasicDescription) );
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&streamFormat,
|
||||
sizeof(AudioStreamBasicDescription) );
|
||||
if( error != noErr )
|
||||
return ERROR( "Failed to set AU stream format", error );
|
||||
UInt32 renderQuality = kRenderQuality_Max;
|
||||
|
||||
error = AudioUnitSetProperty( m_OutputUnit,
|
||||
kAudioUnitProperty_RenderQuality,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&renderQuality,
|
||||
sizeof(renderQuality) );
|
||||
kAudioUnitProperty_RenderQuality,
|
||||
kAudioUnitScope_Global,
|
||||
0,
|
||||
&renderQuality,
|
||||
sizeof(renderQuality) );
|
||||
if( error != noErr )
|
||||
LOG->Warn( WERROR("Failed to set the maximum render quality", error) );
|
||||
|
||||
|
||||
// Initialize the AU.
|
||||
if( (error = AudioUnitInitialize(m_OutputUnit)) )
|
||||
return ERROR( "Could not initialize the AudioUnit", error );
|
||||
|
||||
StartDecodeThread();
|
||||
|
||||
|
||||
if( (error = AudioOutputUnitStart(m_OutputUnit)) )
|
||||
return ERROR( "Could not start the AudioUnit", error );
|
||||
m_bStarted = true;
|
||||
@@ -245,8 +245,8 @@ float RageSoundDriver_AU::GetPlayLatency() const
|
||||
{
|
||||
LOG->Warn( WERROR("Couldn't get the device sample rate", error) );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
size = sizeof( UInt32 );
|
||||
if( (error = AudioDeviceGetProperty(OutputDevice, 0, false, kAudioDevicePropertyBufferFrameSize, &size, &bufferSize)) )
|
||||
{
|
||||
@@ -262,7 +262,7 @@ float RageSoundDriver_AU::GetPlayLatency() const
|
||||
LOG->Warn( WERROR( "Couldn't get device latency", error) );
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
|
||||
bufferSize += frames;
|
||||
size = sizeof( UInt32 );
|
||||
if( (error = AudioDeviceGetProperty(OutputDevice, 0, false, kAudioDevicePropertySafetyOffset, &size, &frames)) )
|
||||
@@ -272,7 +272,7 @@ float RageSoundDriver_AU::GetPlayLatency() const
|
||||
}
|
||||
bufferSize += frames;
|
||||
size = sizeof( UInt32 );
|
||||
|
||||
|
||||
do {
|
||||
if( (error = AudioDeviceGetPropertyInfo(OutputDevice, 0, false, kAudioDevicePropertyStreams, &size, NULL)) )
|
||||
{
|
||||
@@ -286,7 +286,7 @@ float RageSoundDriver_AU::GetPlayLatency() const
|
||||
break;
|
||||
}
|
||||
AudioStreamID *streams = new AudioStreamID[num];
|
||||
|
||||
|
||||
if( (error = AudioDeviceGetProperty(OutputDevice, 0, false, kAudioDevicePropertyStreams, &size, streams)) )
|
||||
{
|
||||
LOG->Warn( WERROR("Cannot get device's streams", error) );
|
||||
@@ -304,20 +304,20 @@ float RageSoundDriver_AU::GetPlayLatency() const
|
||||
|
||||
return float( bufferSize / sampleRate );
|
||||
}
|
||||
|
||||
|
||||
|
||||
OSStatus RageSoundDriver_AU::Render( void *inRefCon,
|
||||
AudioUnitRenderActionFlags *ioActionFlags,
|
||||
const AudioTimeStamp *inTimeStamp,
|
||||
UInt32 inBusNumber,
|
||||
UInt32 inNumberFrames,
|
||||
AudioBufferList *ioData )
|
||||
AudioUnitRenderActionFlags *ioActionFlags,
|
||||
const AudioTimeStamp *inTimeStamp,
|
||||
UInt32 inBusNumber,
|
||||
UInt32 inNumberFrames,
|
||||
AudioBufferList *ioData )
|
||||
{
|
||||
RageSoundDriver_AU *This = (RageSoundDriver_AU *)inRefCon;
|
||||
|
||||
|
||||
if( unlikely(This->m_pIOThread == NULL) )
|
||||
This->m_pIOThread = new RageThreadRegister( "HAL I/O thread" );
|
||||
|
||||
|
||||
AudioBuffer &buf = ioData->mBuffers[0];
|
||||
int64_t now = int64_t( This->m_TimeScale * AudioGetCurrentHostTime() );
|
||||
int64_t next = int64_t( This->m_TimeScale * inTimeStamp->mHostTime );
|
||||
@@ -327,14 +327,14 @@ OSStatus RageSoundDriver_AU::Render( void *inRefCon,
|
||||
{
|
||||
AudioOutputUnitStop( This->m_OutputUnit );
|
||||
This->m_Semaphore.Post();
|
||||
}
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2004-2007 Steve Checkoway
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -344,7 +344,7 @@ OSStatus RageSoundDriver_AU::Render( void *inRefCon,
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
Reference in New Issue
Block a user