From 301b9b13bf916e20b6a7f60767d741b30a83587e Mon Sep 17 00:00:00 2001 From: Greg Zharun Date: Tue, 24 Jun 2014 16:43:26 +0300 Subject: [PATCH 1/4] [Summary] Added PortAudio device channels names retrieving from the driver --- .../WCMRPortAudioDeviceManager.cpp | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp index 2f6cd710ff..057dc1d0e6 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRPortAudioDeviceManager.cpp @@ -409,9 +409,20 @@ void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/) m_InputChannels.clear(); for (int channel = 0; channel < maxInputChannels; channel++) { + const char* channelName[32]; // 32 is max leth declared by PortAudio for this operation std::stringstream chNameStream; - //A better implementation would be to retrieve the names from ASIO or CoreAudio interfaces - chNameStream << "Input " << (channel+1); + + PaError error = PaAsio_GetInputChannelName(m_DeviceID, channel, channelName); + + if (error == paNoError) + { + chNameStream << *channelName; + } + else + { + chNameStream << "Input " << (channel+1); + } + m_InputChannels.push_back (chNameStream.str()); } @@ -420,9 +431,20 @@ void WCMRPortAudioDevice::updateDeviceInfo (bool callerIsWaiting/*=false*/) m_OutputChannels.clear(); for (int channel = 0; channel < maxOutputChannels; channel++) { + const char* channelName[32]; // 32 is max leth declared by PortAudio for this operation std::stringstream chNameStream; - //A better implementation would be to retrieve the names from ASIO or CoreAudio interfaces - chNameStream << "Output " << (channel+1); + + PaError error = PaAsio_GetOutputChannelName(m_DeviceID, channel, channelName); + + if (error == paNoError) + { + chNameStream << *channelName; + } + else + { + chNameStream << "Output " << (channel+1); + } + m_OutputChannels.push_back (chNameStream.str()); } } From 520d883df1b4b29040944cfbd622c9a8616f0836 Mon Sep 17 00:00:00 2001 From: Greg Zharun Date: Tue, 24 Jun 2014 16:44:19 +0300 Subject: [PATCH 2/4] [Summary] Added channel name hints that will show the full name of the channel --- gtk2_ardour/device_connection_control.cc | 2 ++ gtk2_ardour/midi_device_connection_control.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/gtk2_ardour/device_connection_control.cc b/gtk2_ardour/device_connection_control.cc index dd46420bee..24b84b80a6 100644 --- a/gtk2_ardour/device_connection_control.cc +++ b/gtk2_ardour/device_connection_control.cc @@ -75,6 +75,7 @@ void DeviceConnectionControl::init(const std::string& name, bool active, uint16_ if (_name_label != NULL) { _name_label->set_text (name); + _name_label->set_tooltip_text(name); } if (_number_label != NULL) { @@ -121,6 +122,7 @@ DeviceConnectionControl::set_track_name (const std::string& new_track_name) { if (_track_name_label != NULL ) { _track_name_label->set_text (new_track_name); + _track_name_label->set_tooltip_text(new_track_name); if (new_track_name.empty() ) { _track_name_label->get_parent()->hide(); } else { diff --git a/gtk2_ardour/midi_device_connection_control.cc b/gtk2_ardour/midi_device_connection_control.cc index b7437fd211..c7699865af 100644 --- a/gtk2_ardour/midi_device_connection_control.cc +++ b/gtk2_ardour/midi_device_connection_control.cc @@ -73,6 +73,7 @@ void MidiDeviceConnectionControl::init(const std::string& name, bool capture_act } _name_label->set_text (name); + _name_label->set_tooltip_text(name); set_capture_active(capture_active); set_playback_active(playback_active); From bf2dc8fdb87911f77d24ee6f2d6bff675e4a24e3 Mon Sep 17 00:00:00 2001 From: grygoriiz Date: Tue, 24 Jun 2014 18:29:46 +0300 Subject: [PATCH 3/4] [Summary] Used older version of CoreAudio API by Paul's suggestion to support MAC OS X version older then 10.8 --- .../WCMRCoreAudioDeviceManager.cpp | 67 +++++++++++-------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp index 8a48f4b30b..ec19b9fd43 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp @@ -390,27 +390,30 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceInputs() for (int channel = 0; channel < maxInputChannels; channel++) { - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioObjectPropertyElementName; - pa.mScope = kAudioObjectPropertyScopeInput; - pa.mElement = channel + 1; - CFStringRef cfName; std::stringstream chNameStream; UInt32 nameSize = 0; OSStatus error = kAudioHardwareNoError; - bool hasChannelNames = AudioObjectHasProperty(m_DeviceID, &pa); + error = AudioDeviceGetPropertyInfo (m_DeviceID, + channel + 1, + true /* Input */, + kAudioDevicePropertyChannelNameCFString, + &nameSize, + NULL); - if (hasChannelNames) { - error = AudioObjectGetPropertyDataSize(m_DeviceID, &pa, 0, 0, &nameSize ); + if (error == kAudioHardwareNoError) + { + error = AudioDeviceGetProperty (m_DeviceID, + channel + 1, + true /* Input */, + kAudioDevicePropertyChannelNameCFString, + &nameSize, + &cfName); + } + - if (error == kAudioHardwareNoError) { - error = AudioObjectGetPropertyData (m_DeviceID, &pa, 0, 0, &nameSize, &cfName); - } - } - - if (hasChannelNames && (error == kAudioHardwareNoError) ) + if (error == kAudioHardwareNoError) { CFIndex length = CFStringGetLength(cfName); CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8); @@ -419,7 +422,9 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceInputs() CFStringGetCString(cfName, cstr_name, maxSize, kCFStringEncodingUTF8); chNameStream << cstr_name; - } else { + } + else + { chNameStream << "Input " << (channel+1); } @@ -501,27 +506,29 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceOutputs() m_OutputChannels.clear(); for (int channel = 0; channel < maxOutputChannels; channel++) { - AudioObjectPropertyAddress pa; - pa.mSelector = kAudioObjectPropertyElementName; - pa.mScope = kAudioObjectPropertyScopeOutput; - pa.mElement = channel + 1; - CFStringRef cfName; std::stringstream chNameStream; UInt32 nameSize = 0; OSStatus error = kAudioHardwareNoError; - bool hasChannelNames = AudioObjectHasProperty(m_DeviceID, &pa); + error = AudioDeviceGetPropertyInfo (m_DeviceID, + channel + 1, + false /* Output */, + kAudioDevicePropertyChannelNameCFString, + &nameSize, + NULL); - if (hasChannelNames) { - error = AudioObjectGetPropertyDataSize(m_DeviceID, &pa, 0, 0, &nameSize ); - - if (error == kAudioHardwareNoError) { - error = AudioObjectGetPropertyData (m_DeviceID, &pa, 0, 0, &nameSize, &cfName); - } + if (error == kAudioHardwareNoError) + { + error = AudioDeviceGetProperty (m_DeviceID, + channel + 1, + false /* Output */, + kAudioDevicePropertyChannelNameCFString, + &nameSize, + &cfName); } - if (hasChannelNames && (error == kAudioHardwareNoError) ) + if (error == kAudioHardwareNoError ) { CFIndex length = CFStringGetLength(cfName); CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8); @@ -530,7 +537,9 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceOutputs() CFStringGetCString(cfName, cstr_name, maxSize, kCFStringEncodingUTF8); chNameStream << cstr_name; - } else { + } + else + { chNameStream << "Output " << (channel+1); } From 41aa608ad063af0ed0c33dd5f3d1b3d5eb24083b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 24 Jun 2014 13:07:22 -0400 Subject: [PATCH 4/4] fix wscript for wavesaudio backend so that it uses the correct name for the CoreM[iI][dD][iI] framework on Lion and other OS X versions. Thanks, Apple. --- libs/backends/wavesaudio/wscript | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/backends/wavesaudio/wscript b/libs/backends/wavesaudio/wscript index 3f3a7080b7..2b3684b0fd 100644 --- a/libs/backends/wavesaudio/wscript +++ b/libs/backends/wavesaudio/wscript @@ -32,8 +32,11 @@ def build(bld): obj = bld(features = 'c cxx cxxshlib') if sys.platform == 'darwin': - obj.framework = 'CoreMidi' - + if bld.env['build_target'] not in [ 'lion' ]: + obj.framework = 'CoreMidi' + else: + obj.framework = 'CoreMIDI' + obj.source = [ 'waves_audiobackend.cc', 'waves_audiobackend.latency.cc',