mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
add JACK backend support for MIDI option discovery
This commit is contained in:
parent
2308291e59
commit
1bd04f8bf3
4 changed files with 78 additions and 0 deletions
|
|
@ -490,6 +490,8 @@ JACKAudioBackend::setup_jack_startup_command ()
|
|||
options.realtime = true;
|
||||
options.ports_max = 2048;
|
||||
|
||||
ARDOUR::set_midi_option (options, _target_midi_option);
|
||||
|
||||
/* this must always be true for any server instance we start ourselves
|
||||
*/
|
||||
|
||||
|
|
@ -1110,3 +1112,16 @@ JACKAudioBackend::launch_control_app ()
|
|||
args.push_back (appname);
|
||||
Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH);
|
||||
}
|
||||
|
||||
vector<string>
|
||||
JACKAudioBackend::enumerate_midi_options () const
|
||||
{
|
||||
return ARDOUR::enumerate_midi_options ();
|
||||
}
|
||||
|
||||
int
|
||||
JACKAudioBackend::set_midi_option (const string& opt)
|
||||
{
|
||||
_target_midi_option = opt;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ class JACKAudioBackend : public AudioBackend {
|
|||
|
||||
/* MIDI */
|
||||
|
||||
std::vector<std::string> enumerate_midi_options () const;
|
||||
int set_midi_option (const std::string&);
|
||||
|
||||
int midi_event_get (pframes_t& timestamp, size_t& size, uint8_t** buf, void* port_buffer, uint32_t event_index);
|
||||
int midi_event_put (void* port_buffer, pframes_t timestamp, const uint8_t* buffer, size_t size);
|
||||
uint32_t get_midi_event_count (void* port_buffer);
|
||||
|
|
@ -237,6 +240,7 @@ class JACKAudioBackend : public AudioBackend {
|
|||
uint32_t _target_systemic_output_latency;
|
||||
uint32_t _current_sample_rate;
|
||||
uint32_t _current_buffer_size;
|
||||
std::string _target_midi_option;
|
||||
|
||||
typedef std::set<std::string> DeviceList;
|
||||
typedef std::map<std::string,DeviceList> DriverDeviceMap;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,8 @@ namespace {
|
|||
const char * const default_device_name = X_("Default");
|
||||
}
|
||||
|
||||
static ARDOUR::MidiOptions midi_options;
|
||||
|
||||
std::string
|
||||
get_none_string ()
|
||||
{
|
||||
|
|
@ -846,6 +848,9 @@ ARDOUR::get_jack_command_line_string (JackCommandLineOptions& options, string& c
|
|||
if (options.soft_mode) {
|
||||
args.push_back ("-s");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.driver == alsa_driver_name || options.driver == coreaudio_driver_name) {
|
||||
|
||||
if (!options.midi_driver.empty() && options.midi_driver != get_none_string ()) {
|
||||
args.push_back ("-X");
|
||||
|
|
@ -900,3 +905,52 @@ ARDOUR::write_jack_config_file (const std::string& config_file_path, const strin
|
|||
jackdrc.close ();
|
||||
return true;
|
||||
}
|
||||
|
||||
vector<string>
|
||||
ARDOUR::enumerate_midi_options ()
|
||||
{
|
||||
if (midi_options.empty()) {
|
||||
#ifdef HAVE_ALSA
|
||||
midi_options.push_back (make_pair (_("ALSA raw devices"), alsaraw_midi_driver_name));
|
||||
midi_options.push_back (make_pair (_("ALSA sequencer"), alsaseq_midi_driver_name));
|
||||
#endif
|
||||
#ifdef HAVE_PORTAUDIO
|
||||
/* Windows folks: what name makes sense here? Are there other
|
||||
choices as well ?
|
||||
*/
|
||||
midi_options.push_back (make_pair (_("Multimedia Extension"), winmme_midi_driver_name));
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
midi_options.push_back (make_pair (_("CoreMIDI"), coremidi_midi_driver_name));
|
||||
#endif
|
||||
}
|
||||
|
||||
vector<string> v;
|
||||
|
||||
v.push_back (get_none_string());
|
||||
|
||||
for (MidiOptions::const_iterator i = midi_options.begin(); i != midi_options.end(); ++i) {
|
||||
v.push_back (i->first);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
int
|
||||
ARDOUR::set_midi_option (ARDOUR::JackCommandLineOptions& options, const string& opt)
|
||||
{
|
||||
if (opt.empty() || opt == get_none_string()) {
|
||||
options.midi_driver = "";
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (MidiOptions::const_iterator i = midi_options.begin(); i != midi_options.end(); ++i) {
|
||||
if (i->first == opt) {
|
||||
options.midi_driver = i->second;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,6 +180,8 @@ namespace ARDOUR {
|
|||
*/
|
||||
bool get_jack_default_server_path (std::string& server_path);
|
||||
|
||||
typedef std::vector<std::pair<std::string,std::string> > MidiOptions;
|
||||
|
||||
/**
|
||||
* @return The name of the jack server config file
|
||||
*/
|
||||
|
|
@ -228,6 +230,9 @@ namespace ARDOUR {
|
|||
std::string midi_driver;
|
||||
};
|
||||
|
||||
std::vector<std::string> enumerate_midi_options ();
|
||||
int set_midi_option (ARDOUR::JackCommandLineOptions&, const std::string& opt);
|
||||
|
||||
/**
|
||||
* @return true if able to build a valid command line based on options
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue