2 Copyright (C) 2013 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <boost/scoped_ptr.hpp>
25 #include <glibmm/timer.h>
26 #include <glibmm/spawn.h>
28 #include "pbd/error.h"
30 #include "ardour/audioengine.h"
31 #include "ardour/session.h"
32 #include "ardour/types.h"
34 #include "jack_audiobackend.h"
35 #include "jack_connection.h"
36 #include "jack_utils.h"
37 #include "jack_session.h"
41 using namespace ARDOUR;
47 #define GET_PRIVATE_JACK_POINTER(localvar) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return; }
48 #define GET_PRIVATE_JACK_POINTER_RET(localvar,r) jack_client_t* localvar = _jack_connection->jack(); if (!(localvar)) { return r; }
50 JACKAudioBackend::JACKAudioBackend (AudioEngine& e, AudioBackendInfo& info, boost::shared_ptr<JackConnection> jc)
51 : AudioBackend (e, info)
52 , _jack_connection (jc)
54 , _freewheeling (false)
55 , _target_sample_rate (48000)
56 , _target_buffer_size (1024)
57 , _target_num_periods (2)
58 , _target_interleaved (false)
59 , _target_input_channels (0)
60 , _target_output_channels (0)
61 , _target_systemic_input_latency (0)
62 , _target_systemic_output_latency (0)
63 , _current_sample_rate (0)
64 , _current_buffer_size (0)
67 _jack_connection->Connected.connect_same_thread (jack_connection_connection, boost::bind (&JACKAudioBackend::when_connected_to_jack, this));
68 _jack_connection->Disconnected.connect_same_thread (disconnect_connection, boost::bind (&JACKAudioBackend::disconnected, this, _1));
71 JACKAudioBackend::~JACKAudioBackend()
76 JACKAudioBackend::name() const
82 JACKAudioBackend::private_handle() const
84 return _jack_connection->jack();
88 JACKAudioBackend::available() const
90 return (private_handle() != 0);
94 JACKAudioBackend::is_realtime () const
96 GET_PRIVATE_JACK_POINTER_RET (_priv_jack,false);
97 return jack_is_realtime (_priv_jack);
101 JACKAudioBackend::requires_driver_selection() const
107 JACKAudioBackend::enumerate_drivers () const
109 vector<string> currently_available;
110 get_jack_audio_driver_names (currently_available);
111 return currently_available;
115 JACKAudioBackend::set_driver (const std::string& name)
117 _target_driver = name;
121 vector<AudioBackend::DeviceStatus>
122 JACKAudioBackend::enumerate_devices () const
124 vector<string> currently_available = get_jack_device_names_for_audio_driver (_target_driver);
125 vector<DeviceStatus> statuses;
127 if (all_devices.find (_target_driver) == all_devices.end()) {
128 all_devices.insert (make_pair (_target_driver, std::set<string>()));
131 /* store every device we've found, by driver name.
133 * This is so we do not confuse ALSA, FFADO, netjack etc. devices
137 DeviceList& all (all_devices[_target_driver]);
139 for (vector<string>::const_iterator d = currently_available.begin(); d != currently_available.end(); ++d) {
143 for (DeviceList::const_iterator d = all.begin(); d != all.end(); ++d) {
144 if (find (currently_available.begin(), currently_available.end(), *d) == currently_available.end()) {
145 statuses.push_back (DeviceStatus (*d, false));
147 statuses.push_back (DeviceStatus (*d, false));
155 JACKAudioBackend::available_sample_rates (const string& device) const
159 if (device == _target_device && available()) {
160 f.push_back (sample_rate());
164 /* if JACK is not already running, just list a bunch of reasonable
165 values and let the future sort it all out.
168 f.push_back (8000.0);
169 f.push_back (16000.0);
170 f.push_back (24000.0);
171 f.push_back (32000.0);
172 f.push_back (44100.0);
173 f.push_back (48000.0);
174 f.push_back (88200.0);
175 f.push_back (96000.0);
176 f.push_back (192000.0);
177 f.push_back (384000.0);
183 JACKAudioBackend::available_buffer_sizes (const string& device) const
187 if (device == _target_device && available()) {
188 s.push_back (buffer_size());
207 std::vector<uint32_t>
208 JACKAudioBackend::available_period_sizes (const std::string& driver) const
211 if (ARDOUR::get_jack_audio_driver_supports_setting_period_count (driver)) {
219 JACKAudioBackend::available_input_channel_count (const string& /*device*/) const
225 JACKAudioBackend::available_output_channel_count (const string& /*device*/) const
230 /* -- parameter setting -- */
233 JACKAudioBackend::set_device_name (const string& dev)
236 /* need to stop and restart JACK for this to work, at present */
240 _target_device = dev;
245 JACKAudioBackend::set_sample_rate (float sr)
248 _target_sample_rate = sr;
252 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
254 if (sr == jack_get_sample_rate (_priv_jack)) {
262 JACKAudioBackend::set_peridod_size (uint32_t nperiods)
265 _target_num_periods = nperiods;
272 JACKAudioBackend::set_buffer_size (uint32_t nframes)
275 _target_buffer_size = nframes;
279 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
281 if (nframes == jack_get_buffer_size (_priv_jack)) {
285 return jack_set_buffer_size (_priv_jack, nframes);
289 JACKAudioBackend::set_interleaved (bool yn)
291 /* as far as JACK clients are concerned, the hardware is always
301 JACKAudioBackend::set_input_channels (uint32_t cnt)
305 /* can't set a real value for this while JACK runs */
310 _target_input_channels = cnt;
316 JACKAudioBackend::set_output_channels (uint32_t cnt)
320 /* can't set a real value for this while JACK runs */
325 _target_output_channels = cnt;
331 JACKAudioBackend::set_systemic_input_latency (uint32_t l)
334 /* can't do this while JACK runs */
338 _target_systemic_input_latency = l;
344 JACKAudioBackend::set_systemic_output_latency (uint32_t l)
347 /* can't do this while JACK runs */
351 _target_systemic_output_latency = l;
356 /* --- Parameter retrieval --- */
359 JACKAudioBackend::device_name () const
361 if (!_jack_connection->in_control()) {
362 return "???"; // JACK has no way (as of fall 2013) to return
366 return _target_device;
370 JACKAudioBackend::driver_name() const
372 if (!_jack_connection->in_control()) {
373 return "???"; // JACK has no way (as of fall 2013) to return
377 return _target_driver;
381 JACKAudioBackend::sample_rate () const
383 if (!_jack_connection->in_control()) {
385 return _current_sample_rate;
387 return _jack_connection->probed_sample_rate ();
390 return _target_sample_rate;
394 JACKAudioBackend::buffer_size () const
396 if (!_jack_connection->in_control()) {
398 return _current_buffer_size;
400 return _jack_connection->probed_buffer_size ();
403 return _target_buffer_size;
407 JACKAudioBackend::period_size () const
409 return _target_num_periods;
413 JACKAudioBackend::interleaved () const
419 JACKAudioBackend::midi_option () const
421 return _target_midi_option;
425 JACKAudioBackend::input_channels () const
427 if (!_jack_connection->in_control()) {
429 return n_physical (JackPortIsInput).n_audio();
435 return n_physical (JackPortIsInput).n_audio();
437 return _target_input_channels;
443 JACKAudioBackend::output_channels () const
445 if (!_jack_connection->in_control()) {
447 return n_physical (JackPortIsOutput).n_audio();
453 return n_physical (JackPortIsOutput).n_audio();
455 return _target_output_channels;
461 JACKAudioBackend::systemic_input_latency () const
463 return _target_systemic_output_latency;
467 JACKAudioBackend::systemic_output_latency () const
469 return _target_systemic_output_latency;
473 JACKAudioBackend::raw_buffer_size(DataType t)
475 std::map<DataType,size_t>::const_iterator s = _raw_buffer_sizes.find(t);
476 return (s != _raw_buffer_sizes.end()) ? s->second : 0;
480 JACKAudioBackend::setup_jack_startup_command (bool for_latency_measurement)
482 /* first we map the parameters that have been set onto a
483 * JackCommandLineOptions object.
486 JackCommandLineOptions options;
488 get_jack_default_server_path (options.server_path);
489 options.driver = _target_driver;
490 options.samplerate = _target_sample_rate;
491 options.period_size = _target_buffer_size;
492 options.num_periods = _target_num_periods;
493 options.input_device = _target_device;
494 options.output_device = _target_device;
495 if (for_latency_measurement) {
496 options.input_latency = 0;
497 options.output_latency = 0;
499 options.input_latency = _target_systemic_input_latency;
500 options.output_latency = _target_systemic_output_latency;
502 options.input_channels = _target_input_channels;
503 options.output_channels = _target_output_channels;
504 if (_target_sample_format == FormatInt16) {
505 options.force16_bit = _target_sample_format;
507 options.realtime = true;
508 options.ports_max = 2048;
510 ARDOUR::set_midi_option (options, _target_midi_option);
512 /* this must always be true for any server instance we start ourselves
515 options.temporary = true;
519 if (!get_jack_command_line_string (options, cmdline)) {
520 /* error, somehow - we will still try to start JACK
521 * automatically but it will be without our preferred options
523 std::cerr << "get_jack_command_line_string () failed: using default settings." << std::endl;
527 std::cerr << "JACK command line will be: " << cmdline << std::endl;
529 write_jack_config_file (get_jack_server_user_config_file_path(), cmdline);
532 /* ---- BASIC STATE CONTROL API: start/stop/pause/freewheel --- */
535 JACKAudioBackend::_start (bool for_latency_measurement)
539 if (_jack_connection->in_control()) {
540 /* we will be starting JACK, so set up the
541 command that JACK will use when it (auto-)starts
543 setup_jack_startup_command (for_latency_measurement);
546 if (_jack_connection->open ()) {
551 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
553 /* get the buffer size and sample rates established */
555 jack_sample_rate_callback (jack_get_sample_rate (_priv_jack));
556 jack_bufsize_callback (jack_get_buffer_size (_priv_jack));
558 /* Now that we have buffer size and sample rate established, the engine
559 can go ahead and do its stuff
562 if (engine.reestablish_ports ()) {
563 error << _("Could not re-establish ports after connecting to JACK") << endmsg;
567 if (!jack_port_type_get_buffer_size) {
568 warning << _("This version of JACK is old - you should upgrade to a newer version that supports jack_port_type_get_buffer_size()") << endmsg;
571 set_jack_callbacks ();
573 if (jack_activate (_priv_jack) == 0) {
576 // error << _("cannot activate JACK client") << endmsg;
579 engine.reconnect_ports ();
585 JACKAudioBackend::stop ()
587 _running = false; // no 'engine halted message'.
588 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
590 _jack_connection->close ();
592 _current_buffer_size = 0;
593 _current_sample_rate = 0;
595 _raw_buffer_sizes.clear();
601 JACKAudioBackend::freewheel (bool onoff)
603 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
605 if (onoff == _freewheeling) {
606 /* already doing what has been asked for */
611 if (jack_set_freewheel (_priv_jack, onoff) == 0) {
612 _freewheeling = onoff;
619 /* --- TRANSPORT STATE MANAGEMENT --- */
622 JACKAudioBackend::transport_stop ()
624 GET_PRIVATE_JACK_POINTER (_priv_jack);
625 jack_transport_stop (_priv_jack);
629 JACKAudioBackend::transport_start ()
631 GET_PRIVATE_JACK_POINTER (_priv_jack);
632 jack_transport_start (_priv_jack);
636 JACKAudioBackend::transport_locate (framepos_t where)
638 GET_PRIVATE_JACK_POINTER (_priv_jack);
639 jack_transport_locate (_priv_jack, where);
643 JACKAudioBackend::transport_frame () const
645 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
646 return jack_get_current_transport_frame (_priv_jack);
650 JACKAudioBackend::transport_state () const
652 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, ((TransportState) JackTransportStopped));
654 return (TransportState) jack_transport_query (_priv_jack, &pos);
658 JACKAudioBackend::set_time_master (bool yn)
660 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
662 return jack_set_timebase_callback (_priv_jack, 0, _jack_timebase_callback, this);
664 return jack_release_timebase (_priv_jack);
671 JACKAudioBackend::get_sync_offset (pframes_t& offset) const
674 #ifdef HAVE_JACK_VIDEO_SUPPORT
676 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, false);
681 (void) jack_transport_query (_priv_jack, &pos);
683 if (pos.valid & JackVideoFrameOffset) {
684 offset = pos.video_offset;
697 JACKAudioBackend::sample_time ()
699 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
700 return jack_frame_time (_priv_jack);
704 JACKAudioBackend::sample_time_at_cycle_start ()
706 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
707 return jack_last_frame_time (_priv_jack);
711 JACKAudioBackend::samples_since_cycle_start ()
713 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
714 return jack_frames_since_cycle_start (_priv_jack);
720 ardour_jack_error (const char* msg)
722 error << "JACK: " << msg << endmsg;
726 JACKAudioBackend::set_jack_callbacks ()
728 GET_PRIVATE_JACK_POINTER (_priv_jack);
730 jack_set_thread_init_callback (_priv_jack, AudioEngine::thread_init_callback, 0);
732 jack_set_process_thread (_priv_jack, _process_thread, this);
733 jack_set_sample_rate_callback (_priv_jack, _sample_rate_callback, this);
734 jack_set_buffer_size_callback (_priv_jack, _bufsize_callback, this);
735 jack_set_xrun_callback (_priv_jack, _xrun_callback, this);
736 jack_set_sync_callback (_priv_jack, _jack_sync_callback, this);
737 jack_set_freewheel_callback (_priv_jack, _freewheel_callback, this);
739 #ifdef HAVE_JACK_SESSION
740 if( jack_set_session_callback)
741 jack_set_session_callback (_priv_jack, _session_callback, this);
744 if (jack_set_latency_callback) {
745 jack_set_latency_callback (_priv_jack, _latency_callback, this);
748 jack_set_error_function (ardour_jack_error);
752 JACKAudioBackend::_jack_timebase_callback (jack_transport_state_t state, pframes_t nframes,
753 jack_position_t* pos, int new_position, void *arg)
755 static_cast<JACKAudioBackend*> (arg)->jack_timebase_callback (state, nframes, pos, new_position);
759 JACKAudioBackend::jack_timebase_callback (jack_transport_state_t state, pframes_t nframes,
760 jack_position_t* pos, int new_position)
762 ARDOUR::Session* session = engine.session();
765 JACKSession jsession (session);
766 jsession.timebase_callback (state, nframes, pos, new_position);
771 JACKAudioBackend::_jack_sync_callback (jack_transport_state_t state, jack_position_t* pos, void* arg)
773 return static_cast<JACKAudioBackend*> (arg)->jack_sync_callback (state, pos);
777 JACKAudioBackend::jack_sync_callback (jack_transport_state_t state, jack_position_t* pos)
779 TransportState tstate;
780 bool tstate_valid = true;
783 case JackTransportRolling:
784 tstate = TransportRolling;
786 case JackTransportLooping:
787 tstate = TransportLooping;
789 case JackTransportStarting:
790 tstate = TransportStarting;
792 case JackTransportStopped:
793 tstate = TransportStopped;
796 // ignore "unofficial" states like JackTransportNetStarting (jackd2)
797 tstate_valid = false;
802 return engine.sync_callback (tstate, pos->frame);
809 JACKAudioBackend::_xrun_callback (void *arg)
811 JACKAudioBackend* jab = static_cast<JACKAudioBackend*> (arg);
812 if (jab->available()) {
813 jab->engine.Xrun (); /* EMIT SIGNAL */
819 JACKAudioBackend::_session_callback (jack_session_event_t *event, void *arg)
821 JACKAudioBackend* jab = static_cast<JACKAudioBackend*> (arg);
822 ARDOUR::Session* session = jab->engine.session();
825 JACKSession jsession (session);
826 jsession.session_event (event);
831 JACKAudioBackend::_freewheel_callback (int onoff, void *arg)
833 static_cast<JACKAudioBackend*>(arg)->freewheel_callback (onoff);
837 JACKAudioBackend::freewheel_callback (int onoff)
839 _freewheeling = onoff;
840 engine.freewheel_callback (onoff);
844 JACKAudioBackend::_latency_callback (jack_latency_callback_mode_t mode, void* arg)
846 return static_cast<JACKAudioBackend*> (arg)->jack_latency_callback (mode);
850 JACKAudioBackend::create_process_thread (boost::function<void()> f)
852 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, -1);
854 jack_native_thread_t thread_id;
855 ThreadData* td = new ThreadData (this, f, thread_stack_size());
857 if (jack_client_create_thread (_priv_jack, &thread_id, jack_client_real_time_priority (_priv_jack),
858 jack_is_realtime (_priv_jack), _start_process_thread, td)) {
862 _jack_threads.push_back(thread_id);
867 JACKAudioBackend::join_process_threads ()
871 for (std::vector<jack_native_thread_t>::const_iterator i = _jack_threads.begin ();
872 i != _jack_threads.end(); i++) {
874 #if defined(USING_JACK2_EXPANSION_OF_JACK_API) || defined __jack_systemdeps_h__
875 // jack_client is not used by JACK2's implementation
876 // also jack_client_close() leaves threads active
877 if (jack_client_stop_thread (NULL, *i) != 0)
880 if (pthread_join (*i, &status) != 0)
883 error << "AudioEngine: cannot stop process thread" << endmsg;
888 _jack_threads.clear();
894 JACKAudioBackend::in_process_thread ()
896 #if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__)
897 if (_main_thread == GetCurrentThread()) {
901 if (pthread_equal (_main_thread, pthread_self()) != 0) {
906 for (std::vector<jack_native_thread_t>::const_iterator i = _jack_threads.begin ();
907 i != _jack_threads.end(); i++) {
909 #if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__)
910 if (*i == GetCurrentThread()) {
914 if (pthread_equal (*i, pthread_self()) != 0) {
924 JACKAudioBackend::process_thread_count ()
926 return _jack_threads.size();
930 JACKAudioBackend::_start_process_thread (void* arg)
932 ThreadData* td = reinterpret_cast<ThreadData*> (arg);
933 boost::function<void()> f = td->f;
942 JACKAudioBackend::_process_thread (void *arg)
944 return static_cast<JACKAudioBackend*> (arg)->process_thread ();
948 JACKAudioBackend::process_thread ()
950 /* JACK doesn't do this for us when we use the wait API
953 #if defined COMPILER_MINGW && (!defined PTW32_VERSION || defined __jack_systemdeps_h__)
954 _main_thread = GetCurrentThread();
956 _main_thread = pthread_self ();
960 AudioEngine::thread_init_callback (this);
963 GET_PRIVATE_JACK_POINTER_RET(_priv_jack,0);
965 pframes_t nframes = jack_cycle_wait (_priv_jack);
967 if (engine.process_callback (nframes)) {
971 jack_cycle_signal (_priv_jack, 0);
978 JACKAudioBackend::_sample_rate_callback (pframes_t nframes, void *arg)
980 return static_cast<JACKAudioBackend*> (arg)->jack_sample_rate_callback (nframes);
984 JACKAudioBackend::jack_sample_rate_callback (pframes_t nframes)
986 _current_sample_rate = nframes;
987 return engine.sample_rate_change (nframes);
991 JACKAudioBackend::jack_latency_callback (jack_latency_callback_mode_t mode)
993 engine.latency_callback (mode == JackPlaybackLatency);
997 JACKAudioBackend::_bufsize_callback (pframes_t nframes, void *arg)
999 return static_cast<JACKAudioBackend*> (arg)->jack_bufsize_callback (nframes);
1003 JACKAudioBackend::jack_bufsize_callback (pframes_t nframes)
1005 /* if the size has not changed, this should be a no-op */
1007 if (nframes == _current_buffer_size) {
1011 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 1);
1013 _current_buffer_size = nframes;
1015 if (jack_port_type_get_buffer_size) {
1016 _raw_buffer_sizes[DataType::AUDIO] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_AUDIO_TYPE);
1017 _raw_buffer_sizes[DataType::MIDI] = jack_port_type_get_buffer_size (_priv_jack, JACK_DEFAULT_MIDI_TYPE);
1020 /* Old version of JACK.
1022 These crude guesses, see below where we try to get the right answers.
1024 Note that our guess for MIDI deliberatey tries to overestimate
1025 by a little. It would be nicer if we could get the actual
1026 size from a port, but we have to use this estimate in the
1027 event that there are no MIDI ports currently. If there are
1028 the value will be adjusted below.
1031 _raw_buffer_sizes[DataType::AUDIO] = nframes * sizeof (Sample);
1032 _raw_buffer_sizes[DataType::MIDI] = nframes * 4 - (nframes/2);
1035 engine.buffer_size_change (nframes);
1041 JACKAudioBackend::disconnected (const char* why)
1043 bool was_running = _running;
1046 _current_buffer_size = 0;
1047 _current_sample_rate = 0;
1050 engine.halted_callback (why); /* EMIT SIGNAL */
1055 JACKAudioBackend::dsp_load() const
1057 GET_PRIVATE_JACK_POINTER_RET(_priv_jack,0);
1058 return jack_cpu_load (_priv_jack);
1062 JACKAudioBackend::update_latencies ()
1064 GET_PRIVATE_JACK_POINTER (_priv_jack);
1065 jack_recompute_total_latencies (_priv_jack);
1069 JACKAudioBackend::n_physical (unsigned long flags) const
1073 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, c);
1075 const char ** ports = jack_get_ports (_priv_jack, NULL, NULL, JackPortIsPhysical | flags);
1078 for (uint32_t i = 0; ports[i]; ++i) {
1079 if (!strstr (ports[i], "Midi-Through")) {
1080 DataType t = port_data_type (jack_port_by_name (_priv_jack, ports[i]));
1081 if (t != DataType::NIL) {
1082 c.set (t, c.get (t) + 1);
1094 JACKAudioBackend::can_change_sample_rate_when_running () const
1100 JACKAudioBackend::can_change_buffer_size_when_running () const
1106 JACKAudioBackend::control_app_name () const
1108 /* Since JACK/ALSA really don't provide particularly integrated support
1109 for the idea of a control app to be used to control a device,
1110 allow the user to take some control themselves if necessary.
1113 const char* env_value = g_getenv ("ARDOUR_DEVICE_CONTROL_APP");
1117 if (_target_driver.empty() || _target_device.empty()) {
1121 if (_target_driver == "ALSA") {
1123 if (_target_device == "Hammerfall DSP") {
1124 appname = "hdspconf";
1125 } else if (_target_device == "M Audio Delta 1010") {
1126 appname = "mudita24";
1127 } else if (_target_device == "M2496") {
1128 appname = "mudita24";
1132 appname = env_value;
1139 JACKAudioBackend::launch_control_app ()
1141 string appname = control_app_name();
1143 if (appname.empty()) {
1144 error << string_compose (_("There is no control application for the device \"%1\""), _target_device) << endmsg;
1148 std::list<string> args;
1149 args.push_back (appname);
1150 Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH);
1154 JACKAudioBackend::enumerate_midi_options () const
1156 return ARDOUR::enumerate_midi_options ();
1160 JACKAudioBackend::set_midi_option (const string& opt)
1162 _target_midi_option = opt;
1167 JACKAudioBackend::speed_and_position (double& speed, framepos_t& position)
1169 jack_position_t pos;
1170 jack_transport_state_t state;
1173 /* this won't be called if the port engine in use is not JACK, so we do
1174 not have to worry about the type of PortEngine::private_handle()
1180 GET_PRIVATE_JACK_POINTER_RET (_priv_jack, true);
1182 state = jack_transport_query (_priv_jack, &pos);
1185 case JackTransportStopped:
1189 case JackTransportRolling:
1193 case JackTransportLooping:
1197 case JackTransportStarting:
1199 // don't adjust speed here, just leave it as it was
1202 starting = true; // jack2: JackTransportNetStarting
1203 std::cerr << "WARNING: Unknown JACK transport state: " << state << std::endl;
1206 position = pos.frame;
1211 JACKAudioBackend::reset_device ()
1213 /* XXX need to figure out what this means for JACK