diff options
author | Valeriy Kamyshniy <vkamyshniy@wavesglobal.com> | 2015-02-20 13:48:14 +0200 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-02-20 13:05:43 -0500 |
commit | d5e375f7847b580d06a28f688f5d919d82bab16d (patch) | |
tree | 8412dca93def7c3312ca9582215380f2534d083e /libs/backends/wavesaudio | |
parent | 3b5da657aff37c67a787eb90c7d4551e182d16ca (diff) |
[Summary] In internal Waves backend API, switching sample time from 32 bits to 64 bits.
Conflicts:
libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp
Diffstat (limited to 'libs/backends/wavesaudio')
-rw-r--r-- | libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp | 68 | ||||
-rw-r--r-- | libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h | 2 |
2 files changed, 66 insertions, 4 deletions
diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp index c3a1813176..e12bba3370 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp @@ -266,6 +266,68 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceInfo () return retVal; } +WTErr WCMRCoreAudioDevice::UpdateDeviceId() +{ + //Get device count... + UInt32 propSize = 0; + WTErr retVal = eNoErr; + OSStatus osErr = AudioHardwareGetPropertyInfo (kAudioHardwarePropertyDevices, &propSize, NULL); + ASSERT_ERROR(osErr, "AudioHardwareGetProperty 1"); + if (WUIsError(osErr)) + throw osErr; + + size_t numDevices = propSize / sizeof (AudioDeviceID); + AudioDeviceID* deviceIDs = new AudioDeviceID[numDevices]; + + //retrieve the device IDs + propSize = numDevices * sizeof (AudioDeviceID); + osErr = AudioHardwareGetProperty (kAudioHardwarePropertyDevices, &propSize, deviceIDs); + ASSERT_ERROR(osErr, "Error while getting audio devices: AudioHardwareGetProperty 2"); + if (WUIsError(osErr)) + throw osErr; + + //now add the ones that are not there... + for (size_t deviceIndex = 0; deviceIndex < numDevices; deviceIndex++) + { + DeviceInfo* pDevInfo = 0; + + //Get device name and create new DeviceInfo entry + //Get property name size. + osErr = AudioDeviceGetPropertyInfo(deviceIDs[deviceIndex], 0, 0, kAudioDevicePropertyDeviceName, &propSize, NULL); + if (osErr == kAudioHardwareNoError) + { + //Get property: name. + char* deviceName = new char[propSize]; + osErr = AudioDeviceGetProperty(deviceIDs[deviceIndex], 0, 0, kAudioDevicePropertyDeviceName, &propSize, deviceName); + if (osErr == kAudioHardwareNoError) + { + if ( (m_DeviceName == deviceName) && + (m_DeviceID != deviceIDs[deviceIndex]) ) { + + m_DeviceID = deviceIDs[deviceIndex]; + + m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::DeviceDebugInfo, (void *)"Current device has changed it's id."); + } + } + else + { + retVal = eCoreAudioFailed; + DEBUG_MSG("Failed to get device name. Device ID: " << m_DeviceID); + } + + delete [] deviceName; + } + else + { + retVal = eCoreAudioFailed; + DEBUG_MSG("Failed to get device name prop Info. Device ID: " << m_DeviceID); + } + } + + delete [] deviceIDs; + return retVal; +} + //********************************************************************************************** // WCMRCoreAudioDevice::UpdateDeviceName // @@ -2232,9 +2294,9 @@ OSStatus WCMRCoreAudioDevice::AudioIOProc(AudioUnitRenderActionFlags * ioAction //is this an input only device? if (m_OutputChannels.empty()) - AudioCallback (NULL, inNumberFrames, (uint32_t)inTimeStamp->mSampleTime, theStartTime); + AudioCallback (NULL, inNumberFrames, (uint64_t)inTimeStamp->mSampleTime, theStartTime); else if ((!m_OutputChannels.empty()) && (ioData->mBuffers[0].mNumberChannels == m_OutputChannels.size())) - AudioCallback ((float *)ioData->mBuffers[0].mData, inNumberFrames, (uint32_t)inTimeStamp->mSampleTime, theStartTime); + AudioCallback ((float *)ioData->mBuffers[0].mData, inNumberFrames, (uint64_t)inTimeStamp->mSampleTime, theStartTime); return retVal; } @@ -2255,7 +2317,7 @@ OSStatus WCMRCoreAudioDevice::AudioIOProc(AudioUnitRenderActionFlags * ioAction //! \return true //! //********************************************************************************************** -int WCMRCoreAudioDevice::AudioCallback (float *pOutputBuffer, unsigned long framesPerBuffer, uint32_t inSampleTime, uint64_t inCycleStartTime) +int WCMRCoreAudioDevice::AudioCallback (float *pOutputBuffer, unsigned long framesPerBuffer, uint64_t inSampleTime, uint64_t inCycleStartTime) { struct WCMRAudioDeviceManagerClient::AudioCallbackData audioCallbackData = { diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h index c74895ed7c..445de68fb0 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h @@ -87,7 +87,7 @@ public: virtual WTErr ShowConfigPanel (void *pParam);///< Show Control Panel - in case of ASIO this will work only with Active device! - virtual int AudioCallback (float *pOutputBuffer, unsigned long framesPerBuffer, uint32_t inSampleTime, uint64_t inCycleStartTime); + virtual int AudioCallback (float *pOutputBuffer, unsigned long framesPerBuffer, uint64_t inSampleTime, uint64_t inCycleStartTime); AudioDeviceID DeviceID () {return m_DeviceID;} |