diff options
author | Chris Robinson <[email protected]> | 2021-10-23 07:51:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-10-23 07:51:06 -0700 |
commit | d0e5e138e279f40f92b7d41d885695a206ec36c0 (patch) | |
tree | 5edc0e4bd84ad92d6722cb140d347860180a6ff0 /alc/backends | |
parent | 0e93fc53f4cf5bdc749a23a46573d690b2f1c443 (diff) |
Use a flag to indicate headphone-like output
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/dsound.cpp | 3 | ||||
-rw-r--r-- | alc/backends/pipewire.cpp | 4 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 4 | ||||
-rw-r--r-- | alc/backends/wasapi.cpp | 3 |
4 files changed, 6 insertions, 8 deletions
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp index 6513e8f3..acac4786 100644 --- a/alc/backends/dsound.cpp +++ b/alc/backends/dsound.cpp @@ -409,8 +409,7 @@ bool DSoundPlayback::reset() else ERR("Unknown system speaker config: 0x%lx\n", speakers); } - mDevice->IsHeadphones = mDevice->FmtChans == DevFmtStereo - && speakers == DSSPEAKER_HEADPHONE; + mDevice->Flags.set(DirectEar, (speakers == DSSPEAKER_HEADPHONE)); switch(mDevice->FmtChans) { diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 82b7a22f..5b172551 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -1185,7 +1185,7 @@ bool PipeWirePlayback::reset() /* If connecting to a specific device, update various device parameters to * match its format. */ - mDevice->IsHeadphones = false; + mDevice->Flags.reset(DirectEar); if(mTargetId != PwIdAny) { EventWatcherLockGuard _{gEventHandler}; @@ -1207,7 +1207,7 @@ bool PipeWirePlayback::reset() if(!mDevice->Flags.test(ChannelsRequest) && match->mChannels != InvalidChannelConfig) mDevice->FmtChans = match->mChannels; if(match->mChannels == DevFmtStereo && match->mIsHeadphones) - mDevice->IsHeadphones = true; + mDevice->Flags.set(DirectEar); } } /* Force planar 32-bit float output for playback. This is what PipeWire diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index cece08a0..84d9351a 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -815,8 +815,8 @@ void PulsePlayback::sinkInfoCallback(pa_context*, const pa_sink_info *info, int if(info->active_port) TRACE("Active port: %s (%s)\n", info->active_port->name, info->active_port->description); - mDevice->IsHeadphones = (mDevice->FmtChans == DevFmtStereo - && info->active_port && strcmp(info->active_port->name, "analog-output-headphones") == 0); + mDevice->Flags.set(DirectEar, (info->active_port + && strcmp(info->active_port->name, "analog-output-headphones") == 0)); } void PulsePlayback::sinkNameCallback(pa_context*, const pa_sink_info *info, int eol) noexcept diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp index c5c14d22..4abed9d3 100644 --- a/alc/backends/wasapi.cpp +++ b/alc/backends/wasapi.cpp @@ -1051,8 +1051,7 @@ HRESULT WasapiPlayback::resetProxy() mFrameStep = OutputType.Format.nChannels; const EndpointFormFactor formfactor{get_device_formfactor(mMMDev.get())}; - mDevice->IsHeadphones = (mDevice->FmtChans == DevFmtStereo - && (formfactor == Headphones || formfactor == Headset)); + mDevice->Flags.set(DirectEar, (formfactor == Headphones || formfactor == Headset)); setChannelOrderFromWFXMask(OutputType.dwChannelMask); |