1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-19 14:17:41 +02:00

Fix --without-midi build

See downstream bug: https://bugs.gentoo.org/637110
This commit is contained in:
Matt Whitlock 2018-02-21 12:19:19 +01:00 committed by Lars Wendler
parent f665e6da2b
commit e1f0e974d0
No known key found for this signature in database
GPG Key ID: 571DD2D0343C6039
5 changed files with 27 additions and 3 deletions

View File

@ -976,6 +976,7 @@ private:
}; };
#endif #endif
#ifdef EXPERIMENTAL_MIDI_OUT
// return the system time as a double // return the system time as a double
static double streamStartTime = 0; // bias system time to small number static double streamStartTime = 0; // bias system time to small number
@ -995,6 +996,7 @@ static double SystemTime(bool usingAlsa)
return PaUtil_GetTime() - streamStartTime; return PaUtil_GetTime() - streamStartTime;
} }
#endif
const int AudioIO::StandardRates[] = { const int AudioIO::StandardRates[] = {
8000, 8000,
@ -1803,6 +1805,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
} }
#endif #endif
#ifdef EXPERIMENTAL_MIDI_OUT
// We use audio latency to estimate how far ahead of DACS we are writing // We use audio latency to estimate how far ahead of DACS we are writing
if (mPortStreamV19 != NULL && mLastPaError == paNoError) { if (mPortStreamV19 != NULL && mLastPaError == paNoError) {
const PaStreamInfo* info = Pa_GetStreamInfo(mPortStreamV19); const PaStreamInfo* info = Pa_GetStreamInfo(mPortStreamV19);
@ -1811,6 +1814,7 @@ bool AudioIO::StartPortAudioStream(double sampleRate,
mAudioOutLatency = info->outputLatency; mAudioOutLatency = info->outputLatency;
mSystemMinusAudioTimePlusLatency += mAudioOutLatency; mSystemMinusAudioTimePlusLatency += mAudioOutLatency;
} }
#endif
return (mLastPaError == paNoError); return (mLastPaError == paNoError);
} }
@ -1955,8 +1959,10 @@ int AudioIO::StartStream(const WaveTrackConstArray &playbackTracks,
double playbackTime = 4.0; double playbackTime = 4.0;
#ifdef EXPERIMENTAL_MIDI_OUT
streamStartTime = 0; streamStartTime = 0;
streamStartTime = SystemTime(mUsingAlsa); streamStartTime = SystemTime(mUsingAlsa);
#endif
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
bool scrubbing = (options.pScrubbingOptions != nullptr); bool scrubbing = (options.pScrubbingOptions != nullptr);
@ -2830,7 +2836,9 @@ void AudioIO::StopStream()
mPlaybackTracks.clear(); mPlaybackTracks.clear();
mCaptureTracks.clear(); mCaptureTracks.clear();
#ifdef HAVE_MIDI
mMidiPlaybackTracks.clear(); mMidiPlaybackTracks.clear();
#endif
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT #ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
mScrubQueue.reset(); mScrubQueue.reset();
@ -4669,13 +4677,13 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
(float *)alloca(framesPerBuffer*numPlaybackChannels * sizeof(float)) : (float *)alloca(framesPerBuffer*numPlaybackChannels * sizeof(float)) :
(float *)outputBuffer; (float *)outputBuffer;
#ifdef EXPERIMENTAL_MIDI_OUT
if (gAudioIO->mCallbackCount++ == 0) { if (gAudioIO->mCallbackCount++ == 0) {
// This is effectively mSystemMinusAudioTime when the buffer is empty: // This is effectively mSystemMinusAudioTime when the buffer is empty:
gAudioIO->mStartTime = SystemTime(gAudioIO->mUsingAlsa) - gAudioIO->mT0; gAudioIO->mStartTime = SystemTime(gAudioIO->mUsingAlsa) - gAudioIO->mT0;
// later, mStartTime - mSystemMinusAudioTime will tell us latency // later, mStartTime - mSystemMinusAudioTime will tell us latency
} }
#ifdef EXPERIMENTAL_MIDI_OUT
/* GSW: Save timeInfo in case MidiPlayback needs it */ /* GSW: Save timeInfo in case MidiPlayback needs it */
gAudioIO->mAudioCallbackClockTime = PaUtil_GetTime(); gAudioIO->mAudioCallbackClockTime = PaUtil_GetTime();
@ -5051,7 +5059,9 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
: gAudioIO->mTime >= gAudioIO->mT1)) : gAudioIO->mTime >= gAudioIO->mT1))
// PRL: singalling MIDI output complete is necessary if // PRL: singalling MIDI output complete is necessary if
// not USE_MIDI_THREAD, otherwise it's harmlessly redundant // not USE_MIDI_THREAD, otherwise it's harmlessly redundant
#ifdef EXPERIMENTAL_MIDI_OUT
gAudioIO->mMidiOutputComplete = true, gAudioIO->mMidiOutputComplete = true,
#endif
callbackReturn = paComplete; callbackReturn = paComplete;
} }
@ -5114,7 +5124,9 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
// PRL: singalling MIDI output complete is necessary if // PRL: singalling MIDI output complete is necessary if
// not USE_MIDI_THREAD, otherwise it's harmlessly redundant // not USE_MIDI_THREAD, otherwise it's harmlessly redundant
#ifdef EXPERIMENTAL_MIDI_OUT
gAudioIO->mMidiOutputComplete = true, gAudioIO->mMidiOutputComplete = true,
#endif
callbackReturn = paComplete; callbackReturn = paComplete;
} }
} }

