Audacity 3.2.0
|
#include <MIDIPlay.h>
Public Member Functions | |
MIDIPlay (const PlaybackSchedule &schedule) | |
~MIDIPlay () override | |
double | AudioTime (double rate) const |
double | MidiLoopOffset () |
void | PrepareMidiIterator (bool send, double startTime, double offset) |
bool | StartPortMidiStream (double rate) |
double | PauseTime (double rate, unsigned long pauseFrames) |
void | AllNotesOff (bool looping=false) |
PmTimestamp | MidiTime () |
Compute the current PortMidi timestamp time. More... | |
bool | IsOtherStreamActive () const override |
void | ComputeOtherTimings (double rate, bool paused, const PaStreamCallbackTimeInfo *timeInfo, unsigned long framesPerBuffer) override |
void | SignalOtherCompletion () override |
unsigned | CountOtherSolo () const override |
bool | StartOtherStream (const TransportSequences &tracks, const PaStreamInfo *info, double startTime, double rate) override |
void | AbortOtherStream () override |
void | FillOtherBuffers (double rate, unsigned long pauseFrames, bool paused, bool hasSolo) override |
void | StopOtherStream () override |
AudioIODiagnostics | Dump () const override |
Get diagnostic information for audio devices and also for extensions. More... | |
Public Member Functions inherited from AudioIOExt | |
virtual | ~AudioIOExt () |
virtual void | ComputeOtherTimings (double rate, bool paused, const PaStreamCallbackTimeInfo *timeInfo, unsigned long framesPerBuffer)=0 |
virtual void | SignalOtherCompletion ()=0 |
virtual unsigned | CountOtherSolo () const =0 |
virtual bool | StartOtherStream (const TransportSequences &tracks, const PaStreamInfo *info, double startTime, double rate)=0 |
virtual void | AbortOtherStream ()=0 |
virtual void | FillOtherBuffers (double rate, unsigned long pauseFrames, bool paused, bool hasSolo)=0 |
virtual void | StopOtherStream ()=0 |
Public Member Functions inherited from AudioIOExtBase | |
virtual | ~AudioIOExtBase () |
virtual bool | IsOtherStreamActive () const =0 |
virtual AudioIODiagnostics | Dump () const =0 |
Get diagnostic information for audio devices and also for extensions. More... | |
Static Public Member Functions | |
static bool | IsActive () |
Static Public Member Functions inherited from AudioIOExt | |
static Factories & | GetFactories () |
Public Attributes | |
const PlaybackSchedule & | mPlaybackSchedule |
NoteTrackConstArray | mMidiPlaybackTracks |
PmStream * | mMidiStream = nullptr |
int | mLastPmError = 0 |
long | mSynthLatency = MIDISynthLatency_ms.GetDefault() |
Latency of MIDI synthesizer. More... | |
long | mNumFrames = 0 |
Number of frames output, including pauses. More... | |
int | mMidiLoopPasses = 0 |
total of backward jumps More... | |
long | mAudioFramesPerBuffer = 0 |
bool | mMidiPaused = false |
PmTimestamp | mMaxMidiTimestamp = 0 |
double | mSystemMinusAudioTime = 0.0 |
double | mAudioOutLatency = 0.0 |
double | mStartTime = 0.0 |
long | mCallbackCount = 0 |
number of callbacks since stream start More... | |
double | mSystemMinusAudioTimePlusLatency = 0.0 |
std::optional< Iterator > | mIterator |
std::vector< std::pair< int, int > > | mPendingNotesOff |
bool | mUsingAlsa = false |
Static Public Attributes | |
static bool | mMidiOutputComplete = true |
True when output reaches mT1. More... | |
static bool | mMidiStreamActive = false |
mMidiStreamActive tells when mMidiStream is open for output More... | |
Additional Inherited Members | |
Public Types inherited from AudioIOExt | |
using | Factory = std::function< std::unique_ptr< AudioIOExt >(const PlaybackSchedule &) > |
using | Factories = std::vector< AudioIOExt::Factory > |
Definition at line 83 of file MIDIPlay.h.
|
explicit |
Definition at line 516 of file MIDIPlay.cpp.
References BasicUI::MessageBoxOptions::Caption(), LAT1CTOWX, mPendingNotesOff, BasicUI::ShowMessageBox(), and XO().
|
override |
Definition at line 548 of file MIDIPlay.cpp.
|
overridevirtual |
Implements AudioIOExt.
Definition at line 603 of file MIDIPlay.cpp.
References mMidiPlaybackTracks.
void MIDIPlay::AllNotesOff | ( | bool | looping = false | ) |
Definition at line 1063 of file MIDIPlay.cpp.
References MidiTime(), mMaxMidiTimestamp, mMidiStream, and mPendingNotesOff.
Referenced by ComputeOtherTimings(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), and StopOtherStream().
|
inline |
Definition at line 88 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and FillOtherBuffers().
|
overridevirtual |
Implements AudioIOExt.
Definition at line 1116 of file MIDIPlay.cpp.
References AllNotesOff(), AudioTime(), mAudioFramesPerBuffer, mAudioOutLatency, mCallbackCount, mMidiPaused, mNumFrames, mPlaybackSchedule, mStartTime, mSystemMinusAudioTime, mSystemMinusAudioTimePlusLatency, PlaybackSchedule::mT0, mUsingAlsa, and anonymous_namespace{MIDIPlay.cpp}::SystemTime().
|
overridevirtual |
Implements AudioIOExt.
Definition at line 1192 of file MIDIPlay.cpp.
References mMidiPlaybackTracks.
|
overridevirtual |
Get diagnostic information for audio devices and also for extensions.
Implements AudioIOExtBase.
Definition at line 1215 of file MIDIPlay.cpp.
References GetMIDIDeviceInfo(), and wxT().
|
overridevirtual |
Implements AudioIOExt.
Definition at line 991 of file MIDIPlay.cpp.
References AudioTime(), PlaybackSchedule::GetPolicy(), PlaybackPolicy::Looping(), mAudioOutLatency, anonymous_namespace{MIDIPlay.cpp}::MIDI_MINIMAL_LATENCY_MS, MidiLoopOffset(), mIterator, mMidiLoopPasses, mMidiStream, mPlaybackSchedule, mSynthLatency, PlaybackSchedule::mT0, PauseTime(), and PrepareMidiIterator().
|
static |
Definition at line 1205 of file MIDIPlay.cpp.
|
overridevirtual |
Implements AudioIOExtBase.
Definition at line 1210 of file MIDIPlay.cpp.
|
inline |
Definition at line 113 of file MIDIPlay.h.
References PlaybackSchedule::mT0, and PlaybackSchedule::mT1.
Referenced by FillOtherBuffers(), anonymous_namespace{MIDIPlay.h}::Iterator::GetNextEvent(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
PmTimestamp MIDIPlay::MidiTime | ( | ) |
Compute the current PortMidi timestamp time.
This is used by PortMidi to synchronize midi time to audio samples
Definition at line 1039 of file MIDIPlay.cpp.
References anonymous_namespace{MIDIPlay.cpp}::MIDI_MINIMAL_LATENCY_MS, mSystemMinusAudioTimePlusLatency, mUsingAlsa, and anonymous_namespace{MIDIPlay.cpp}::SystemTime().
Referenced by AllNotesOff(), StartPortMidiStream(), and StopOtherStream().
double MIDIPlay::PauseTime | ( | double | rate, |
unsigned long | pauseFrames | ||
) |
Definition at line 1029 of file MIDIPlay.cpp.
Referenced by FillOtherBuffers().
void MIDIPlay::PrepareMidiIterator | ( | bool | send, |
double | startTime, | ||
double | offset | ||
) |
Definition at line 617 of file MIDIPlay.cpp.
References mIterator, mMidiPlaybackTracks, and mPlaybackSchedule.
Referenced by FillOtherBuffers(), and StartPortMidiStream().
|
overridevirtual |
Implements AudioIOExt.
Definition at line 1199 of file MIDIPlay.cpp.
References mMidiOutputComplete.
|
overridevirtual |
Implements AudioIOExt.
Definition at line 553 of file MIDIPlay.cpp.
References mAudioFramesPerBuffer, mAudioOutLatency, mCallbackCount, mMidiPlaybackTracks, mNumFrames, mSystemMinusAudioTime, mSystemMinusAudioTimePlusLatency, mUsingAlsa, StartPortMidiStream(), anonymous_namespace{MIDIPlay.cpp}::streamStartTime, anonymous_namespace{MIDIPlay.cpp}::SystemTime(), and tracks.
bool MIDIPlay::StartPortMidiStream | ( | double | rate | ) |
Definition at line 678 of file MIDIPlay.cpp.
References AudioIOHost, anonymous_namespace{MIDIPlay.cpp}::MIDI_MINIMAL_LATENCY_MS, MIDIPlaybackDevice, MIDISynthLatency_ms, MidiTime(), mLastPmError, mMaxMidiTimestamp, mMidiLoopPasses, mMidiOutputComplete, mMidiPaused, mMidiPlaybackTracks, mMidiStream, mMidiStreamActive, mPlaybackSchedule, mSynthLatency, PlaybackSchedule::mT0, mUsingAlsa, name, PrepareMidiIterator(), Setting< T >::Read(), and wxT().
Referenced by StartOtherStream().
|
overridevirtual |
Implements AudioIOExt.
Definition at line 741 of file MIDIPlay.cpp.
References AllNotesOff(), MidiTime(), mIterator, mMaxMidiTimestamp, mMidiOutputComplete, mMidiPlaybackTracks, mMidiStream, and mMidiStreamActive.
long anonymous_namespace{MIDIPlay.h}::MIDIPlay::mAudioFramesPerBuffer = 0 |
Definition at line 117 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and StartOtherStream().
double anonymous_namespace{MIDIPlay.h}::MIDIPlay::mAudioOutLatency = 0.0 |
audio output latency reported by PortAudio (initially; for Alsa, we adjust it to the largest "observed" value)
Definition at line 131 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), FillOtherBuffers(), and StartOtherStream().
long anonymous_namespace{MIDIPlay.h}::MIDIPlay::mCallbackCount = 0 |
number of callbacks since stream start
Definition at line 140 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and StartOtherStream().
std::optional<Iterator> anonymous_namespace{MIDIPlay.h}::MIDIPlay::mIterator |
Definition at line 144 of file MIDIPlay.h.
Referenced by FillOtherBuffers(), PrepareMidiIterator(), and StopOtherStream().
int anonymous_namespace{MIDIPlay.h}::MIDIPlay::mLastPmError = 0 |
Definition at line 101 of file MIDIPlay.h.
Referenced by StartPortMidiStream().
PmTimestamp anonymous_namespace{MIDIPlay.h}::MIDIPlay::mMaxMidiTimestamp = 0 |
The largest timestamp written so far, used to delay stream closing until last message has been delivered
Definition at line 123 of file MIDIPlay.h.
Referenced by AllNotesOff(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), StartPortMidiStream(), and StopOtherStream().
int anonymous_namespace{MIDIPlay.h}::MIDIPlay::mMidiLoopPasses = 0 |
total of backward jumps
Definition at line 111 of file MIDIPlay.h.
Referenced by FillOtherBuffers(), StartPortMidiStream(), and anonymous_namespace{MIDIPlay.h}::Iterator::UncorrectedMidiEventTime().
|
static |
True when output reaches mT1.
Definition at line 95 of file MIDIPlay.h.
Referenced by SignalOtherCompletion(), StartPortMidiStream(), and StopOtherStream().
bool anonymous_namespace{MIDIPlay.h}::MIDIPlay::mMidiPaused = false |
Used by Midi process to record that pause has begun, so that AllNotesOff() is only delivered once
Definition at line 120 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and StartPortMidiStream().
NoteTrackConstArray anonymous_namespace{MIDIPlay.h}::MIDIPlay::mMidiPlaybackTracks |
Definition at line 92 of file MIDIPlay.h.
Referenced by AbortOtherStream(), CountOtherSolo(), PrepareMidiIterator(), StartOtherStream(), StartPortMidiStream(), and StopOtherStream().
PmStream* anonymous_namespace{MIDIPlay.h}::MIDIPlay::mMidiStream = nullptr |
Definition at line 100 of file MIDIPlay.h.
Referenced by AllNotesOff(), FillOtherBuffers(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), StartPortMidiStream(), and StopOtherStream().
|
static |
mMidiStreamActive tells when mMidiStream is open for output
Definition at line 98 of file MIDIPlay.h.
Referenced by StartPortMidiStream(), and StopOtherStream().
long anonymous_namespace{MIDIPlay.h}::MIDIPlay::mNumFrames = 0 |
Number of frames output, including pauses.
Definition at line 109 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and StartOtherStream().
std::vector< std::pair< int, int > > anonymous_namespace{MIDIPlay.h}::MIDIPlay::mPendingNotesOff |
Definition at line 147 of file MIDIPlay.h.
Referenced by AllNotesOff(), MIDIPlay(), and anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent().
const PlaybackSchedule& anonymous_namespace{MIDIPlay.h}::MIDIPlay::mPlaybackSchedule |
Definition at line 91 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), FillOtherBuffers(), PrepareMidiIterator(), and StartPortMidiStream().
double anonymous_namespace{MIDIPlay.h}::MIDIPlay::mStartTime = 0.0 |
time of first callback used to find "observed" latency
Definition at line 138 of file MIDIPlay.h.
Referenced by ComputeOtherTimings().
long anonymous_namespace{MIDIPlay.h}::MIDIPlay::mSynthLatency = MIDISynthLatency_ms.GetDefault() |
Latency of MIDI synthesizer.
Definition at line 104 of file MIDIPlay.h.
Referenced by FillOtherBuffers(), anonymous_namespace{MIDIPlay.h}::Iterator::OutputEvent(), and StartPortMidiStream().
double anonymous_namespace{MIDIPlay.h}::MIDIPlay::mSystemMinusAudioTime = 0.0 |
Offset from ideal sample computation time to system time, where "ideal" means when we would get the callback if there were no scheduling delays or computation time
Definition at line 128 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), and StartOtherStream().
double anonymous_namespace{MIDIPlay.h}::MIDIPlay::mSystemMinusAudioTimePlusLatency = 0.0 |
Definition at line 142 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), MidiTime(), and StartOtherStream().
bool anonymous_namespace{MIDIPlay.h}::MIDIPlay::mUsingAlsa = false |
Definition at line 161 of file MIDIPlay.h.
Referenced by ComputeOtherTimings(), MidiTime(), StartOtherStream(), and StartPortMidiStream().