12#ifndef __AUDACITY_MIDI_PLAY__
13#define __AUDACITY_MIDI_PLAY__
28#define AUDIO_IO_GB_MIDI_WORKAROUND
44 double startTime,
double offset,
bool send );
47 void Prime(
bool send,
double startTime);
49 double GetNextEventTime()
const;
53 double UncorrectedMidiEventTime(
double pauseTime);
55 bool Unmuted(
bool hasSolo)
const;
58 bool OutputEvent(
double pauseTime,
67 Alg_iterator it{
nullptr,
false };
69 Alg_event *mNextEvent =
nullptr;
75 bool mNextIsNoteOn =
false;
80 double mNextEventTime = 0;
89 {
return mPlaybackSchedule.mT0 + mNumFrames / rate; }
101 int mLastPmError = 0;
111 int mMidiLoopPasses = 0;
114 return mMidiLoopPasses * (mPlaybackSchedule.
mT1 - mPlaybackSchedule.
mT0);
117 long mAudioFramesPerBuffer = 0;
120 bool mMidiPaused =
false;
128 double mSystemMinusAudioTime = 0.0;
131 double mAudioOutLatency = 0.0;
138 double mStartTime = 0.0;
140 long mCallbackCount = 0;
142 double mSystemMinusAudioTimePlusLatency = 0.0;
146#ifdef AUDIO_IO_GB_MIDI_WORKAROUND
150 void PrepareMidiIterator(
bool send,
double startTime,
double offset);
151 bool StartPortMidiStream(
double rate);
152 double PauseTime(
double rate,
unsigned long pauseFrames);
153 void AllNotesOff(
bool looping =
false);
161 bool mUsingAlsa =
false;
163 static bool IsActive();
164 bool IsOtherStreamActive()
const override;
166 void ComputeOtherTimings(
double rate,
bool paused,
167 const PaStreamCallbackTimeInfo *timeInfo,
168 unsigned long framesPerBuffer)
override;
169 void SignalOtherCompletion()
override;
170 unsigned CountOtherSolo()
const override;
173 const PaStreamInfo* info,
double startTime,
double rate)
override;
174 void AbortOtherStream()
override;
175 void FillOtherBuffers(
double rate,
unsigned long pauseFrames,
176 bool paused,
bool hasSolo)
override;
177 void StopOtherStream()
override;
Abstract base class for hooks into audio playback procedures.
std::vector< std::shared_ptr< const NoteTrack > > NoteTrackConstArray
IntSetting MIDISynthLatency_ms
A Track that is used for Midi notes. (Somewhat old code).
const T & GetDefault() const
PmTimestamp MidiTime(void *pInfo)
double mT0
Playback starts at offset of mT0, which is measured in seconds.
double mT1
Playback ends at offset of mT1, which is measured in seconds. Note that mT1 may be less than mT0 duri...
const PlaybackSchedule & mPlaybackSchedule
std::optional< Iterator > mIterator
std::vector< std::pair< int, int > > mPendingNotesOff
NoteTrackConstArray mMidiPlaybackTracks
static bool mMidiStreamActive
mMidiStreamActive tells when mMidiStream is open for output
const PlaybackSchedule & mPlaybackSchedule
static bool mMidiOutputComplete
True when output reaches mT1.
double AudioTime(double rate) const