Skip to content

Commit cccc7a7

Browse files
committed
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.
1 parent 6b42c92 commit cccc7a7

File tree

2 files changed

+46
-48
lines changed

2 files changed

+46
-48
lines changed

src/AudioIO.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,7 @@ PmTimestamp MidiTime(void *WXUNUSED(info))
20542054
// Sends MIDI control changes up to the starting point mT0
20552055
// if send is true. Output is delayed by offset to facilitate
20562056
// looping (each iteration is delayed more).
2057-
void AudioIO::PrepareMidiIterator(bool send, double offset)
2057+
void AudioIoCallback::PrepareMidiIterator(bool send, double offset)
20582058
{
20592059
int i;
20602060
int nTracks = mMidiPlaybackTracks.size();
@@ -2085,7 +2085,7 @@ void AudioIO::PrepareMidiIterator(bool send, double offset)
20852085
mSendMidiState = false;
20862086
}
20872087

2088-
bool AudioIO::StartPortMidiStream()
2088+
bool AudioIoCallback::StartPortMidiStream()
20892089
{
20902090
int i;
20912091
int nTracks = mMidiPlaybackTracks.size();
@@ -3093,7 +3093,7 @@ void AudioIoCallback::SetListener(
30933093
static Alg_update gAllNotesOff; // special event for loop ending
30943094
// the fields of this event are never used, only the address is important
30953095

3096-
double AudioIO::UncorrectedMidiEventTime()
3096+
double AudioIoCallback::UncorrectedMidiEventTime()
30973097
{
30983098
double time;
30993099
if (mPlaybackSchedule.mEnvelope)
@@ -3107,7 +3107,7 @@ double AudioIO::UncorrectedMidiEventTime()
31073107
return time + PauseTime();
31083108
}
31093109

3110-
void AudioIO::OutputEvent()
3110+
void AudioIoCallback::OutputEvent()
31113111
{
31123112
int channel = (mNextEvent->chan) & 0xF; // must be in [0..15]
31133113
int command = -1;
@@ -3254,7 +3254,7 @@ void AudioIO::OutputEvent()
32543254
}
32553255
}
32563256

3257-
void AudioIO::GetNextEvent()
3257+
void AudioIoCallback::GetNextEvent()
32583258
{
32593259
mNextEventTrack = NULL; // clear it just to be safe
32603260
// now get the next event and the track from which it came
@@ -3283,14 +3283,14 @@ void AudioIO::GetNextEvent()
32833283
}
32843284

32853285

3286-
bool AudioIO::SetHasSolo(bool hasSolo)
3286+
bool AudioIoCallback::SetHasSolo(bool hasSolo)
32873287
{
32883288
mHasSolo = hasSolo;
32893289
return mHasSolo;
32903290
}
32913291

32923292

3293-
void AudioIO::FillMidiBuffers()
3293+
void AudioIoCallback::FillMidiBuffers()
32943294
{
32953295
// Keep track of time paused. If not paused, fill buffers.
32963296
if (IsPaused()) {
@@ -3369,7 +3369,7 @@ void AudioIO::FillMidiBuffers()
33693369
// !mNextEvent);
33703370
}
33713371

3372-
double AudioIO::PauseTime()
3372+
double AudioIoCallback::PauseTime()
33733373
{
33743374
return mNumPauseFrames / mRate;
33753375
}
@@ -3379,7 +3379,7 @@ double AudioIO::PauseTime()
33793379
// output (DAC) time + 1s. In other words, what audacity track time
33803380
// corresponds to the audio (including pause insertions) at the output?
33813381
//
3382-
PmTimestamp AudioIO::MidiTime()
3382+
PmTimestamp AudioIoCallback::MidiTime()
33833383
{
33843384
// note: the extra 0.0005 is for rounding. Round down by casting to
33853385
// unsigned long, then convert to PmTimeStamp (currently signed)
@@ -3403,7 +3403,7 @@ PmTimestamp AudioIO::MidiTime()
34033403
}
34043404

34053405

3406-
void AudioIO::AllNotesOff(bool looping)
3406+
void AudioIoCallback::AllNotesOff(bool looping)
34073407
{
34083408
#ifdef __WXGTK__
34093409
bool doDelay = !looping;

src/AudioIO.h

+36-38
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,42 @@ class AUDACITY_DLL_API AudioIoCallback /* not final */
249249
const PaStreamCallbackTimeInfo *timeInfo,
250250
const PaStreamCallbackFlags statusFlags, void *userData);
251251

252+
#ifdef EXPERIMENTAL_MIDI_OUT
253+
void PrepareMidiIterator(bool send = true, double offset = 0);
254+
bool StartPortMidiStream();
255+
256+
// Compute nondecreasing real time stamps, accounting for pauses, but not the
257+
// synth latency.
258+
double UncorrectedMidiEventTime();
259+
260+
void OutputEvent();
261+
void FillMidiBuffers();
262+
void GetNextEvent();
263+
double PauseTime();
264+
void AllNotesOff(bool looping = false);
265+
266+
/** \brief Compute the current PortMidi timestamp time.
267+
*
268+
* This is used by PortMidi to synchronize midi time to audio samples
269+
*/
270+
PmTimestamp MidiTime();
271+
272+
// Note: audio code solves the problem of soloing/muting tracks by scanning
273+
// all playback tracks on every call to the audio buffer fill routine.
274+
// We do the same for Midi, but it seems wasteful for at least two
275+
// threads to be frequently polling to update status. This could be
276+
// eliminated (also with a reduction in code I think) by updating mHasSolo
277+
// each time a solo button is activated or deactivated. For now, I'm
278+
// going to do this polling in the FillMidiBuffer routine to localize
279+
// changes for midi to the midi code, but I'm declaring the variable
280+
// here so possibly in the future, Audio code can use it too. -RBD
281+
private:
282+
bool mHasSolo; // is any playback solo button pressed?
283+
public:
284+
bool SetHasSolo(bool hasSolo);
285+
bool GetHasSolo() { return mHasSolo; }
286+
#endif
287+
252288
std::shared_ptr< AudioIOListener > GetListener() const
253289
{ return mListener.lock(); }
254290
void SetListener( const std::shared_ptr< AudioIOListener > &listener);
@@ -612,29 +648,6 @@ class AUDACITY_DLL_API AudioIO final
612648
wxLongLong GetLastPlaybackTime() const { return mLastPlaybackTimeMillis; }
613649
AudacityProject *GetOwningProject() const { return mOwningProject; }
614650

615-
#ifdef EXPERIMENTAL_MIDI_OUT
616-
/** \brief Compute the current PortMidi timestamp time.
617-
*
618-
* This is used by PortMidi to synchronize midi time to audio samples
619-
*/
620-
PmTimestamp MidiTime();
621-
622-
// Note: audio code solves the problem of soloing/muting tracks by scanning
623-
// all playback tracks on every call to the audio buffer fill routine.
624-
// We do the same for Midi, but it seems wasteful for at least two
625-
// threads to be frequently polling to update status. This could be
626-
// eliminated (also with a reduction in code I think) by updating mHasSolo
627-
// each time a solo button is activated or deactivated. For now, I'm
628-
// going to do this polling in the FillMidiBuffer routine to localize
629-
// changes for midi to the midi code, but I'm declaring the variable
630-
// here so possibly in the future, Audio code can use it too. -RBD
631-
private:
632-
bool mHasSolo; // is any playback solo button pressed?
633-
public:
634-
bool SetHasSolo(bool hasSolo);
635-
bool GetHasSolo() { return mHasSolo; }
636-
#endif
637-
638651
/** \brief Pause and un-pause playback and recording */
639652
void SetPaused(bool state);
640653

@@ -741,21 +754,6 @@ class AUDACITY_DLL_API AudioIO final
741754
sampleFormat captureFormat);
742755
void FillBuffers();
743756

744-
#ifdef EXPERIMENTAL_MIDI_OUT
745-
void PrepareMidiIterator(bool send = true, double offset = 0);
746-
bool StartPortMidiStream();
747-
748-
// Compute nondecreasing real time stamps, accounting for pauses, but not the
749-
// synth latency.
750-
double UncorrectedMidiEventTime();
751-
752-
void OutputEvent();
753-
void FillMidiBuffers();
754-
void GetNextEvent();
755-
double PauseTime();
756-
void AllNotesOff(bool looping = false);
757-
#endif
758-
759757
/** \brief Get the number of audio samples free in all of the playback
760758
* buffers.
761759
*

0 commit comments

Comments
 (0)