Ardour  9.0-pre0-582-g084a23a80d
jack_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Paul Davis <paul@linuxaudiosystems.com>
3  *
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.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #include <stdint.h>
20 
21 #include <vector>
22 #include <map>
23 #include <string>
24 
25 namespace ARDOUR {
26 
27  // Names for the drivers on all possible systems
28  extern const char * const portaudio_driver_name;
29  extern const char * const coreaudio_driver_name;
30  extern const char * const alsa_driver_name;
31  extern const char * const oss_driver_name;
32  extern const char * const sun_driver_name;
33  extern const char * const freebob_driver_name;
34  extern const char * const ffado_driver_name;
35  extern const char * const netjack_driver_name;
36  extern const char * const dummy_driver_name;
37 
41  void get_jack_audio_driver_names (std::vector<std::string>& driver_names);
42 
46  void get_jack_default_audio_driver_name (std::string& driver_name);
47 
51  void get_jack_sample_rate_strings (std::vector<std::string>& sample_rates);
52 
57 
61  bool get_jack_sample_rate_value_from_string (const std::string& srs, uint32_t& srv);
62 
66  void get_jack_period_size_strings (std::vector<std::string>& samplerates);
67 
72 
76  bool get_jack_period_size_value_from_string (const std::string& pss, uint32_t& psv);
77 
82  void get_jack_dither_mode_strings (const std::string& driver, std::vector<std::string>& dither_modes);
83 
87  std::string get_jack_default_dither_mode (const std::string& driver);
88 
94  std::string get_jack_latency_string (std::string samplerate, float periods, std::string period_size);
95 
100  typedef std::map<std::string, std::string> device_map_t;
101 
118 
119  /*
120  * @return true if there were devices found for the driver
121  *
122  * @param driver The driver name returned by get_jack_audio_driver_names
123  * @param devices The map used to insert the drivers into, devices will be cleared before
124  * adding the available drivers
125  */
126  bool get_jack_device_names_for_audio_driver (const std::string& driver, device_map_t& devices);
127 
128  /*
129  * @return a list of readable device names for a specific driver.
130  */
131  std::vector<std::string> get_jack_device_names_for_audio_driver (const std::string& driver);
132 
137  bool get_jack_audio_driver_supports_two_devices (const std::string& driver);
138 
139  bool get_jack_audio_driver_supports_latency_adjustment (const std::string& driver);
140 
141  bool get_jack_audio_driver_supports_setting_period_count (const std::string& driver);
142 
149  bool get_jack_server_application_names (std::vector<std::string>& server_names);
150 
158  void set_path_env_for_jack_autostart (const std::vector<std::string>&);
159 
165  bool get_jack_server_dir_paths (std::vector<std::string>& server_dir_paths);
166 
172  bool get_jack_server_paths (const std::vector<std::string>& server_dir_paths,
173  const std::vector<std::string>& server_names,
174  std::vector<std::string>& server_paths);
175 
176 
177  bool get_jack_server_paths (std::vector<std::string>& server_paths);
178 
182  bool get_jack_default_server_path (std::string& server_path);
183 
184  typedef std::vector<std::pair<std::string,std::string> > MidiOptions;
185 
190 
192 
194 
195  bool write_jack_config_file (const std::string& config_file_path, const std::string& command_line);
196 
198 
199  // see implementation for defaults
201 
202  //operator bool
203  //operator ostream
204 
205  std::string server_path;
206  uint32_t timeout;
207  bool no_mlock;
208  uint32_t ports_max;
209  bool realtime;
210  uint32_t priority;
212  bool verbose;
213  bool temporary;
216  std::string driver;
217  std::string input_device;
218  std::string output_device;
219  uint32_t num_periods;
220  uint32_t period_size;
221  uint32_t samplerate;
222  uint32_t input_channels;
223  uint32_t output_channels;
224  uint32_t input_latency;
225  uint32_t output_latency;
228  std::string dither_mode;
230  bool soft_mode;
231  std::string midi_driver;
232  };
233 
234  std::vector<std::string> enumerate_midi_options ();
235  int set_midi_option (ARDOUR::JackCommandLineOptions&, const std::string& opt);
236 
240  bool get_jack_command_line_string (JackCommandLineOptions& options, std::string& command_line);
241 }
const char *const ffado_driver_name
std::map< std::string, std::string > device_map_t
Definition: jack_utils.h:100
void set_path_env_for_jack_autostart(const std::vector< std::string > &)
void get_jack_default_audio_driver_name(std::string &driver_name)
std::vector< std::pair< std::string, std::string > > MidiOptions
Definition: jack_utils.h:184
std::vector< std::string > enumerate_midi_options()
bool get_jack_server_dir_paths(std::vector< std::string > &server_dir_paths)
void get_jack_audio_driver_names(std::vector< std::string > &driver_names)
bool get_jack_audio_driver_supports_latency_adjustment(const std::string &driver)
std::string get_jack_server_config_file_name()
bool get_jack_command_line_string(JackCommandLineOptions &options, std::string &command_line)
const char *const portaudio_driver_name
const char *const freebob_driver_name
bool get_jack_server_application_names(std::vector< std::string > &server_names)
void get_jack_sun_device_names(device_map_t &devices)
bool get_jack_audio_driver_supports_two_devices(const std::string &driver)
int set_midi_option(ARDOUR::JackCommandLineOptions &, const std::string &opt)
const char *const alsa_driver_name
std::string get_jack_server_user_config_file_path()
std::string get_jack_server_user_config_dir_path()
void get_jack_freebob_device_names(device_map_t &devices)
const char *const netjack_driver_name
bool get_jack_device_names_for_audio_driver(const std::string &driver, device_map_t &devices)
void get_jack_dummy_device_names(device_map_t &devices)
void get_jack_ffado_device_names(device_map_t &devices)
const char *const dummy_driver_name
std::string get_jack_default_period_size()
void get_jack_dither_mode_strings(const std::string &driver, std::vector< std::string > &dither_modes)
std::string get_jack_default_dither_mode(const std::string &driver)
void get_jack_alsa_device_names(device_map_t &devices)
bool get_jack_period_size_value_from_string(const std::string &pss, uint32_t &psv)
std::string get_jack_default_sample_rate()
void get_jack_sample_rate_strings(std::vector< std::string > &sample_rates)
void get_jack_period_size_strings(std::vector< std::string > &samplerates)
const char *const oss_driver_name
bool get_jack_audio_driver_supports_setting_period_count(const std::string &driver)
bool get_jack_server_paths(const std::vector< std::string > &server_dir_paths, const std::vector< std::string > &server_names, std::vector< std::string > &server_paths)
void get_jack_netjack_device_names(device_map_t &devices)
bool write_jack_config_file(const std::string &config_file_path, const std::string &command_line)
std::string get_jack_latency_string(std::string samplerate, float periods, std::string period_size)
void get_jack_oss_device_names(device_map_t &devices)
bool get_jack_default_server_path(std::string &server_path)
void get_jack_coreaudio_device_names(device_map_t &devices)
const char *const sun_driver_name
const char *const coreaudio_driver_name
bool get_jack_sample_rate_value_from_string(const std::string &srs, uint32_t &srv)
void get_jack_portaudio_device_names(device_map_t &devices)