From 72e1510766608180fc7975fde35c9155494a8b5d 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 12aad02064..77320d42be 100644 --- a/libs/backends/wavesaudio/waves_audiobackend.cc +++ b/libs/backends/wavesaudio/waves_audiobackend.cc @@ -81,7 +81,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 f12ca636c8..21bfb9030b 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 8d8958c2e6..eb8a1f2d3c 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 2bb52ddcb1..a565b27c08 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp @@ -189,7 +189,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(); @@ -211,7 +210,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 9172c34b43..eef06e7ef0 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.