Audacity 3.2.0
Classes | Macros | Typedefs | Functions | Variables
NoteTrack.h File Reference
#include <utility>
#include "Prefs.h"
#include "Track.h"
Include dependency graph for NoteTrack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  NoteTrack
 A Track that is used for Midi notes. (Somewhat old code). More...
 
class  NoteTrackDisplayData
 Data used to display a note track. More...
 

Macros

#define NUM_CHANNELS   16
 
#define ALL_CHANNELS   (1 << NUM_CHANNELS) - 1
 
#define CHANNEL_BIT(c)   (1 << (c % NUM_CHANNELS))
 
#define SonifyBeginSonification()
 
#define SonifyEndSonification()
 
#define SonifyBeginNoteBackground()
 
#define SonifyEndNoteBackground()
 
#define SonifyBeginNoteForeground()
 
#define SonifyEndNoteForeground()
 
#define SonifyBeginMeasures()
 
#define SonifyEndMeasures()
 
#define SonifyBeginSerialize()
 
#define SonifyEndSerialize()
 
#define SonifyBeginUnserialize()
 
#define SonifyEndUnserialize()
 
#define SonifyBeginAutoSave()
 
#define SonifyEndAutoSave()
 
#define SonifyBeginModifyState()
 
#define SonifyEndModifyState()
 

Typedefs

using NoteTrackBase = AudioTrack
 
using QuantizedTimeAndBeat = std::pair< double, double >
 

Functions

 ENUMERATE_TRACK_TYPE (NoteTrack)
 
AUDACITY_DLL_API wxString GetMIDIDeviceInfo ()
 

Variables

AUDACITY_DLL_API StringSetting MIDIPlaybackDevice
 
AUDACITY_DLL_API StringSetting MIDIRecordingDevice
 
AUDACITY_DLL_API IntSetting MIDISynthLatency_ms
 

Macro Definition Documentation

◆ ALL_CHANNELS

#define ALL_CHANNELS   (1 << NUM_CHANNELS) - 1

Definition at line 174 of file NoteTrack.h.

◆ CHANNEL_BIT

#define CHANNEL_BIT (   c)    (1 << (c % NUM_CHANNELS))

Definition at line 175 of file NoteTrack.h.

◆ NUM_CHANNELS

#define NUM_CHANNELS   16

Definition at line 172 of file NoteTrack.h.

◆ SonifyBeginAutoSave

#define SonifyBeginAutoSave ( )

Definition at line 315 of file NoteTrack.h.

◆ SonifyBeginMeasures

#define SonifyBeginMeasures ( )

Definition at line 309 of file NoteTrack.h.

◆ SonifyBeginModifyState

#define SonifyBeginModifyState ( )

Definition at line 317 of file NoteTrack.h.

◆ SonifyBeginNoteBackground

#define SonifyBeginNoteBackground ( )

Definition at line 305 of file NoteTrack.h.

◆ SonifyBeginNoteForeground

#define SonifyBeginNoteForeground ( )

Definition at line 307 of file NoteTrack.h.

◆ SonifyBeginSerialize

#define SonifyBeginSerialize ( )

Definition at line 311 of file NoteTrack.h.

◆ SonifyBeginSonification

#define SonifyBeginSonification ( )

Definition at line 303 of file NoteTrack.h.

◆ SonifyBeginUnserialize

#define SonifyBeginUnserialize ( )

Definition at line 313 of file NoteTrack.h.

◆ SonifyEndAutoSave

#define SonifyEndAutoSave ( )

Definition at line 316 of file NoteTrack.h.

◆ SonifyEndMeasures

#define SonifyEndMeasures ( )

Definition at line 310 of file NoteTrack.h.

◆ SonifyEndModifyState

#define SonifyEndModifyState ( )

Definition at line 318 of file NoteTrack.h.

◆ SonifyEndNoteBackground

#define SonifyEndNoteBackground ( )

Definition at line 306 of file NoteTrack.h.

◆ SonifyEndNoteForeground

#define SonifyEndNoteForeground ( )

Definition at line 308 of file NoteTrack.h.

◆ SonifyEndSerialize

#define SonifyEndSerialize ( )

Definition at line 312 of file NoteTrack.h.

◆ SonifyEndSonification

#define SonifyEndSonification ( )

Definition at line 304 of file NoteTrack.h.

◆ SonifyEndUnserialize

#define SonifyEndUnserialize ( )

Definition at line 314 of file NoteTrack.h.

Typedef Documentation

◆ NoteTrackBase

Definition at line 48 of file NoteTrack.h.

◆ QuantizedTimeAndBeat

using QuantizedTimeAndBeat = std::pair< double, double >

Definition at line 56 of file NoteTrack.h.

Function Documentation

◆ ENUMERATE_TRACK_TYPE()

ENUMERATE_TRACK_TYPE ( NoteTrack  )

◆ GetMIDIDeviceInfo()

AUDACITY_DLL_API wxString GetMIDIDeviceInfo ( )

Definition at line 1180 of file NoteTrack.cpp.

