2 Copyright (C) 2010 Paul Davis
3 Copyright (C) 2011 Tim Mayberry
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "ardouralsautil/devicelist.h"
26 #include <CoreAudio/CoreAudio.h>
27 #include <CoreFoundation/CFString.h>
28 #include <sys/param.h>
29 #include <mach-o/dyld.h>
32 #ifdef PLATFORM_WINDOWS
33 #include <shobjidl.h> // Needed for
34 #include <shlguid.h> // 'IShellLink'
37 #if (defined PLATFORM_WINDOWS && defined HAVE_PORTAUDIO)
38 #include <portaudio.h>
43 #include <boost/scoped_ptr.hpp>
45 #include <glibmm/miscutils.h>
48 #include "pbd/error.h"
49 #include "pbd/convert.h"
50 #include "pbd/file_utils.h"
51 #include "pbd/search_path.h"
53 #include "jack_utils.h"
65 // The pretty driver names
66 const char * const portaudio_driver_name = X_("Portaudio");
67 const char * const coreaudio_driver_name = X_("CoreAudio");
68 const char * const alsa_driver_name = X_("ALSA");
69 const char * const oss_driver_name = X_("OSS");
70 const char * const freebob_driver_name = X_("FreeBoB");
71 const char * const ffado_driver_name = X_("FFADO");
72 const char * const netjack_driver_name = X_("NetJACK");
73 const char * const dummy_driver_name = X_("Dummy");
78 // The real driver names
79 const char * const portaudio_driver_command_line_name = X_("portaudio");
80 const char * const coreaudio_driver_command_line_name = X_("coreaudio");
81 const char * const alsa_driver_command_line_name = X_("alsa");
82 const char * const oss_driver_command_line_name = X_("oss");
83 const char * const freebob_driver_command_line_name = X_("freebob");
84 const char * const ffado_driver_command_line_name = X_("firewire");
85 const char * const netjack_driver_command_line_name = X_("netjack");
86 const char * const dummy_driver_command_line_name = X_("dummy");
88 // should we provide more "pretty" names like above?
89 const char * const alsa_seq_midi_driver_name = X_("alsa");
90 const char * const alsa_raw_midi_driver_name = X_("alsarawmidi");
91 const char * const alsaseq_midi_driver_name = X_("seq");
92 const char * const alsaraw_midi_driver_name = X_("raw");
93 const char * const winmme_midi_driver_name = X_("winmme");
94 const char * const coremidi_midi_driver_name = X_("coremidi");
96 // this should probably be translated
97 const char * const default_device_name = X_("Default");
100 static ARDOUR::MidiOptions midi_options;
109 ARDOUR::get_jack_audio_driver_names (vector<string>& audio_driver_names)
111 #ifdef PLATFORM_WINDOWS
112 audio_driver_names.push_back (portaudio_driver_name);
114 audio_driver_names.push_back (coreaudio_driver_name);
117 audio_driver_names.push_back (alsa_driver_name);
119 audio_driver_names.push_back (oss_driver_name);
120 audio_driver_names.push_back (freebob_driver_name);
121 audio_driver_names.push_back (ffado_driver_name);
123 audio_driver_names.push_back (netjack_driver_name);
124 audio_driver_names.push_back (dummy_driver_name);
128 ARDOUR::get_jack_default_audio_driver_name (string& audio_driver_name)
130 vector<string> drivers;
131 get_jack_audio_driver_names (drivers);
132 audio_driver_name = drivers.front ();
136 ARDOUR::get_jack_sample_rate_strings (vector<string>& samplerates)
138 // do these really need to be translated?
139 samplerates.push_back (_("8000Hz"));
140 samplerates.push_back (_("22050Hz"));
141 samplerates.push_back (_("44100Hz"));
142 samplerates.push_back (_("48000Hz"));
143 samplerates.push_back (_("88200Hz"));
144 samplerates.push_back (_("96000Hz"));
145 samplerates.push_back (_("192000Hz"));
149 ARDOUR::get_jack_default_sample_rate ()
155 ARDOUR::get_jack_period_size_strings (std::vector<std::string>& period_sizes)
157 period_sizes.push_back ("32");
158 period_sizes.push_back ("64");
159 period_sizes.push_back ("128");
160 period_sizes.push_back ("256");
161 period_sizes.push_back ("512");
162 period_sizes.push_back ("1024");
163 period_sizes.push_back ("2048");
164 period_sizes.push_back ("4096");
165 period_sizes.push_back ("8192");
169 ARDOUR::get_jack_default_period_size ()
175 ARDOUR::get_jack_dither_mode_strings (const string& driver, vector<string>& dither_modes)
177 dither_modes.push_back (get_none_string ());
179 if (driver == alsa_driver_name ) {
180 dither_modes.push_back (_("Triangular"));
181 dither_modes.push_back (_("Rectangular"));
182 dither_modes.push_back (_("Shaped"));
187 ARDOUR::get_jack_default_dither_mode (const string& /*driver*/)
189 return get_none_string ();
193 ARDOUR::get_jack_latency_string (string samplerate, float periods, string period_size)
195 uint32_t rate = atoi (samplerate);
196 float psize = atof (period_size);
199 snprintf (buf, sizeof(buf), "%.1fmsec", (periods * psize) / (rate/1000.0));
205 get_jack_command_line_audio_driver_name (const string& driver_name, string& command_line_name)
207 using namespace ARDOUR;
208 if (driver_name == portaudio_driver_name) {
209 command_line_name = portaudio_driver_command_line_name;
211 } else if (driver_name == coreaudio_driver_name) {
212 command_line_name = coreaudio_driver_command_line_name;
214 } else if (driver_name == alsa_driver_name) {
215 command_line_name = alsa_driver_command_line_name;
217 } else if (driver_name == oss_driver_name) {
218 command_line_name = oss_driver_command_line_name;
220 } else if (driver_name == freebob_driver_name) {
221 command_line_name = freebob_driver_command_line_name;
223 } else if (driver_name == ffado_driver_name) {
224 command_line_name = ffado_driver_command_line_name;
226 } else if (driver_name == netjack_driver_name) {
227 command_line_name = netjack_driver_command_line_name;
229 } else if (driver_name == dummy_driver_name) {
230 command_line_name = dummy_driver_command_line_name;
237 get_jack_command_line_audio_device_name (const string& driver_name,
238 const string& device_name, string& command_line_device_name)
240 using namespace ARDOUR;
241 device_map_t devices;
243 get_jack_device_names_for_audio_driver (driver_name, devices);
245 for (device_map_t::const_iterator i = devices.begin (); i != devices.end(); ++i) {
246 if (i->first == device_name) {
247 command_line_device_name = i->second;
255 get_jack_command_line_dither_mode (const string& dither_mode, string& command_line_dither_mode)
257 using namespace ARDOUR;
259 if (dither_mode == _("Triangular")) {
260 command_line_dither_mode = "triangular";
262 } else if (dither_mode == _("Rectangular")) {
263 command_line_dither_mode = "rectangular";
265 } else if (dither_mode == _("Shaped")) {
266 command_line_dither_mode = "shaped";
274 ARDOUR::get_jack_alsa_device_names (device_map_t& devices)
277 get_alsa_audio_device_names(devices);
279 /* silence a compiler unused variable warning */
286 getDeviceUIDFromID( AudioDeviceID id, char *name, size_t nsize)
288 UInt32 size = sizeof(CFStringRef);
290 OSStatus res = AudioDeviceGetProperty(id, 0, false,
291 kAudioDevicePropertyDeviceUID, &size, &UI);
293 CFStringGetCString(UI,name,nsize,CFStringGetSystemEncoding());
300 ARDOUR::get_jack_coreaudio_device_names (device_map_t& devices)
303 // Find out how many Core Audio devices are there, if any...
304 // (code snippet gently "borrowed" from St?hane Letz jackdmp;)
307 UInt32 outSize = sizeof(isWritable);
309 err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
310 &outSize, &isWritable);
312 // Calculate the number of device available...
313 int numCoreDevices = outSize / sizeof(AudioDeviceID);
314 // Make space for the devices we are about to get...
315 AudioDeviceID *coreDeviceIDs = new AudioDeviceID [numCoreDevices];
316 err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
317 &outSize, (void *) coreDeviceIDs);
319 // Look for the CoreAudio device name...
320 char coreDeviceName[256];
323 for (int i = 0; i < numCoreDevices; i++) {
325 nameSize = sizeof (coreDeviceName);
327 /* enforce duplex devices only */
329 err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
330 0, true, kAudioDevicePropertyStreams,
331 &outSize, &isWritable);
333 if (err != noErr || outSize == 0) {
337 err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
338 0, false, kAudioDevicePropertyStreams,
339 &outSize, &isWritable);
341 if (err != noErr || outSize == 0) {
345 err = AudioDeviceGetPropertyInfo(coreDeviceIDs[i],
346 0, true, kAudioDevicePropertyDeviceName,
347 &outSize, &isWritable);
349 err = AudioDeviceGetProperty(coreDeviceIDs[i],
350 0, true, kAudioDevicePropertyDeviceName,
351 &nameSize, (void *) coreDeviceName);
353 char drivername[128];
355 // this returns the unique id for the device
356 // that must be used on the commandline for jack
358 if (getDeviceUIDFromID(coreDeviceIDs[i], drivername, sizeof (drivername)) == noErr) {
359 devices.insert (make_pair (coreDeviceName, drivername));
365 delete [] coreDeviceIDs;
368 /* silence a compiler unused variable warning */
374 ARDOUR::get_jack_portaudio_device_names (device_map_t& devices)
376 #if (defined PLATFORM_WINDOWS && defined HAVE_PORTAUDIO)
377 if (Pa_Initialize() != paNoError) {
381 for (PaDeviceIndex i = 0; i < Pa_GetDeviceCount (); ++i) {
383 string readable_name;
384 string jack_device_name;
385 const PaDeviceInfo* device_info = Pa_GetDeviceInfo(i);
387 if (device_info != NULL) { // it should never be ?
388 api_name = Pa_GetHostApiInfo (device_info->hostApi)->name;
389 readable_name = api_name + " " + device_info->name;
390 jack_device_name = api_name + "::" + device_info->name;
391 devices.insert (make_pair (readable_name, jack_device_name));
396 /* silence a compiler unused variable warning */
402 ARDOUR::get_jack_oss_device_names (device_map_t& devices)
404 devices.insert (make_pair (default_device_name, default_device_name));
408 ARDOUR::get_jack_freebob_device_names (device_map_t& devices)
410 devices.insert (make_pair (default_device_name, default_device_name));
414 ARDOUR::get_jack_ffado_device_names (device_map_t& devices)
416 devices.insert (make_pair (default_device_name, default_device_name));
420 ARDOUR::get_jack_netjack_device_names (device_map_t& devices)
422 devices.insert (make_pair (default_device_name, default_device_name));
426 ARDOUR::get_jack_dummy_device_names (device_map_t& devices)
428 devices.insert (make_pair (default_device_name, default_device_name));
432 ARDOUR::get_jack_device_names_for_audio_driver (const string& driver_name, device_map_t& devices)
436 if (driver_name == portaudio_driver_name) {
437 get_jack_portaudio_device_names (devices);
438 } else if (driver_name == coreaudio_driver_name) {
439 get_jack_coreaudio_device_names (devices);
440 } else if (driver_name == alsa_driver_name) {
441 get_jack_alsa_device_names (devices);
442 } else if (driver_name == oss_driver_name) {
443 get_jack_oss_device_names (devices);
444 } else if (driver_name == freebob_driver_name) {
445 get_jack_freebob_device_names (devices);
446 } else if (driver_name == ffado_driver_name) {
447 get_jack_ffado_device_names (devices);
448 } else if (driver_name == netjack_driver_name) {
449 get_jack_netjack_device_names (devices);
450 } else if (driver_name == dummy_driver_name) {
451 get_jack_dummy_device_names (devices);
454 return !devices.empty();
458 std::vector<std::string>
459 ARDOUR::get_jack_device_names_for_audio_driver (const string& driver_name)
461 std::vector<std::string> readable_names;
462 device_map_t devices;
464 get_jack_device_names_for_audio_driver (driver_name, devices);
466 for (device_map_t::const_iterator i = devices.begin (); i != devices.end(); ++i) {
467 readable_names.push_back (i->first);
470 return readable_names;
474 ARDOUR::get_jack_audio_driver_supports_two_devices (const string& driver)
476 return (driver == alsa_driver_name || driver == oss_driver_name);
480 ARDOUR::get_jack_audio_driver_supports_latency_adjustment (const string& driver)
482 return (driver == alsa_driver_name || driver == coreaudio_driver_name ||
483 driver == ffado_driver_name || driver == portaudio_driver_name);
487 ARDOUR::get_jack_audio_driver_supports_setting_period_count (const string& driver)
489 return !(driver == dummy_driver_name || driver == coreaudio_driver_name ||
490 driver == portaudio_driver_name);
494 ARDOUR::get_jack_server_application_names (std::vector<std::string>& server_names)
496 #ifdef PLATFORM_WINDOWS
497 server_names.push_back ("jackd.exe");
499 server_names.push_back ("jackd");
500 server_names.push_back ("jackdmp");
502 return !server_names.empty();
506 ARDOUR::set_path_env_for_jack_autostart (const vector<std::string>& dirs)
509 // push it back into the environment so that auto-started JACK can find it.
510 // XXX why can't we just expect OS X users to have PATH set correctly? we can't ...
511 setenv ("PATH", Searchpath(dirs).to_string().c_str(), 1);
513 /* silence a compiler unused variable warning */
519 ARDOUR::get_jack_server_dir_paths (vector<std::string>& server_dir_paths)
522 /* this magic lets us finds the path to the OSX bundle, and then
523 we infer JACK's location from there
526 char execpath[MAXPATHLEN+1];
527 uint32_t pathsz = sizeof (execpath);
529 _NSGetExecutablePath (execpath, &pathsz);
531 server_dir_paths.push_back (Glib::path_get_dirname (execpath));
534 Searchpath sp(string(g_getenv("PATH")));
536 #ifdef PLATFORM_WINDOWS
537 // N.B. The #define (immediately below) can be safely removed once we know that this code builds okay with mingw
539 IShellLinkA *pISL = NULL;
540 IPersistFile *ppf = NULL;
542 // Mixbus creates a Windows shortcut giving the location of its
543 // own (bundled) version of Jack. Let's see if that shortcut exists
544 if (SUCCEEDED (CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pISL)))
546 if (SUCCEEDED (pISL->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf)))
548 char target_path[MAX_PATH];
549 char shortcut_pathA[MAX_PATH];
550 WCHAR shortcut_pathW[MAX_PATH];
552 // Our Windows installer should have created a shortcut to the Jack
553 // server so let's start by finding out what drive it got installed on
554 if (char *env_path = getenv ("windir"))
556 strcpy (shortcut_pathA, env_path);
557 shortcut_pathA[2] = '\0'; // Gives us just the drive letter and colon
560 strcpy (shortcut_pathA, "C:");
562 strcat (shortcut_pathA, "\\Program Files (x86)\\Jack\\Start Jack.lnk");
564 MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, shortcut_pathA, -1, shortcut_pathW, MAX_PATH);
566 // If it did, load the shortcut into our persistent file
567 if (SUCCEEDED (ppf->Load(shortcut_pathW, 0)))
569 // Read the target information from the shortcut object
570 if (S_OK == (pISL->GetPath (target_path, MAX_PATH, NULL, SLGP_UNCPRIORITY)))
572 char *p = strrchr (target_path, '\\');
577 sp.push_back (target_path);
591 gchar *install_dir = g_win32_get_package_installation_directory_of_module (NULL);
593 sp.push_back (install_dir);
594 g_free (install_dir);
596 // don't try and use a system wide JACK install yet.
599 sp.push_back ("/usr/bin");
600 sp.push_back ("/bin");
601 sp.push_back ("/usr/local/bin");
602 sp.push_back ("/opt/local/bin");
606 std::copy (sp.begin(), sp.end(), std::back_inserter(server_dir_paths));
608 return !server_dir_paths.empty();
612 ARDOUR::get_jack_server_paths (const vector<std::string>& server_dir_paths,
613 const vector<string>& server_names,
614 vector<std::string>& server_paths)
616 for (vector<string>::const_iterator i = server_names.begin(); i != server_names.end(); ++i) {
617 find_files_matching_pattern (server_paths, server_dir_paths, *i);
619 return !server_paths.empty();
623 ARDOUR::get_jack_server_paths (vector<std::string>& server_paths)
625 vector<std::string> server_dirs;
627 if (!get_jack_server_dir_paths (server_dirs)) {
631 vector<string> server_names;
633 if (!get_jack_server_application_names (server_names)) {
637 if (!get_jack_server_paths (server_dirs, server_names, server_paths)) {
641 return !server_paths.empty();
645 ARDOUR::get_jack_default_server_path (std::string& server_path)
647 vector<std::string> server_paths;
649 if (!get_jack_server_paths (server_paths)) {
653 server_path = server_paths.front ();
658 quote_string (const string& str)
660 return "\"" + str + "\"";
663 ARDOUR::JackCommandLineOptions::JackCommandLineOptions ()
670 , unlock_gui_libs(false)
681 , hardware_metering(false)
682 , hardware_monitoring(false)
692 ARDOUR::get_jack_command_line_string (JackCommandLineOptions& options, string& command_line, bool for_latency_measurement)
696 args.push_back (options.server_path);
698 #ifdef PLATFORM_WINDOWS
699 // must use sync mode on windows
700 args.push_back ("-S");
702 // this needs to be added now on windows
703 if (!options.midi_driver.empty () && options.midi_driver != get_none_string ()) {
704 args.push_back ("-X");
705 args.push_back (options.midi_driver);
709 /* XXX hack to enforce qjackctl-like behaviour */
710 if (options.timeout == 0) {
711 options.timeout = 200;
714 if (options.timeout) {
715 args.push_back ("-t");
716 args.push_back (to_string (options.timeout, std::dec));
719 if (options.no_mlock) {
720 args.push_back ("-m");
723 args.push_back ("-p");
724 args.push_back (to_string(options.ports_max, std::dec));
726 if (options.realtime) {
727 args.push_back ("-R");
728 if (options.priority != 0) {
729 args.push_back ("-P");
730 args.push_back (to_string(options.priority, std::dec));
733 args.push_back ("-r");
736 if (options.unlock_gui_libs) {
737 args.push_back ("-u");
740 if (options.verbose) {
741 args.push_back ("-v");
744 if (options.temporary) {
745 args.push_back ("-T");
748 if (options.driver == alsa_driver_name) {
749 if (options.midi_driver == alsa_seq_midi_driver_name) {
750 args.push_back ("-X");
751 args.push_back ("alsa_midi");
752 } else if (options.midi_driver == alsa_raw_midi_driver_name) {
753 args.push_back ("-X");
754 args.push_back ("alsarawmidi");
758 string command_line_driver_name;
760 string command_line_input_device_name;
761 string command_line_output_device_name;
763 if (!get_jack_command_line_audio_driver_name (options.driver, command_line_driver_name)) {
767 args.push_back ("-d");
768 args.push_back (command_line_driver_name);
770 if (options.driver != dummy_driver_name) {
771 if (options.output_device.empty() && options.input_device.empty()) {
776 if (!get_jack_command_line_audio_device_name (options.driver,
777 options.input_device, command_line_input_device_name)) {
781 if (!get_jack_command_line_audio_device_name (options.driver,
782 options.output_device, command_line_output_device_name)) {
786 if (options.input_device.empty()) {
788 if (options.output_device.empty()) {
791 args.push_back ("-P");
792 } else if (options.output_device.empty()) {
794 if (options.input_device.empty()) {
797 args.push_back ("-C");
798 } else if (options.input_device != options.output_device) {
799 // capture and playback on two devices if supported
800 if (get_jack_audio_driver_supports_two_devices (options.driver)) {
801 args.push_back ("-C");
802 args.push_back (command_line_input_device_name);
803 args.push_back ("-P");
804 args.push_back (command_line_output_device_name);
810 if (options.input_channels) {
811 args.push_back ("-i");
812 args.push_back (to_string (options.input_channels, std::dec));
815 if (options.output_channels) {
816 args.push_back ("-o");
817 args.push_back (to_string (options.output_channels, std::dec));
820 if (get_jack_audio_driver_supports_setting_period_count (options.driver)) {
821 args.push_back ("-n");
822 args.push_back (to_string (options.num_periods, std::dec));
825 // jackd dummy backend
826 if (options.input_channels) {
827 args.push_back ("-C");
828 args.push_back (to_string (options.input_channels, std::dec));
831 if (options.output_channels) {
832 args.push_back ("-P");
833 args.push_back (to_string (options.output_channels, std::dec));
837 args.push_back ("-r");
838 args.push_back (to_string (options.samplerate, std::dec));
840 args.push_back ("-p");
841 args.push_back (to_string (options.period_size, std::dec));
843 if (!for_latency_measurement && get_jack_audio_driver_supports_latency_adjustment (options.driver)) {
844 if (options.input_latency) {
845 args.push_back ("-I");
846 args.push_back (to_string (options.input_latency, std::dec));
848 if (options.output_latency) {
849 args.push_back ("-O");
850 args.push_back (to_string (options.output_latency, std::dec));
854 if (options.driver != dummy_driver_name) {
855 if (options.input_device == options.output_device && options.input_device != default_device_name) {
856 args.push_back ("-d");
857 args.push_back (command_line_input_device_name);
861 if (options.driver == alsa_driver_name) {
862 if (options.hardware_metering) {
863 args.push_back ("-M");
865 if (options.hardware_monitoring) {
866 args.push_back ("-H");
869 string command_line_dither_mode;
870 if (get_jack_command_line_dither_mode (options.dither_mode, command_line_dither_mode)) {
871 args.push_back ("-z");
872 args.push_back (command_line_dither_mode);
874 if (options.force16_bit) {
875 args.push_back ("-S");
877 if (options.soft_mode) {
878 args.push_back ("-s");
882 if (options.driver == alsa_driver_name || options.driver == coreaudio_driver_name) {
884 if (options.midi_driver != alsa_seq_midi_driver_name) {
885 if (!options.midi_driver.empty() && options.midi_driver != get_none_string ()) {
886 args.push_back ("-X");
887 args.push_back (options.midi_driver);
894 for (vector<string>::const_iterator i = args.begin(); i != args.end();) {
895 if (i->find_first_of(' ') != string::npos) {
896 oss << "\"" << *i << "\"";
900 if (++i != args.end()) oss << ' ';
903 command_line = oss.str();
908 ARDOUR::get_jack_server_config_file_name ()
914 ARDOUR::get_jack_server_user_config_dir_path ()
916 return Glib::get_home_dir ();
920 ARDOUR::get_jack_server_user_config_file_path ()
922 return Glib::build_filename (get_jack_server_user_config_dir_path (), get_jack_server_config_file_name ());
926 ARDOUR::write_jack_config_file (const std::string& config_file_path, const string& command_line)
928 ofstream jackdrc (config_file_path.c_str());
931 error << string_compose (_("cannot open JACK rc file %1 to store parameters"), config_file_path) << endmsg;
935 jackdrc << command_line << endl;
941 ARDOUR::enumerate_midi_options ()
943 if (midi_options.empty()) {
945 midi_options.push_back (make_pair (_("(legacy) ALSA raw devices"), alsaraw_midi_driver_name));
946 midi_options.push_back (make_pair (_("(legacy) ALSA sequencer"), alsaseq_midi_driver_name));
947 midi_options.push_back (make_pair (_("ALSA (JACK1, 0.124 and later)"), alsa_seq_midi_driver_name));
948 midi_options.push_back (make_pair (_("ALSA (JACK2, 1.9.8 and later)"), alsa_raw_midi_driver_name));
950 #if (defined PLATFORM_WINDOWS && defined HAVE_PORTAUDIO)
951 /* Windows folks: what name makes sense here? Are there other
954 midi_options.push_back (make_pair (_("System MIDI (MME)"), winmme_midi_driver_name));
957 midi_options.push_back (make_pair (_("CoreMIDI"), coremidi_midi_driver_name));
963 for (MidiOptions::const_iterator i = midi_options.begin(); i != midi_options.end(); ++i) {
964 v.push_back (i->first);
967 v.push_back (get_none_string());
973 ARDOUR::set_midi_option (ARDOUR::JackCommandLineOptions& options, const string& opt)
975 if (opt.empty() || opt == get_none_string()) {
976 options.midi_driver = "";
980 for (MidiOptions::const_iterator i = midi_options.begin(); i != midi_options.end(); ++i) {
981 if (i->first == opt) {
982 options.midi_driver = i->second;