View File

@ -460,10 +460,11 @@ public:
} ); } );
for (const auto &name : sortednames) { for (const auto &name : sortednames) {
#ifdef USE_MIDI
if (Importer::IsMidi(name)) if (Importer::IsMidi(name))
AudacityProject::DoImportMIDI(mProject, name); AudacityProject::DoImportMIDI(mProject, name);
else else
#endif
mProject->Import(name); mProject->Import(name);
} }
@ -3046,9 +3047,11 @@ void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory)
#endif #endif
{ {
#ifdef USE_MIDI
if (Importer::IsMidi(fileName)) if (Importer::IsMidi(fileName))
DoImportMIDI(this, fileName); DoImportMIDI(this, fileName);
else else
#endif
Import(fileName); Import(fileName);
ZoomAfterImport(nullptr); ZoomAfterImport(nullptr);

View File

@ -9,6 +9,9 @@ Paul Licameli split from TrackPanel.cpp
**********************************************************************/ **********************************************************************/
#include "../../../../Audacity.h" #include "../../../../Audacity.h"
#ifdef USE_MIDI
#include "NoteTrackButtonHandle.h" #include "NoteTrackButtonHandle.h"
#include "../../../../HitTestResult.h" #include "../../../../HitTestResult.h"
@ -113,3 +116,4 @@ UIHandle::Result NoteTrackButtonHandle::Cancel(AudacityProject *)
return RefreshCode::RefreshNone; return RefreshCode::RefreshNone;
} }
#endif

View File

@ -9,6 +9,9 @@ Paul Licameli split from TrackPanel.cpp
**********************************************************************/ **********************************************************************/
#include "../../../../Audacity.h" #include "../../../../Audacity.h"
#ifdef USE_MIDI
#include "NoteTrackVZoomHandle.h" #include "NoteTrackVZoomHandle.h"
#include "../../../../Experimental.h" #include "../../../../Experimental.h"
#include "NoteTrackVRulerControls.h" #include "NoteTrackVRulerControls.h"
@ -332,3 +335,5 @@ void NoteTrackVZoomHandle::DrawExtras
TrackVRulerControls::DrawZooming TrackVRulerControls::DrawZooming
( dc, mRect, panelRect, mZoomStart, mZoomEnd ); ( dc, mRect, panelRect, mZoomStart, mZoomEnd );
} }
#endif

View File

@ -604,7 +604,7 @@ UIHandle::Result TimeShiftHandle::Drag
{ {
trySnap = true; trySnap = true;
if (pTrack->GetKind() == Track::Wave) { if (pTrack->GetKind() == Track::Wave) {
auto wt = static_cast<const WaveTrack *>(pTrack); auto wt = static_cast<const WaveTrack *>(pTrack.get());
const double rate = wt->GetRate(); const double rate = wt->GetRate();
// set it to a sample point // set it to a sample point
desiredSlideAmount = rint(desiredSlideAmount * rate) / rate; desiredSlideAmount = rint(desiredSlideAmount * rate) / rate;