Changed AUGraph frame buffer size to match the AU render size (improves performance by about 10 times)

Comment in AudioSample.cpp where we can hook in an alternate mp3 input streamer

--HG--
branch : nfb
This commit is contained in:
Peter Courtemanche
2014-01-07 16:52:47 -08:00
parent d38419b454
commit 5b77f22f2d
3 changed files with 12 additions and 1 deletions

View File

@@ -215,8 +215,11 @@ void KRAudioManager::renderAudio(UInt32 inNumberFrames, AudioBufferList *ioData)
uint64_t end_time = mach_absolute_time(); uint64_t end_time = mach_absolute_time();
// uint64_t duration = (end_time - start_time) * m_timebase_info.numer / m_timebase_info.denom; // Nanoseconds // uint64_t duration = (end_time - start_time) * m_timebase_info.numer / m_timebase_info.denom; // Nanoseconds
// double ms = duration;
// ms = ms / 1000000.0;
// uint64_t max_duration = (uint64_t)inNumberFrames * 1000000000 / 44100; // uint64_t max_duration = (uint64_t)inNumberFrames * 1000000000 / 44100;
// fprintf(stderr, "audio load: %5.1f%% hrtf channels: %li\n", (float)(duration * 1000 / max_duration) / 10.0f, m_mapped_sources.size()); // fprintf(stderr, "audio load: %5.1f%% hrtf channels: %li\n", (float)(duration * 1000 / max_duration) / 10.0f, m_mapped_sources.size());
// printf("ms %2.3f frames %ld audio load: %5.1f%% hrtf channels: %li\n", ms, (unsigned long) inNumberFrames, (float)(duration * 1000 / max_duration) / 10.0f, m_mapped_sources.size());
} }
float *KRAudioManager::getBlockAddress(int block_offset) float *KRAudioManager::getBlockAddress(int block_offset)

View File

@@ -44,7 +44,10 @@ const int KRENGINE_AUDIO_MAX_POOL_SIZE = 32;
const int KRENGINE_AUDIO_MAX_BUFFER_SIZE = 64*1024; const int KRENGINE_AUDIO_MAX_BUFFER_SIZE = 64*1024;
const int KRENGINE_AUDIO_BUFFERS_PER_SOURCE = 3; const int KRENGINE_AUDIO_BUFFERS_PER_SOURCE = 3;
const int KRENGINE_AUDIO_BLOCK_LENGTH = 128; // Length of one block to process. Determines the latency of the audio system and sets size for FFT's used in HRTF convolution const int KRENGINE_AUDIO_BLOCK_LENGTH = 1024; // Length of one block to process. Determines the latency of the audio system and sets size for FFT's used in HRTF convolution
// the AUGraph works in 1024 sample chunks. If we put a value of less then 1024 in here then we are making mutliple calls to our render functions without any
// improvement in latency and our audio render perfomance goes down significantly
const int KRENGINE_AUDIO_BLOCK_LOG2N = 7; // 2 ^ KRENGINE_AUDIO_BLOCK_LOG2N = KRENGINE_AUDIO_BLOCK_LENGTH const int KRENGINE_AUDIO_BLOCK_LOG2N = 7; // 2 ^ KRENGINE_AUDIO_BLOCK_LOG2N = KRENGINE_AUDIO_BLOCK_LENGTH
const int KRENGINE_REVERB_MAX_FFT_LOG2 = 15; const int KRENGINE_REVERB_MAX_FFT_LOG2 = 15;

View File

@@ -231,6 +231,11 @@ void KRAudioSample::openFile()
{ {
// AudioFileInitializeWithCallbacks // AudioFileInitializeWithCallbacks
if(m_fileRef == NULL) { if(m_fileRef == NULL) {
// printf("Call to KRAudioSample::openFile() with extension: %s\n", m_extension.c_str());
// The m_extension is valid (it's either wav or mp3 for the files in Circa project)
// so we can key off the extension and use a different data handler for mp3 files if we want to
//
// Temp variables // Temp variables
UInt32 propertySize; UInt32 propertySize;