Detect whether ALSA is the portaudio host (possible only on Linux)

This commit is contained in:
Paul Licameli 2017-09-23 21:23:34 -04:00
parent 428f543677
commit a971dd5bb4
2 changed files with 9 additions and 2 deletions

View File

@ -1678,6 +1678,12 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
wxMilliSleep( 50 );
}
#ifdef __WXGTK__
// Detect whether ALSA is the chosen host, and do the various involved MIDI
// timing compensations only then.
mUsingAlsa = (gPrefs->Read(wxT("/AudioIO/Host"), wxT("")) == "ALSA");
#endif
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &mSoftwarePlaythrough, false);
gPrefs->Read(wxT("/AudioIO/SoundActivatedRecord"), &mPauseRec, false);
int silenceLevelDB;
@ -2033,8 +2039,7 @@ int AudioIO::StartStream(const ConstWaveTrackArray &playbackTracks,
// (Which we should be able to determine from fields of
// PaStreamCallbackTimeInfo, but that seems not to work as documented with
// ALSA.)
wxString hostName = gPrefs->Read(wxT("/AudioIO/Host"), wxT(""));
if (hostName == "ALSA")
if (mUsingAlsa)
// Perhaps we should do this only if also playing MIDI ?
PaAlsa_EnableRealtimeScheduling( mPortStreamV19, 1 );
#endif

View File

@ -727,6 +727,8 @@ private:
const TimeTrack *mTimeTrack;
bool mUsingAlsa { false };
// For cacheing supported sample rates
static int mCachedPlaybackIndex;
static wxArrayLong mCachedPlaybackRates;