diff --git a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj index a091dadb09..3b9952a34a 100644 --- a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj +++ b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj @@ -269,6 +269,8 @@ 43279460194F0062003C9FEA /* tracks_preferences.xml in Resources */ = {isa = PBXBuildFile; fileRef = 43279430194F0062003C9FEA /* tracks_preferences.xml */; }; 4327947F194F009E003C9FEA /* tracks.menus.in in Resources */ = {isa = PBXBuildFile; fileRef = 43279475194F009E003C9FEA /* tracks.menus.in */; }; 43B351ED194F04E00038C140 /* step_editing.bindings in Resources */ = {isa = PBXBuildFile; fileRef = 43B351C0194F04E00038C140 /* step_editing.bindings */; }; + CEAFC770195445560016ACF0 /* bbt_time.cc in Sources */ = {isa = PBXBuildFile; fileRef = CEAFC76E195445560016ACF0 /* bbt_time.cc */; }; + CEAFC771195445560016ACF0 /* time.cc in Sources */ = {isa = PBXBuildFile; fileRef = CEAFC76F195445560016ACF0 /* time.cc */; }; CEDB41321951C668006E6F77 /* buildlog.txt in Resources */ = {isa = PBXBuildFile; fileRef = CEDB41311951C668006E6F77 /* buildlog.txt */; }; /* End PBXBuildFile section */ @@ -1076,6 +1078,11 @@ 43B351EE194F12FB0038C140 /* waves_audiobackend.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = waves_audiobackend.xcodeproj; path = ../../libs/backends/wavesaudio/macosx/waves_audiobackend.xcodeproj; sourceTree = ""; }; 43B351F4194F130C0038C140 /* libardour.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libardour.xcodeproj; path = ../../libs/ardour/macosx/libardour.xcodeproj; sourceTree = ""; }; 43B351FA194F131D0038C140 /* pbd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pbd.xcodeproj; path = ../../libs/pbd/macosx/pbd.xcodeproj; sourceTree = ""; }; + CEAFC76E195445560016ACF0 /* bbt_time.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = bbt_time.cc; path = ../../libs/timecode/src/bbt_time.cc; sourceTree = ""; }; + CEAFC76F195445560016ACF0 /* time.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = time.cc; path = ../../libs/timecode/src/time.cc; sourceTree = ""; }; + CEAFC775195445D90016ACF0 /* bbt_time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bbt_time.h; path = ../../libs/timecode/timecode/bbt_time.h; sourceTree = ""; }; + CEAFC776195445D90016ACF0 /* time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = time.h; path = ../../libs/timecode/timecode/time.h; sourceTree = ""; }; + CEAFC777195445D90016ACF0 /* visibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = visibility.h; path = ../../libs/timecode/timecode/visibility.h; sourceTree = ""; }; CEDB41311951C668006E6F77 /* buildlog.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = buildlog.txt; path = ../../../buildlog.txt; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1113,6 +1120,8 @@ 43279040194EFF38003C9FEA /* source */ = { isa = PBXGroup; children = ( + CEAFC76E195445560016ACF0 /* bbt_time.cc */, + CEAFC76F195445560016ACF0 /* time.cc */, 43279210194EFFBA003C9FEA /* tracks_control_panel.cc */, 43279212194EFFBA003C9FEA /* tracks_control_panel.logic.cc */, 43279043194EFFB9003C9FEA /* actions.cc */, @@ -1721,6 +1730,9 @@ 43279480194F00CB003C9FEA /* headers */ = { isa = PBXGroup; children = ( + CEAFC775195445D90016ACF0 /* bbt_time.h */, + CEAFC776195445D90016ACF0 /* time.h */, + CEAFC777195445D90016ACF0 /* visibility.h */, 43B351D4194F04E00038C140 /* tracks_control_panel.h */, 43B351D5194F04E00038C140 /* tracks_control_panel.logic.h */, 43B350F0194F04E00038C140 /* about.h */, @@ -2361,6 +2373,8 @@ files = ( 43279254194EFFF1003C9FEA /* main.m in Sources */, 4327925B194EFFF1003C9FEA /* AppDelegate.m in Sources */, + CEAFC770195445560016ACF0 /* bbt_time.cc in Sources */, + CEAFC771195445560016ACF0 /* time.cc in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/gtk2_ardour/tracks_control_panel.logic.cc b/gtk2_ardour/tracks_control_panel.logic.cc index 4c3185a537..68181a94bb 100644 --- a/gtk2_ardour/tracks_control_panel.logic.cc +++ b/gtk2_ardour/tracks_control_panel.logic.cc @@ -52,7 +52,8 @@ using namespace Glib; namespace { - static const char* audio_port_name_prefix = "system:"; + static const char* audio_capture_name_prefix = "system:capture:"; + static const char* audio_playback_name_prefix = "system:playback:"; static const char* midi_port_name_prefix = "system_midi:"; static const char* midi_capture_suffix = " capture"; static const char* midi_playback_suffix = " playback"; @@ -157,7 +158,7 @@ TracksControlPanel::init () DeviceConnectionControl& TracksControlPanel::add_device_capture_control(std::string port_name, bool active, uint16_t capture_number, std::string track_name) { std::string device_capture_name(""); - std::string pattern(audio_port_name_prefix); + std::string pattern(audio_capture_name_prefix); remove_pattern_from_string(port_name, pattern, device_capture_name); DeviceConnectionControl &capture_control = *manage (new DeviceConnectionControl(device_capture_name, active, capture_number, track_name)); @@ -174,7 +175,7 @@ DeviceConnectionControl& TracksControlPanel::add_device_capture_control(std::str DeviceConnectionControl& TracksControlPanel::add_device_playback_control(std::string port_name, bool active, uint16_t playback_number) { std::string device_playback_name(""); - std::string pattern(audio_port_name_prefix); + std::string pattern(audio_playback_name_prefix); remove_pattern_from_string(port_name, pattern, device_playback_name); DeviceConnectionControl &playback_control = *manage (new DeviceConnectionControl(device_playback_name, active, playback_number)); @@ -716,7 +717,7 @@ TracksControlPanel::populate_input_channels() if (input_iter->active) { std::string port_name(""); - std::string pattern(audio_port_name_prefix); + std::string pattern(audio_capture_name_prefix); remove_pattern_from_string(input_iter->name, pattern, port_name); number = number_count++; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 59db5e2a81..b5022ec8b9 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -379,7 +379,7 @@ Session::Session (AudioEngine &eng, for( int i = 0; i < inputs.size(); ++i) { string track_name; - remove_pattern_from_string(inputs[i], "system:", track_name); + remove_pattern_from_string(inputs[i], "system:capture:", track_name); list > single_track = new_audio_track (1, 1, Normal, 0, 1, track_name); tracks.insert(tracks.begin(), single_track.front()); diff --git a/libs/backends/wavesaudio/waves_audiobackend.port_engine.cc b/libs/backends/wavesaudio/waves_audiobackend.port_engine.cc index f798ff4c14..b3f5915766 100644 --- a/libs/backends/wavesaudio/waves_audiobackend.port_engine.cc +++ b/libs/backends/wavesaudio/waves_audiobackend.port_engine.cc @@ -594,10 +594,11 @@ WavesAudioBackend::_register_system_audio_ports () for (std::vector::iterator it = input_channels.begin (); (port_number < channels) && (it != input_channels.end ()); ++it) { - std::ostringstream port_name; - port_name << "capture_" << ++port_number; - - WavesDataPort* port = _register_port ("system:" + port_name.str (), DataType::AUDIO , static_cast (IsOutput | IsPhysical | IsTerminal)); + + std::ostringstream port_name(*it); + WavesDataPort* port = _register_port ("system:capture:" + port_name.str (), DataType::AUDIO , + static_cast (IsOutput | IsPhysical | IsTerminal)); + if (port == NULL) { std::cerr << "WavesAudioBackend::_create_system_audio_ports (): Failed registering port [" << port_name << "] for [" << _device->DeviceName () << "]" << std::endl; return-1; @@ -616,9 +617,11 @@ WavesAudioBackend::_register_system_audio_ports () for (std::vector::iterator it = output_channels.begin (); (port_number < channels) && (it != output_channels.end ()); ++it) { - std::ostringstream port_name; - port_name << "playback_" << ++port_number; - WavesDataPort* port = _register_port ("system:" + port_name.str (), DataType::AUDIO , static_cast (IsInput| IsPhysical | IsTerminal)); + + std::ostringstream port_name(*it); + WavesDataPort* port = _register_port ("system:playback:" + port_name.str (), DataType::AUDIO , + static_cast (IsInput| IsPhysical | IsTerminal)); + if (port == NULL) { std::cerr << "WavesAudioBackend::_create_system_audio_ports (): Failed registering port ]" << port_name << "] for [" << _device->DeviceName () << "]" << std::endl; return-1; diff --git a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp index bf613ff090..8a48f4b30b 100644 --- a/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp +++ b/libs/backends/wavesaudio/wavesapi/devicemanager/WCMRCoreAudioDeviceManager.cpp @@ -356,7 +356,7 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceInputs() memset (pStreamBuffers, 0, propSize); // Get the Input channels - err = AudioDeviceGetProperty (m_DeviceID, 0, 1/* Input */, kAudioDevicePropertyStreamConfiguration, &propSize, pStreamBuffers); + err = AudioDeviceGetProperty (m_DeviceID, 0, true/* Input */, kAudioDevicePropertyStreamConfiguration, &propSize, pStreamBuffers); if (err == kAudioHardwareNoError) { // Calculate the number of input channels @@ -387,11 +387,42 @@ WTErr WCMRCoreAudioDevice::UpdateDeviceInputs() // Update input channels m_InputChannels.clear(); + for (int channel = 0; channel < maxInputChannels; channel++) { + AudioObjectPropertyAddress pa; + pa.mSelector = kAudioObjectPropertyElementName; + pa.mScope = kAudioObjectPropertyScopeInput; + pa.mElement = channel + 1; + + CFStringRef cfName; std::stringstream chNameStream; - //A better implementation would be to retrieve the names from ASIO or CoreAudio interfaces - chNameStream << "Input " << (channel+1); + UInt32 nameSize = 0; + OSStatus error = kAudioHardwareNoError; + + bool hasChannelNames = AudioObjectHasProperty(m_DeviceID, &pa); + + if (hasChannelNames) { + error = AudioObjectGetPropertyDataSize(m_DeviceID, &pa, 0, 0, &nameSize ); + + if (error == kAudioHardwareNoError) { + error = AudioObjectGetPropertyData (m_DeviceID, &pa, 0, 0, &nameSize, &cfName); + } + } + + if (hasChannelNames && (error == kAudioHardwareNoError) ) + { + CFIndex length = CFStringGetLength(cfName); + CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8); + + char* cstr_name = new char[maxSize]; + CFStringGetCString(cfName, cstr_name, maxSize, kCFStringEncodingUTF8); + + chNameStream << cstr_name; + } else { + chNameStream << "Input " << (channel+1); + } + m_InputChannels.push_back (chNameStream.str()); } @@ -470,9 +501,39 @@ 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; - //A better implementation would be to retrieve the names from ASIO or CoreAudio interfaces - chNameStream << "Output " << (channel+1); + UInt32 nameSize = 0; + OSStatus error = kAudioHardwareNoError; + + bool hasChannelNames = AudioObjectHasProperty(m_DeviceID, &pa); + + if (hasChannelNames) { + error = AudioObjectGetPropertyDataSize(m_DeviceID, &pa, 0, 0, &nameSize ); + + if (error == kAudioHardwareNoError) { + error = AudioObjectGetPropertyData (m_DeviceID, &pa, 0, 0, &nameSize, &cfName); + } + } + + if (hasChannelNames && (error == kAudioHardwareNoError) ) + { + CFIndex length = CFStringGetLength(cfName); + CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8); + + char* cstr_name = new char[maxSize]; + CFStringGetCString(cfName, cstr_name, maxSize, kCFStringEncodingUTF8); + + chNameStream << cstr_name; + } else { + chNameStream << "Output " << (channel+1); + } + m_OutputChannels.push_back (chNameStream.str()); }