diff options
author | GZharun <grygoriiz@wavesglobal.com> | 2015-05-14 17:52:12 +0300 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:14 -0400 |
commit | 51d2804535b7bab8dbd96da8c8ae02d65c9347c1 (patch) | |
tree | 70e7dfcd88e764d3e8a5fbd6761a28ed3ec266e7 | |
parent | 5d4f1c3419d3bab12502692c5590060f4faef1bc (diff) |
Waves Backend MERGED from Tracks
[To be reviewed by] Paul Davis
11 files changed, 44 insertions, 45 deletions
diff --git a/libs/backends/wavesaudio/waves_audiobackend.cc b/libs/backends/wavesaudio/waves_audiobackend.cc index 0b02a9c52d..704a4bdb24 100644 --- a/libs/backends/wavesaudio/waves_audiobackend.cc +++ b/libs/backends/wavesaudio/waves_audiobackend.cc @@ -42,8 +42,8 @@ void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reaso std::cout << "------------------------------- WCMRAudioDeviceManagerClient::DeviceDebugInfo -- " << (char*)parameter << std::endl; break; case WCMRAudioDeviceManagerClient::BufferSizeChanged: - std::cout << "------------------------------- WCMRAudioDeviceManagerClient::BufferSizeChanged: " << *(uint32_t*)parameter << std::endl; - _buffer_size_change(*(uint32_t*)parameter); + std::cout << "------------------------------- WCMRAudioDeviceManagerClient::BufferSizeChanged: " << *(int*)parameter << std::endl; + _buffer_size_change(*(int*)parameter); break; case WCMRAudioDeviceManagerClient::RequestReset: std::cout << "------------------------------- WCMRAudioDeviceManagerClient::RequestReset" << std::endl; @@ -54,7 +54,7 @@ void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reaso break; case WCMRAudioDeviceManagerClient::SamplingRateChanged: std::cout << "------------------------------- WCMRAudioDeviceManagerClient::SamplingRateChanged: " << *(float*)parameter << std::endl; - set_sample_rate(*(float*)parameter); + _sample_rate_change(*(float*)parameter); break; case WCMRAudioDeviceManagerClient::Dropout: std::cout << "------------------------------- WCMRAudioDeviceManagerClient::Dropout: " << std::endl; @@ -77,7 +77,7 @@ void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reaso engine.request_device_list_update(); break; case WCMRAudioDeviceManagerClient::IODeviceDisconnected: - std::cout << "------------------------------- WCMRAudioDeviceManagerClient::DeviceListChanged" << std::endl; + std::cout << "------------------------------- WCMRAudioDeviceManagerClient::IODeviceDisconnected" << std::endl; engine.request_device_list_update(); break; case WCMRAudioDeviceManagerClient::AudioCallback: @@ -411,7 +411,6 @@ WavesAudioBackend::set_sample_rate (float sample_rate) if (device_needs_restart) { // COMMENTED DBG LOGS */ std::cout << "\t\t[" << _device->DeviceName() << "]->SetStreaming (true);"<< std::endl; - _call_thread_init_callback = true; retVal = _device->SetStreaming (true); if (retVal != eNoErr) { std::cerr << "WavesAudioBackend::set_sample_rate (): [" << _device->DeviceName () << "]->SetStreaming (true) failed (" << retVal << ") !" << std::endl; @@ -460,7 +459,6 @@ WavesAudioBackend::set_buffer_size (uint32_t buffer_size) if (device_needs_restart) { // COMMENTED DBG LOGS */ std::cout << "\t\t[" << _device->DeviceName() << "]->SetStreaming (true);"<< std::endl; - _call_thread_init_callback = true; retVal = _device->SetStreaming (true); if (retVal != eNoErr) { std::cerr << "WavesAudioBackend::set_buffer_size (): [" << _device->DeviceName () << "]->SetStreaming (true) failed (" << retVal << ") !" << std::endl; @@ -694,7 +692,6 @@ WavesAudioBackend::_start (bool for_latency_measurement) manager.registration_callback (); - _call_thread_init_callback = true; WTErr retVal = _device->SetStreaming (true); if (retVal != eNoErr) { std::cerr << "WavesAudioBackend::_start (): [" << _device->DeviceName () << "]->SetStreaming () failed!" << std::endl; diff --git a/libs/backends/wavesaudio/waves_audioport.cc b/libs/backends/wavesaudio/waves_audioport.cc index 8f967f0a57..4918025bea 100644 --- a/libs/backends/wavesaudio/waves_audioport.cc +++ b/libs/backends/wavesaudio/waves_audioport.cc @@ -49,18 +49,18 @@ void* WavesAudioPort::get_buffer (pframes_t nframes) * of the connections. */ - // get first buffer data - // use optimized function to fill the buffer intialy - ARDOUR::copy_vector (_buffer, ((const WavesAudioPort*)*it)->const_buffer (), nframes); - ++it; + // get first buffer data + // use optimized function to fill the buffer intialy + ARDOUR::copy_vector (_buffer, ((const WavesAudioPort*)*it)->const_buffer (), nframes); + ++it; - // mix the rest - for (; it != get_connections ().end (); ++it) { - Sample* tgt = buffer (); - const Sample* src = ((const WavesAudioPort*)*it)->const_buffer (); + // mix the rest + for (; it != get_connections ().end (); ++it) { + Sample* tgt = buffer (); + const Sample* src = ((const WavesAudioPort*)*it)->const_buffer (); - // use otimized function to mix the buffers - ARDOUR::mix_buffers_no_gain (tgt, src, nframes); + // use otimized function to mix the buffers + ARDOUR::mix_buffers_no_gain (tgt, src, nframes); } } } diff --git a/libs/backends/wavesaudio/waves_dataport.cc b/libs/backends/wavesaudio/waves_dataport.cc index ffdc9865f3..b5485ac2b3 100644 --- a/libs/backends/wavesaudio/waves_dataport.cc +++ b/libs/backends/wavesaudio/waves_dataport.cc @@ -35,7 +35,7 @@ WavesDataPort::WavesDataPort (const std::string& inport_name, PortFlags inflags) WavesDataPort::~WavesDataPort () { - disconnect_all (); + _disconnect_all (); } diff --git a/libs/backends/wavesaudio/waves_midi_device_manager.cc b/libs/backends/wavesaudio/waves_midi_device_manager.cc index 317f1ec257..344deeeea9 100644 --- a/libs/backends/wavesaudio/waves_midi_device_manager.cc +++ b/libs/backends/wavesaudio/waves_midi_device_manager.cc @@ -54,7 +54,7 @@ WavesMidiDeviceManager::~WavesMidiDeviceManager () int WavesMidiDeviceManager::start () { - // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::stream ():" << std::endl; + // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::start ():" << std::endl; if ( _active == true ) { return -1; } @@ -77,7 +77,7 @@ WavesMidiDeviceManager::start () int WavesMidiDeviceManager::stream (bool yn) { - // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::stream ():" << std::endl; + // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::stream (" << (yn?"true":"false") << "):" << std::endl; if (!_active) { std::cerr << "WavesMidiDeviceManager::stream (): the midi device manager is not started up !" << std::endl; return -1; @@ -88,7 +88,8 @@ WavesMidiDeviceManager::stream (bool yn) } if (yn) { - if ( Pt_Start (1, __portmidi_callback, this) != ptNoError) { + // __portmidi_callback will be called once per 50 msec + if ( Pt_Start (50, __portmidi_callback, this) != ptNoError) { std::cerr << "WavesMidiDeviceManager::stream (): Pt_Start () failed!" << std::endl; return -1; } @@ -130,7 +131,7 @@ WavesMidiDeviceManager::stop () void WavesMidiDeviceManager::__portmidi_callback (PtTimestamp timestamp, void * userData) { - // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::__portmidi_callback ():" << std::endl; + // COMMENTED FREQUENT DBG LOGS */ std::cout << "WavesMidiDeviceManager::__portmidi_callback ():" << std::endl; WavesMidiDeviceManager *dm = (WavesMidiDeviceManager *)userData; if (dm == NULL) { @@ -149,8 +150,10 @@ WavesMidiDeviceManager::_portmidi_callback (PtTimestamp timestamp) if ((_input_device_count != midiInGetNumDevs ()) || (_output_device_count != midiOutGetNumDevs ())) { _audiobackend._changed_midi_devices (); - return; - } + // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::_portmidi_callback ():" << std::endl; + // COMMENTED DBG LOGS */ std::cout << " _input_device_count ?= midiInGetNumDevs () :" << _input_device_count << " ?= " << midiInGetNumDevs () << std::endl; + // COMMENTED DBG LOGS */ std::cout << " _output_device_count ?= midiOutGetNumDevs () :" << _output_device_count << " ?= " << midiOutGetNumDevs () << std::endl; + } } void WavesMidiDeviceManager::do_read () @@ -178,6 +181,7 @@ WavesMidiDeviceManager::__get_time_ms (void *time_info) WavesMidiDevice* WavesMidiDeviceManager::_get_device (const std::string& name) { + // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::_get_device ():" << std::endl; for (size_t i = 0; i < _devices.size (); i++) { if (name == _devices[i]->name ()) { return _devices[i]; @@ -190,21 +194,22 @@ WavesMidiDevice* WavesMidiDeviceManager::_get_device (const std::string& name) int WavesMidiDeviceManager::_create_devices () { + // COMMENTED DBG LOGS */ std::cout << "WavesMidiDeviceManager::_create_devices () :" << std::endl; int count = Pm_CountDevices (); for (int i = 0; i < count; i++) { const PmDeviceInfo* pm_device_info = Pm_GetDeviceInfo (i); - // COMMENTED DBG LOGS */ std::cout << " interf : " << pm_device_info->interf << std::endl; - // COMMENTED DBG LOGS */ std::cout << " name : " << pm_device_info->name << std::endl; - // COMMENTED DBG LOGS */ std::cout << " input : " << pm_device_info->input << std::endl; - // COMMENTED DBG LOGS */ std::cout << " output : " << pm_device_info->output << std::endl; - // COMMENTED DBG LOGS */ std::cout << " opened : " << pm_device_info->opened << std::endl; + // COMMENTED DBG LOGS */ std::cout << " interf : " << pm_device_info->interf << std::endl; + // COMMENTED DBG LOGS */ std::cout << " name : " << pm_device_info->name << std::endl; + // COMMENTED DBG LOGS */ std::cout << " input : " << pm_device_info->input << std::endl; + // COMMENTED DBG LOGS */ std::cout << " output : " << pm_device_info->output << std::endl; + // COMMENTED DBG LOGS */ std::cout << " opened : " << pm_device_info->opened << std::endl; #if defined (PLATFORM_WINDOWS) - if (strncmp (pm_device_info->name, "Microsoft", strlen ("Microsoft")) == 0) { - // COMMENTED DBG LOGS */ std::cout << " skipping anything from Microsoft :" << pm_device_info->name << std::endl; - continue; - } + if (strncmp (pm_device_info->name, "Microsoft", strlen ("Microsoft")) == 0) { + // COMMENTED DBG LOGS */ std::cout << " skipping anything from Microsoft :" << pm_device_info->name << std::endl; + continue; + } #endif if (pm_device_info == NULL) { std::cerr << "WavesMidiDeviceManager::_create_devices (): Pm_GetDeviceInfo (" << i << ") failed!" << std::endl; diff --git a/libs/backends/wavesaudio/wavesapi/BasicTypes/WUDefines.h b/libs/backends/wavesaudio/wavesapi/BasicTypes/WUDefines.h index 3bfb1d7805..1279b33905 100644 --- a/libs/backends/wavesaudio/wavesapi/BasicTypes/WUDefines.h +++ b/libs/backends/wavesaudio/wavesapi/BasicTypes/WUDefines.h @@ -63,7 +63,7 @@ #define WIN_ONLY(__Something_only_for_windows__) #define MAC_ONLY(__Something_only_for_mac__) __Something_only_for_mac__ - #if defined(i386) || defined(__i386) || defined(__i386__) || defined (__ppc__) + #if defined(i386) || defined(__i386) || defined(__i386__) #define kNumArchBits 32 #endif #if defined(__x86_64) || defined(__x86_64__) diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.cpp index 1b18fc3cfa..138810f55f 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.cpp @@ -366,9 +366,8 @@ WTErr WCMRAudioDevice::ResetDevice () if (err == eNoErr && wasActive) err = SetActive(true); - if (err == eNoErr && wasStreaming) { - err = SetStreaming(true); - } + if (err == eNoErr && wasStreaming) + SetStreaming(true); return err; } diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h index 818ea717fd..9d7800970f 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRAudioDeviceManager.h @@ -57,6 +57,7 @@ struct DeviceInfo DeviceID m_DeviceId; std::string m_DeviceName; std::vector<int> m_AvailableSampleRates; + std::vector<int> m_AvailableBufferSizes; unsigned int m_MaxInputChannels; unsigned int m_MaxOutputChannels; diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp index 003bbf5488..f7f05d7f45 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp @@ -39,7 +39,7 @@ static const int gAllBufferSizes[] = ///< The default SR. static const int DEFAULT_SR = 44100; ///< The default buffer size. -static const int DEFAULT_BUFFERSIZE = 128; +static const int DEFAULT_BUFFERSIZE = 1024; static const int NONE_DEVICE_ID = -1; @@ -2946,7 +2946,6 @@ WTErr WCMRCoreAudioDeviceManager::updateDeviceListImpl() if (eNoErr != err) { std::cout << "API::PortAudioDeviceManager::updateDeviceListImpl: Device list update error: "<< err << std::endl; - return err; } if (m_CurrentDevice) diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h index cd4797a000..8bbd7d8eff 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.h @@ -168,8 +168,7 @@ protected: static OSStatus StaticPropertyChangeProc (AudioDeviceID inDevice, UInt32 inChannel, Boolean isInput, AudioDevicePropertyID inPropertyID, void *inClientData); void PropertyChangeProc (AudioDevicePropertyID inPropertyID); - - void resetAudioDevice(); + private: }; diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp index 935689aafe..f3565e2546 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRNativeAudio.cpp @@ -35,6 +35,7 @@ //********************************************************************************************** WCMRNativeAudioNoneDevice::WCMRNativeAudioNoneDevice (WCMRAudioDeviceManager *pManager) : WCMRNativeAudioDevice (pManager, false /*useMultiThreading*/) + , m_SilenceThread(0) #if defined (PLATFORM_WINDOWS) , _waitableTimerForUsleep (CreateWaitableTimer(NULL, TRUE, NULL)) #endif diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp index a476f9a697..35ac18c044 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp @@ -1044,8 +1044,7 @@ void WCMRPortAudioDevice::resetDevice (bool callerIsWaiting /*=false*/ ) // Resume streaming if the device was streaming before if(wasStreaming && m_lastErr == eNoErr && m_ConnectionStatus == DeviceAvailable) { - // Notify the Application to prepare for the stream start - m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::DeviceStartsStreaming); + // start streaming startStreaming(); } } else { @@ -1077,7 +1076,6 @@ long WCMRPortAudioDevice::ASIOMessageHook (long selector, long WCUNUSEDPARAM(val case kAsioResyncRequest: m_ResyncRequested++; std::cout << "\t\t\tWCMRPortAudioDevice::ASIOMessageHook -- kAsioResyncRequest" << std::endl; - m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::RequestReset); break; case kAsioLatenciesChanged: @@ -1099,8 +1097,8 @@ long WCMRPortAudioDevice::ASIOMessageHook (long selector, long WCUNUSEDPARAM(val break; case kAsioResetRequest: - m_ResetRequested++; std::cout << "\t\t\tWCMRPortAudioDevice::ASIOMessageHook -- kAsioResetRequest" << std::endl; + m_ResetRequested++; m_pMyManager->NotifyClient (WCMRAudioDeviceManagerClient::RequestReset); break; |