From 3b5da657aff37c67a787eb90c7d4551e182d16ca Mon Sep 17 00:00:00 2001 From: VKamyshniy Date: Fri, 20 Feb 2015 12:52:47 +0200 Subject: [PATCH] [Summary] In internal Waves backend API, switching sample time from 32 bits to 64 bits. Fixing logical inconsistency: None device always brought sample time=0 to the audio engine callback. --- libs/backends/wavesaudio/waves_audiobackend.cc | 2 +- .../wavesapi/devicemanager/WCMRAudioDeviceManager.h | 2 +- .../wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h | 4 ++-- .../wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp | 3 +-- .../wavesapi/devicemanager/WCMRPortAudioDeviceManager.h | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/backends/wavesaudio/waves_audiobackend.cc b/libs/backends/wavesaudio/waves_audiobackend.cc index 0b42b3bce7..922190c34b 100644 --- a/libs/backends/wavesaudio/waves_audiobackend.cc +++ b/libs/backends/wavesaudio/waves_audiobackend.cc @@ -80,7 +80,7 @@ void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reaso break; case WCMRAudioDeviceManagerClient::AudioCallback: if (parameter) { - AudioCallbackData* audio_callback_data = (AudioCallbackData*)parameter; + const AudioCallbackData* audio_callback_data = (AudioCallbackData*)parameter; _audio_device_callback ( audio_callback_data->acdInputBuffer, audio_callback_data->acdOutputBuffer, diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h index 3ec108b380..db0104a25d 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h @@ -126,7 +126,7 @@ class WCMRAudioDeviceManagerClient const float *acdInputBuffer; float *acdOutputBuffer; size_t acdFrames; - uint32_t acdSampleTime; + uint64_t acdSampleTime; uint64_t acdCycleStartTimeNanos; }; diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h index 74d1d18dfd..c74895ed7c 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h @@ -100,8 +100,8 @@ protected: AudioDeviceID m_DeviceID; ///< The CoreAudio device id bool m_StopRequested; ///< should be set to true when want to stop, set to false otherwise. float *m_pInputData; ///< This is what came in with the most recent callback. - int m_SampleCounter; ///< The current running sample counter, updated by the audio callback. - int m_SampleCountAtLastIdle; ///< What was the sample count last time we checked... + uint64_t m_SampleCounter; ///< The current running sample counter, updated by the audio callback. + uint64_t m_SampleCountAtLastIdle; ///< What was the sample count last time we checked... int m_StalledSampleCounter; ///< The number of idle calls with same sample count detected int m_ChangeCheckCounter; ///< The number of idle calls passed since we checked the buffer size change. diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp index b05a2dfc6e..7bea0b3f04 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp @@ -193,7 +193,6 @@ void WCMRNativeAudioNoneDevice::_SilenceThread() float* theInpBuffers = _m_inputBuffer; #endif - uint32_t currentSampleTime = 0; const size_t buffer_size = CurrentBufferSize(); const uint64_t cyclePeriodNanos = (1000000000.0 * buffer_size) / CurrentSamplingRate(); @@ -215,7 +214,7 @@ void WCMRNativeAudioNoneDevice::_SilenceThread() m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::AudioCallback, (void *)&audioCallbackData); - currentSampleTime += buffer_size; + audioCallbackData.acdSampleTime += buffer_size; int64_t timeToSleepUsecs = ((int64_t)cycleEndTimeNanos - (int64_t)__get_time_nanos())/1000; diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.h index 2202c4fed5..a93d2d745a 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.h @@ -96,8 +96,8 @@ protected: PaStream* m_PortAudioStream; ///< Port audio stream, when the device is active! bool m_StopRequested; ///< should be set to true when want to stop, set to false otherwise. const float *m_pInputData; ///< This is what came in with the most recent callback. - int m_SampleCounter; ///< The current running sample counter, updated by the audio callback. - int m_SampleCountAtLastIdle; + uint64_t m_SampleCounter; ///< The current running sample counter, updated by the audio callback. + uint64_t m_SampleCountAtLastIdle; int m_DropsDetected; ///< Number of times audio drops have been detected so far. int m_DropsReported; ///< Number of times audio drops have been reported so far to the client.