Rearrange things a bit in case the buffer size is dependent on the stream format--it doesn't appear to be but you never know.
This commit is contained in:
@@ -86,38 +86,10 @@ RageSound_CA::RageSound_CA()
|
|||||||
{
|
{
|
||||||
RageException::ThrowNonfatal("Couldn't create default output device.");
|
RageException::ThrowNonfatal("Couldn't create default output device.");
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStreamID sID = mOutputDevice->GetStreamByIndex( kAudioDeviceSectionOutput, 0 );
|
AudioStreamID sID = mOutputDevice->GetStreamByIndex( kAudioDeviceSectionOutput, 0 );
|
||||||
CAAudioHardwareStream stream( sID );
|
CAAudioHardwareStream stream( sID );
|
||||||
try
|
|
||||||
{
|
|
||||||
UInt32 frames = mOutputDevice->GetLatency(kAudioDeviceSectionOutput);
|
|
||||||
if (stream.HasProperty(0, kAudioDevicePropertyLatency))
|
|
||||||
{
|
|
||||||
UInt32 t, size = 4;
|
|
||||||
|
|
||||||
stream.GetPropertyData(0, kAudioDevicePropertyLatency, size, &t);
|
|
||||||
frames += t;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
LOG->Warn("Stream reports no latency.");
|
|
||||||
mLatency = frames / 44100.0;
|
|
||||||
LOG->Info("Frames of latency: %lu\n"
|
|
||||||
"Seconds of latency: %f", frames, mLatency);
|
|
||||||
}
|
|
||||||
catch (const CAException& e)
|
|
||||||
{
|
|
||||||
delete mOutputDevice;
|
|
||||||
RageException::ThrowNonfatal("Couldn't get Latency.");
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UInt32 bufferSize = mOutputDevice->GetIOBufferSize();
|
|
||||||
LOG->Info("I/O Buffer size: %lu", bufferSize);
|
|
||||||
}
|
|
||||||
catch (const CAException& e)
|
|
||||||
{
|
|
||||||
LOG->Warn("Could not determine buffer size.");
|
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mOutputDevice->AddPropertyListener(kAudioPropertyWildcardChannel,
|
mOutputDevice->AddPropertyListener(kAudioPropertyWildcardChannel,
|
||||||
@@ -162,6 +134,41 @@ RageSound_CA::RageSound_CA()
|
|||||||
const Desc& procFormat = FindClosestFormat( procFormats );
|
const Desc& procFormat = FindClosestFormat( procFormats );
|
||||||
stream.SetCurrentIOProcFormat( procFormat );
|
stream.SetCurrentIOProcFormat( procFormat );
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UInt32 bufferSize = mOutputDevice->GetIOBufferSize();
|
||||||
|
LOG->Info("I/O Buffer size: %lu", bufferSize);
|
||||||
|
}
|
||||||
|
catch (const CAException& e)
|
||||||
|
{
|
||||||
|
LOG->Warn("Could not determine buffer size.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UInt32 frames = mOutputDevice->GetLatency(kAudioDeviceSectionOutput);
|
||||||
|
if (stream.HasProperty(0, kAudioDevicePropertyLatency))
|
||||||
|
{
|
||||||
|
UInt32 t, size = 4;
|
||||||
|
|
||||||
|
stream.GetPropertyData(0, kAudioDevicePropertyLatency, size, &t);
|
||||||
|
frames += t;
|
||||||
|
LOG->Info("Frames of stream latency: %lu", t);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LOG->Warn("Stream reports no latency.");
|
||||||
|
mLatency = frames / 44100.0;
|
||||||
|
LOG->Info("Frames of latency: %lu\n"
|
||||||
|
"Seconds of latency: %f", frames, mLatency);
|
||||||
|
}
|
||||||
|
catch (const CAException& e)
|
||||||
|
{
|
||||||
|
delete mOutputDevice;
|
||||||
|
RageException::ThrowNonfatal("Couldn't get Latency.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
StartDecodeThread();
|
StartDecodeThread();
|
||||||
|
|
||||||
gConverter = new AudioConverter( this, procFormat );
|
gConverter = new AudioConverter( this, procFormat );
|
||||||
|
|||||||
Reference in New Issue
Block a user