Waves Backend MERGED from Tracks

[To be reviewed by] Paul Davis
This commit is contained in:
GZharun 2015-05-14 17:52:12 +03:00 committed by Paul Davis
parent 5d4f1c3419
commit 51d2804535
11 changed files with 44 additions and 45 deletions

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -35,7 +35,7 @@ WavesDataPort::WavesDataPort (const std::string& inport_name, PortFlags inflags)
WavesDataPort::~WavesDataPort ()
{
disconnect_all ();
_disconnect_all ();
}

View file

@ -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;

View file

@ -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__)

View file

@ -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;
}

View file

@ -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;

View file

@ -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)

View file

@ -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:
};

View file

@ -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

View file

@ -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;