32#include <wx/textctrl.h>
71 return XO(
"Preferences for MidiIO");
76 return "MIDI_Devices_Preferences";
86#ifdef EXPERIMENTAL_MIDI_IN
111 int nDevices = Pm_CountDevices();
112 for (
int i = 0; i < nDevices; i++) {
113 const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
114 if (info->output || info->input) {
115 wxString
name = wxSafeConvertMB2WX(info->interf);
140 S.StartStatic(
XC(
"Interface",
"MIDI"));
142 S.StartMultiColumn(2);
148 S.AddPrompt(
XXO(
"Using: PortMidi"));
154 S.StartStatic(
XO(
"Playback"));
156 S.StartMultiColumn(2);
161 mLatency =
S.TieIntegerTextBox(
XXO(
"MIDI Synth L&atency (ms):"),
167#ifdef EXPERIMENTAL_MIDI_IN
168 S.StartStatic(
XO(
"Recording"));
170 S.StartMultiColumn(2);
173 mRecord =
S.AddChoice(
XO(
"De&vice:"),
193 wxString itemAtIndex;
194 int index =
mHost->GetCurrentSelection();
195 if (index >= 0 && index < (
int)
mHostNames.size())
197 int nDevices = Pm_CountDevices();
200#ifdef EXPERIMENTAL_MIDI_IN
207 for (
int i = 0; i < nDevices; i++) {
208 const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
209 wxString interf = wxSafeConvertMB2WX(info->interf);
210 if (itemAtIndex == interf) {
211 wxString
name = wxSafeConvertMB2WX(info->name);
212 wxString device = wxString::Format(
wxT(
"%s: %s"),
216 playnames.push_back(
name);
217 index =
mPlay->Append(
name, (
void *) info);
219 mPlay->SetSelection(index);
222#ifdef EXPERIMENTAL_MIDI_IN
224 recordnames.push_back(
name);
225 index = mRecord->Append(
name, (
void *) info);
226 if (device == mRecordDevice) {
227 mRecord->SetSelection(index);
234 if (
mPlay->GetCount() == 0) {
235 playnames.push_back(
_(
"No devices found"));
236 mPlay->Append(playnames[0], (
void *) NULL);
238#ifdef EXPERIMENTAL_MIDI_IN
239 if (mRecord->GetCount() == 0) {
240 recordnames.push_back(
_(
"No devices found"));
241 mRecord->Append(recordnames[0], (
void *) NULL);
244 if (
mPlay->GetCount() &&
mPlay->GetSelection() == wxNOT_FOUND) {
245 mPlay->SetSelection(0);
247#ifdef EXPERIMENTAL_MIDI_IN
248 if (mRecord->GetCount() && mRecord->GetSelection() == wxNOT_FOUND) {
249 mRecord->SetSelection(0);
253#ifdef EXPERIMENTAL_MIDI_IN
264 const PmDeviceInfo *info;
266 info = (
const PmDeviceInfo *)
mPlay->GetClientData(
mPlay->GetSelection());
269 wxString::Format(
wxT(
"%s: %s"),
270 wxString(wxSafeConvertMB2WX(info->interf)),
271 wxString(wxSafeConvertMB2WX(info->name))));
273#ifdef EXPERIMENTAL_MIDI_IN
274 info = (
const PmDeviceInfo *) mRecord->GetClientData(mRecord->GetSelection());
276 MidiRecordingDevice.Write(
277 wxString::Format(
wxT(
"%s: %s"),
278 wxString(wxSafeConvertMB2WX(info->interf)),
279 wxString(wxSafeConvertMB2WX(info->name))));
289 if (!
mLatency->GetValue().ToLong(&latency)) {
291"The MIDI Synthesizer Latency must be an integer") );
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XXO("&Cut/Copy/Paste Toolbar")
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
#define MIDI_IO_PREFS_PLUGIN_SYMBOL
IntSetting MIDISynthLatency_ms
StringSetting MIDIRecordingDevice
StringSetting MIDIPlaybackDevice
audacity::BasicSettings * gPrefs
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A PrefsPanel used to select recording and playback devices and other settings.
TranslatableString GetDescription() const override
wxArrayStringEx mHostLabels
TranslatableStrings mHostNames
void OnHost(wxCommandEvent &e)
void PopulateOrExchange(ShuttleGui &S) override
ComponentInterfaceSymbol GetSymbol() const override
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
bool Write(const T &value)
Write value to config and return true if successful.
void Invalidate() override
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined */
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
static void SetMinSize(wxWindow *window, const TranslatableStrings &items)
Holds a msgid for the translation catalog; may also bind format arguments.
virtual bool Flush() noexcept=0
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
PrefsPanel::Registration sAttachment