Audacity 3.2.0
Classes | Macros | Typedefs | Functions | Variables
NoteTrack.h File Reference
#include <utility>
#include "AudioIOSequences.h"
#include "CRTPBase.h"
#include "Prefs.h"
#include "PlayableTrack.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

struct  NoteTrackAttachment
 
class  NoteTrack
 A Track that is used for Midi notes. (Somewhat old code). More...
 
struct  NoteTrack::Interval
 

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 >
 
using NoteTrackAttachments = ClientData::Site< NoteTrack, NoteTrackAttachment, ClientData::DeepCopying >
 

Functions

 CRTP_BASE (NoteTrackAttachmentBase, struct, ClientData::Cloneable< NoteTrackAttachment, ClientData::UniquePtr >)
 
 ENUMERATE_TRACK_TYPE (NoteTrack)
 
NOTE_TRACK_API wxString GetMIDIDeviceInfo ()
 

Variables

struct NOTE_TRACK_API NoteTrackAttachment
 
NOTE_TRACK_API StringSetting MIDIPlaybackDevice
 
NOTE_TRACK_API StringSetting MIDIRecordingDevice
 
NOTE_TRACK_API IntSetting MIDISynthLatency_ms
 

Macro Definition Documentation

◆ ALL_CHANNELS

#define ALL_CHANNELS   (1 << NUM_CHANNELS) - 1

Definition at line 157 of file NoteTrack.h.

◆ CHANNEL_BIT

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

Definition at line 158 of file NoteTrack.h.

◆ NUM_CHANNELS

#define NUM_CHANNELS   16

Definition at line 155 of file NoteTrack.h.

◆ SonifyBeginAutoSave

#define SonifyBeginAutoSave ( )

Definition at line 251 of file NoteTrack.h.

◆ SonifyBeginMeasures

#define SonifyBeginMeasures ( )

Definition at line 245 of file NoteTrack.h.

◆ SonifyBeginModifyState

#define SonifyBeginModifyState ( )

Definition at line 253 of file NoteTrack.h.

◆ SonifyBeginNoteBackground

#define SonifyBeginNoteBackground ( )

Definition at line 241 of file NoteTrack.h.

◆ SonifyBeginNoteForeground

#define SonifyBeginNoteForeground ( )

Definition at line 243 of file NoteTrack.h.

◆ SonifyBeginSerialize

#define SonifyBeginSerialize ( )

Definition at line 247 of file NoteTrack.h.

◆ SonifyBeginSonification

#define SonifyBeginSonification ( )

Definition at line 239 of file NoteTrack.h.

◆ SonifyBeginUnserialize

#define SonifyBeginUnserialize ( )

Definition at line 249 of file NoteTrack.h.

◆ SonifyEndAutoSave

#define SonifyEndAutoSave ( )

Definition at line 252 of file NoteTrack.h.

◆ SonifyEndMeasures

#define SonifyEndMeasures ( )

Definition at line 246 of file NoteTrack.h.

◆ SonifyEndModifyState

#define SonifyEndModifyState ( )

Definition at line 254 of file NoteTrack.h.

◆ SonifyEndNoteBackground

#define SonifyEndNoteBackground ( )

Definition at line 242 of file NoteTrack.h.

◆ SonifyEndNoteForeground

#define SonifyEndNoteForeground ( )

Definition at line 244 of file NoteTrack.h.

◆ SonifyEndSerialize

#define SonifyEndSerialize ( )

Definition at line 248 of file NoteTrack.h.

◆ SonifyEndSonification

#define SonifyEndSonification ( )

Definition at line 240 of file NoteTrack.h.

◆ SonifyEndUnserialize

#define SonifyEndUnserialize ( )

Definition at line 250 of file NoteTrack.h.

Typedef Documentation

◆ NoteTrackAttachments

Definition at line 76 of file NoteTrack.h.

◆ NoteTrackBase

Definition at line 50 of file NoteTrack.h.

◆ QuantizedTimeAndBeat

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

Definition at line 58 of file NoteTrack.h.

Function Documentation

◆ CRTP_BASE()

CRTP_BASE ( NoteTrackAttachmentBase  ,
struct  ,
ClientData::Cloneable< NoteTrackAttachment, ClientData::UniquePtr  
)

◆ ENUMERATE_TRACK_TYPE()

ENUMERATE_TRACK_TYPE ( NoteTrack  )

◆ GetMIDIDeviceInfo()

NOTE_TRACK_API wxString GetMIDIDeviceInfo ( )

Definition at line 906 of file NoteTrack.cpp.