1181{
1182 wxStringOutputStream o;
1183 wxTextOutputStream s(o, wxEOL_UNIX);
1184
1185 if (AudioIOBase::Get()->IsStreamActive()) {
1186 return XO("Stream is active ... unable to gather information.\n")
1187 .Translation();
1188 }
1189
1190
1191 // XXX: May need to trap errors as with the normal device info
1192 int recDeviceNum = Pm_GetDefaultInputDeviceID();
1193 int playDeviceNum = Pm_GetDefaultOutputDeviceID();
1194 int cnt = Pm_CountDevices();
1195
1196 // PRL: why only into the log?
1197 wxLogDebug(wxT("PortMidi reports %d MIDI devices"), cnt);
1198
1199 s << wxT("==============================\n");
1200 s << XO("Default recording device number: %d\n").Format( recDeviceNum );
1201 s << XO("Default playback device number: %d\n").Format( playDeviceNum );
1202
1203 auto recDevice = MIDIRecordingDevice.Read();
1204 auto playDevice = MIDIPlaybackDevice.Read();
1205
1206 // This gets info on all available audio devices (input and output)
1207 if (cnt <= 0) {
1208 s << XO("No devices found\n");
1209 return o.GetString();
1210 }
1211
1212 for (int i = 0; i < cnt; i++) {
1213 s << wxT("==============================\n");
1214
1215 const PmDeviceInfo* info = Pm_GetDeviceInfo(i);
1216 if (!info) {
1217 s << XO("Device info unavailable for: %d\n").Format( i );
1218 continue;
1219 }
1220
1221 wxString name = wxSafeConvertMB2WX(info->name);
1222 wxString hostName = wxSafeConvertMB2WX(info->interf);
1223
1224 s << XO("Device ID: %d\n").Format( i );
1225 s << XO("Device name: %s\n").Format( name );
1226 s << XO("Host name: %s\n").Format( hostName );
1227 /* i18n-hint: Supported, meaning made available by the system */
1228 s << XO("Supports output: %d\n").Format( info->output );
1229 /* i18n-hint: Supported, meaning made available by the system */
1230 s << XO("Supports input: %d\n").Format( info->input );
1231 s << XO("Opened: %d\n").Format( info->opened );
1232
1233 if (name == playDevice && info->output)
1234 playDeviceNum = i;
1235
1236 if (name == recDevice && info->input)
1237 recDeviceNum = i;
1238
1239 // XXX: This is only done because the same was applied with PortAudio
1240 // If PortMidi returns -1 for the default device, use the first one
1241 if (recDeviceNum < 0 && info->input){
1242 recDeviceNum = i;
1243 }
1244 if (playDeviceNum < 0 && info->output){
1245 playDeviceNum = i;
1246 }
1247 }
1248
1249 bool haveRecDevice = (recDeviceNum >= 0);
1250 bool havePlayDevice = (playDeviceNum >= 0);
1251
1252 s << wxT("==============================\n");
1253 if (haveRecDevice)
1254 s << XO("Selected MIDI recording device: %d - %s\n").Format( recDeviceNum, recDevice );
1255 else
1256 s << XO("No MIDI recording device found for '%s'.\n").Format( recDevice );
1257
1258 if (havePlayDevice)
1259 s << XO("Selected MIDI playback device: %d - %s\n").Format( playDeviceNum, playDevice );
1260 else
1261 s << XO("No MIDI playback device found for '%s'.\n").Format( playDevice );
1262
1263 // Mention our conditional compilation flags for Alpha only
1264#ifdef IS_ALPHA
1265
1266 // Not internationalizing these alpha-only messages
1267 s << wxT("==============================\n");
1268#ifdef EXPERIMENTAL_MIDI_OUT
1269 s << wxT("EXPERIMENTAL_MIDI_OUT is enabled\n");
1270#else
1271 s << wxT("EXPERIMENTAL_MIDI_OUT is NOT enabled\n");
1272#endif
1273#ifdef EXPERIMENTAL_MIDI_IN
1274 s << wxT("EXPERIMENTAL_MIDI_IN is enabled\n");
1275#else
1276 s << wxT("EXPERIMENTAL_MIDI_IN is NOT enabled\n");
1277#endif
1278
1279#endif
1280
1281 return o.GetString();
1282}
wxT("CloseDown"))
const TranslatableString name
Definition: Distortion.cpp:74
XO("Cut/Copy/Paste")
StringSetting MIDIRecordingDevice
Definition: NoteTrack.cpp:1285
StringSetting MIDIPlaybackDevice
Definition: NoteTrack.cpp:1284
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:91
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:200

References AudioIOBase::Get(), MIDIPlaybackDevice, MIDIRecordingDevice, name, Setting< T >::Read(), wxT(), and XO().

Referenced by anonymous_namespace{MIDIPlay.h}::MIDIPlay::Dump().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ MIDIPlaybackDevice

AUDACITY_DLL_API StringSetting MIDIPlaybackDevice
extern

◆ MIDIRecordingDevice

AUDACITY_DLL_API StringSetting MIDIRecordingDevice
extern

Definition at line 1285 of file NoteTrack.cpp.

Referenced by GetMIDIDeviceInfo().

◆ MIDISynthLatency_ms

AUDACITY_DLL_API IntSetting MIDISynthLatency_ms
extern