1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +02:00

Keep !defined(MIDI_THREAD) branch compilable...

... The break was caused by ffa67d2 which split the base class AudioIoCallback
out of AudioIO.

This change only demotes some member declarations from AudioIO into
AudioIoCallback, and changes the qualified names of function definitions.

So now you can eliminate #define MIDI_THREAD in AudioIO.h and rebuild.
This commit is contained in:
Paul Licameli 2020-12-26 10:23:18 -05:00
parent 6b42c92651
commit cccc7a7c4e
2 changed files with 46 additions and 48 deletions

View File

@ -2054,7 +2054,7 @@ PmTimestamp MidiTime(void *WXUNUSED(info))
// Sends MIDI control changes up to the starting point mT0
// if send is true. Output is delayed by offset to facilitate
// looping (each iteration is delayed more).
void AudioIO::PrepareMidiIterator(bool send, double offset)
void AudioIoCallback::PrepareMidiIterator(bool send, double offset)
{
int i;
int nTracks = mMidiPlaybackTracks.size();
@ -2085,7 +2085,7 @@ void AudioIO::PrepareMidiIterator(bool send, double offset)
mSendMidiState = false;
}
bool AudioIO::StartPortMidiStream()
bool AudioIoCallback::StartPortMidiStream()
{
int i;
int nTracks = mMidiPlaybackTracks.size();
@ -3093,7 +3093,7 @@ void AudioIoCallback::SetListener(
static Alg_update gAllNotesOff; // special event for loop ending
// the fields of this event are never used, only the address is important
double AudioIO::UncorrectedMidiEventTime()
double AudioIoCallback::UncorrectedMidiEventTime()
{
double time;
if (mPlaybackSchedule.mEnvelope)
@ -3107,7 +3107,7 @@ double AudioIO::UncorrectedMidiEventTime()
return time + PauseTime();
}
void AudioIO::OutputEvent()
void AudioIoCallback::OutputEvent()
{
int channel = (mNextEvent->chan) & 0xF; // must be in [0..15]
int command = -1;
@ -3254,7 +3254,7 @@ void AudioIO::OutputEvent()
}
}
void AudioIO::GetNextEvent()
void AudioIoCallback::GetNextEvent()
{
mNextEventTrack = NULL; // clear it just to be safe
// now get the next event and the track from which it came
@ -3283,14 +3283,14 @@ void AudioIO::GetNextEvent()
}
bool AudioIO::SetHasSolo(bool hasSolo)
bool AudioIoCallback::SetHasSolo(bool hasSolo)
{
mHasSolo = hasSolo;
return mHasSolo;
}
void AudioIO::FillMidiBuffers()
void AudioIoCallback::FillMidiBuffers()
{
// Keep track of time paused. If not paused, fill buffers.
if (IsPaused()) {
@ -3369,7 +3369,7 @@ void AudioIO::FillMidiBuffers()
// !mNextEvent);
}
double AudioIO::PauseTime()
double AudioIoCallback::PauseTime()
{
return mNumPauseFrames / mRate;
}
@ -3379,7 +3379,7 @@ double AudioIO::PauseTime()
// output (DAC) time + 1s. In other words, what audacity track time
// corresponds to the audio (including pause insertions) at the output?
//
PmTimestamp AudioIO::MidiTime()
PmTimestamp AudioIoCallback::MidiTime()
{
// note: the extra 0.0005 is for rounding. Round down by casting to
// unsigned long, then convert to PmTimeStamp (currently signed)
@ -3403,7 +3403,7 @@ PmTimestamp AudioIO::MidiTime()
}
void AudioIO::AllNotesOff(bool looping)
void AudioIoCallback::AllNotesOff(bool looping)
{
#ifdef __WXGTK__
bool doDelay = !looping;

View File

@ -249,6 +249,42 @@ public:
const PaStreamCallbackTimeInfo *timeInfo,
const PaStreamCallbackFlags statusFlags, void *userData);
#ifdef EXPERIMENTAL_MIDI_OUT
void PrepareMidiIterator(bool send = true, double offset = 0);
bool StartPortMidiStream();
// Compute nondecreasing real time stamps, accounting for pauses, but not the
// synth latency.
double UncorrectedMidiEventTime();
void OutputEvent();
void FillMidiBuffers();
void GetNextEvent();
double PauseTime();
void AllNotesOff(bool looping = false);
/** \brief Compute the current PortMidi timestamp time.
*
* This is used by PortMidi to synchronize midi time to audio samples
*/
PmTimestamp MidiTime();
// Note: audio code solves the problem of soloing/muting tracks by scanning
// all playback tracks on every call to the audio buffer fill routine.
// We do the same for Midi, but it seems wasteful for at least two
// threads to be frequently polling to update status. This could be
// eliminated (also with a reduction in code I think) by updating mHasSolo
// each time a solo button is activated or deactivated. For now, I'm
// going to do this polling in the FillMidiBuffer routine to localize
// changes for midi to the midi code, but I'm declaring the variable
// here so possibly in the future, Audio code can use it too. -RBD
private:
bool mHasSolo; // is any playback solo button pressed?
public:
bool SetHasSolo(bool hasSolo);
bool GetHasSolo() { return mHasSolo; }
#endif
std::shared_ptr< AudioIOListener > GetListener() const
{ return mListener.lock(); }
void SetListener( const std::shared_ptr< AudioIOListener > &listener);
@ -612,29 +648,6 @@ public:
wxLongLong GetLastPlaybackTime() const { return mLastPlaybackTimeMillis; }
AudacityProject *GetOwningProject() const { return mOwningProject; }
#ifdef EXPERIMENTAL_MIDI_OUT
/** \brief Compute the current PortMidi timestamp time.
*
* This is used by PortMidi to synchronize midi time to audio samples
*/
PmTimestamp MidiTime();
// Note: audio code solves the problem of soloing/muting tracks by scanning
// all playback tracks on every call to the audio buffer fill routine.
// We do the same for Midi, but it seems wasteful for at least two
// threads to be frequently polling to update status. This could be
// eliminated (also with a reduction in code I think) by updating mHasSolo
// each time a solo button is activated or deactivated. For now, I'm
// going to do this polling in the FillMidiBuffer routine to localize
// changes for midi to the midi code, but I'm declaring the variable
// here so possibly in the future, Audio code can use it too. -RBD
private:
bool mHasSolo; // is any playback solo button pressed?
public:
bool SetHasSolo(bool hasSolo);
bool GetHasSolo() { return mHasSolo; }
#endif
/** \brief Pause and un-pause playback and recording */
void SetPaused(bool state);
@ -741,21 +754,6 @@ private:
sampleFormat captureFormat);
void FillBuffers();
#ifdef EXPERIMENTAL_MIDI_OUT
void PrepareMidiIterator(bool send = true, double offset = 0);
bool StartPortMidiStream();
// Compute nondecreasing real time stamps, accounting for pauses, but not the
// synth latency.
double UncorrectedMidiEventTime();
void OutputEvent();
void FillMidiBuffers();
void GetNextEvent();
double PauseTime();
void AllNotesOff(bool looping = false);
#endif
/** \brief Get the number of audio samples free in all of the playback
* buffers.
*