907{
908 wxStringOutputStream o;
909 wxTextOutputStream s(o, wxEOL_UNIX);
910
911 if (AudioIOBase::Get()->IsStreamActive()) {
912 return XO("Stream is active ... unable to gather information.\n")
913 .Translation();
914 }
915
916
917 // XXX: May need to trap errors as with the normal device info
918 int recDeviceNum = Pm_GetDefaultInputDeviceID();
919 int playDeviceNum = Pm_GetDefaultOutputDeviceID();
920 int cnt = Pm_CountDevices();
921
922 // PRL: why only into the log?
923 wxLogDebug(wxT("PortMidi reports %d MIDI devices"), cnt);
924
925 s << wxT("==============================\n");
926 s << XO("Default recording device number: %d\n").Format( recDeviceNum );
927 s << XO("Default playback device number: %d\n").Format( playDeviceNum );
928
929 auto recDevice = MIDIRecordingDevice.Read();
930 auto playDevice = MIDIPlaybackDevice.Read();
931
932 // This gets info on all available audio devices (input and output)
933 if (cnt <= 0) {
934 s << XO("No devices found\n");
935 return o.GetString();
936 }
937
938 for (int i = 0; i < cnt; i++) {
939 s << wxT("==============================\n");
940
941 const PmDeviceInfo* info = Pm_GetDeviceInfo(i);
942 if (!info) {
943 s << XO("Device info unavailable for: %d\n").Format( i );
944 continue;
945 }
946
947 wxString name = wxSafeConvertMB2WX(info->name);
948 wxString hostName = wxSafeConvertMB2WX(info->interf);
949
950 s << XO("Device ID: %d\n").Format( i );
951 s << XO("Device name: %s\n").Format( name );
952 s << XO("Host name: %s\n").Format( hostName );
953 /* i18n-hint: Supported, meaning made available by the system */
954 s << XO("Supports output: %d\n").Format( info->output );
955 /* i18n-hint: Supported, meaning made available by the system */
956 s << XO("Supports input: %d\n").Format( info->input );
957 s << XO("Opened: %d\n").Format( info->opened );
958
959 if (name == playDevice && info->output)
960 playDeviceNum = i;
961
962 if (name == recDevice && info->input)
963 recDeviceNum = i;
964
965 // XXX: This is only done because the same was applied with PortAudio
966 // If PortMidi returns -1 for the default device, use the first one
967 if (recDeviceNum < 0 && info->input){
968 recDeviceNum = i;
969 }
970 if (playDeviceNum < 0 && info->output){
971 playDeviceNum = i;
972 }
973 }
974
975 bool haveRecDevice = (recDeviceNum >= 0);
976 bool havePlayDevice = (playDeviceNum >= 0);
977
978 s << wxT("==============================\n");
979 if (haveRecDevice)
980 s << XO("Selected MIDI recording device: %d - %s\n").Format( recDeviceNum, recDevice );
981 else
982 s << XO("No MIDI recording device found for '%s'.\n").Format( recDevice );
983
984 if (havePlayDevice)
985 s << XO("Selected MIDI playback device: %d - %s\n").Format( playDeviceNum, playDevice );
986 else
987 s << XO("No MIDI playback device found for '%s'.\n").Format( playDevice );
988
989 // Mention our conditional compilation flags for Alpha only
990#ifdef IS_ALPHA
991
992 // Not internationalizing these alpha-only messages
993 s << wxT("==============================\n");
994#ifdef EXPERIMENTAL_MIDI_OUT
995 s << wxT("EXPERIMENTAL_MIDI_OUT is enabled\n");
996#else
997 s << wxT("EXPERIMENTAL_MIDI_OUT is NOT enabled\n");
998#endif
999#ifdef EXPERIMENTAL_MIDI_IN
1000 s << wxT("EXPERIMENTAL_MIDI_IN is enabled\n");
1001#else
1002 s << wxT("EXPERIMENTAL_MIDI_IN is NOT enabled\n");
1003#endif
1004
1005#endif
1006
1007 return o.GetString();
1008}
wxT("CloseDown"))
const TranslatableString name
Definition: Distortion.cpp:76
XO("Cut/Copy/Paste")
StringSetting MIDIRecordingDevice
Definition: NoteTrack.cpp:1011
StringSetting MIDIPlaybackDevice
Definition: NoteTrack.cpp:1010
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:94
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207

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

NOTE_TRACK_API StringSetting MIDIPlaybackDevice
extern

◆ MIDIRecordingDevice

NOTE_TRACK_API StringSetting MIDIRecordingDevice
extern

Definition at line 1011 of file NoteTrack.cpp.

Referenced by GetMIDIDeviceInfo().

◆ MIDISynthLatency_ms

NOTE_TRACK_API IntSetting MIDISynthLatency_ms
extern

◆ NoteTrackAttachment

struct NOTE_TRACK_API NoteTrackAttachment

Definition at line 64 of file NoteTrack.h.