mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 00:34:03 +02:00
PipeWire: Try improving mono streams.
This commit is contained in:
+15
-1
@@ -32658,6 +32658,7 @@ static ma_result ma_device_init_internal__pipewire(ma_device* pDevice, ma_contex
|
|||||||
struct ma_pw_properties* pProperties;
|
struct ma_pw_properties* pProperties;
|
||||||
const struct ma_pw_stream_events* pStreamEvents;
|
const struct ma_pw_stream_events* pStreamEvents;
|
||||||
enum ma_spa_audio_format formatPA;
|
enum ma_spa_audio_format formatPA;
|
||||||
|
ma_uint32 channels;
|
||||||
struct ma_spa_pod_audio_info_raw podAudioInfo;
|
struct ma_spa_pod_audio_info_raw podAudioInfo;
|
||||||
const struct ma_spa_pod* pConnectionParameters[1];
|
const struct ma_spa_pod* pConnectionParameters[1];
|
||||||
enum ma_pw_stream_flags streamFlags;
|
enum ma_pw_stream_flags streamFlags;
|
||||||
@@ -32710,7 +32711,20 @@ static ma_result ma_device_init_internal__pipewire(ma_device* pDevice, ma_contex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
podAudioInfo = ma_spa_pod_audio_info_raw_init(formatPA, pDescriptor->channels, pDescriptor->sampleRate);
|
/*
|
||||||
|
An annoying detail here. When a single channel is requested it will be output to the FL channel and not distributed
|
||||||
|
to additional channels. This means with headphones the sound will only come out of the left side. But then there are
|
||||||
|
times when an app would literally want to output to only a single channel.
|
||||||
|
|
||||||
|
The way I'm going to deal with this is when a single channel is requested and the `MA_CHANNEL_MONO` channel position
|
||||||
|
is explicitly listed in the channel map, we'll request the "native" channel count.
|
||||||
|
*/
|
||||||
|
channels = pDescriptor->channels;
|
||||||
|
if (channels == 1 && (pDescriptor->channelMap[0] == MA_CHANNEL_NONE || pDescriptor->channelMap[0] == MA_CHANNEL_MONO)) {
|
||||||
|
channels = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
podAudioInfo = ma_spa_pod_audio_info_raw_init(formatPA, channels, pDescriptor->sampleRate);
|
||||||
pConnectionParameters[0] = (struct ma_spa_pod*)&podAudioInfo;
|
pConnectionParameters[0] = (struct ma_spa_pod*)&podAudioInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user