Skip to content

Commit

Permalink
AudioIO: Change PA_USE_WMME to _WIN32
Browse files Browse the repository at this point in the history
For some reason, PA_USE_WMME isn't being defined on Windows. Since MME
is a Windows-only backend, it's safe to use _WIN32 for now.

Signed-off-by: Avery King <[email protected]>
  • Loading branch information
generic-pers0n committed Nov 23, 2024
1 parent 3a85a42 commit 4de624a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/AudioIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ time warp info and AudioIOListener and whether the playback is looped.
#include "pa_jack.h"
#endif

#ifdef PA_USE_WMME
#ifdef _WIN32
#include <pa_win_wmme.h>
#endif

Expand Down Expand Up @@ -439,7 +439,9 @@ bool AudioIO::StartPortAudioStream(const AudioIOStartStreamOptions &options,
// To fix this, set paWinMmeUseLowLevelLatencyParameters in low level stream
// flags so that MME can work with smaller buffer sizes.
// See https://codeberg.org/tenacityteam/tenacity/issues/220.
#ifdef PA_USE_WMME
// FIXME: For some reason, PA_USE_WMME isn't defined on Windows despite it
// being an available backend. Just use _WIN32 for now...
#ifdef _WIN32
PaWinMmeStreamInfo mmeParameters;
mmeParameters.size = sizeof(PaWinMmeStreamInfo);
mmeParameters.hostApiType = paMME;
Expand Down Expand Up @@ -468,12 +470,12 @@ bool AudioIO::StartPortAudioStream(const AudioIOStartStreamOptions &options,
// regardless of source formats, we always mix to float
playbackParameters.sampleFormat = paFloat32;
playbackParameters.hostApiSpecificStreamInfo = nullptr;
#ifdef PA_USE_WMME
#ifdef _WIN32
if (Pa_HostApiTypeIdToHostApiIndex(paMME) == playbackDeviceInfo->hostApi)
{
playbackParameters.hostApiSpecificStreamInfo = &mmeParameters;
}
#endif // end PA_USE_WMME
#endif // end _WIN32
playbackParameters.channelCount = mNumPlaybackChannels;

playbackParameters.suggestedLatency = mSoftwarePlaythrough ?
Expand Down Expand Up @@ -502,12 +504,12 @@ bool AudioIO::StartPortAudioStream(const AudioIOStartStreamOptions &options,
AudacityToPortAudioSampleFormat(mCaptureFormat);

captureParameters.hostApiSpecificStreamInfo = nullptr;
#ifdef PA_USE_WMME
#ifdef _WIN32
if (Pa_HostApiTypeIdToHostApiIndex(paMME) == captureDeviceInfo->hostApi)
{
captureParameters.hostApiSpecificStreamInfo = &mmeParameters;
}
#endif // end PA_USE_WMME
#endif // end _WIN32
captureParameters.channelCount = mNumCaptureChannels;
captureParameters.suggestedLatency = mSoftwarePlaythrough ?
captureDeviceInfo->defaultHighInputLatency :
Expand Down

0 comments on commit 4de624a

Please sign in to comment.