dsound: Support quadraphonic sound.
This commit is contained in:
parent
b81e79ed08
commit
3ba100d81c
|
@ -606,6 +606,19 @@ void DSOUND_ParseSpeakerConfig(DirectSoundDevice *device)
|
|||
device->lfe_channel = -1;
|
||||
break;
|
||||
|
||||
case DSSPEAKER_QUAD:
|
||||
device->speaker_angles[0] = M_PI/180.0f * -135.0f;
|
||||
device->speaker_angles[1] = M_PI/180.0f * -45.0f;
|
||||
device->speaker_angles[2] = M_PI/180.0f * 45.0f;
|
||||
device->speaker_angles[3] = M_PI/180.0f * 135.0f;
|
||||
device->speaker_num[0] = 2; /* Rear left */
|
||||
device->speaker_num[1] = 0; /* Front left */
|
||||
device->speaker_num[2] = 1; /* Front right */
|
||||
device->speaker_num[3] = 3; /* Rear right */
|
||||
device->num_speakers = 4;
|
||||
device->lfe_channel = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN("unknown speaker_config %u\n", device->speaker_config);
|
||||
}
|
||||
|
|
|
@ -165,6 +165,25 @@ void put_mono2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel
|
|||
dsb->put_aux(dsb, pos, 1, value);
|
||||
}
|
||||
|
||||
void put_mono2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value)
|
||||
{
|
||||
dsb->put_aux(dsb, pos, 0, value);
|
||||
dsb->put_aux(dsb, pos, 1, value);
|
||||
dsb->put_aux(dsb, pos, 2, value);
|
||||
dsb->put_aux(dsb, pos, 3, value);
|
||||
}
|
||||
|
||||
void put_stereo2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value)
|
||||
{
|
||||
if (channel == 0) { /* Left */
|
||||
dsb->put_aux(dsb, pos, 0, value); /* Front left */
|
||||
dsb->put_aux(dsb, pos, 2, value); /* Back left */
|
||||
} else if (channel == 1) { /* Right */
|
||||
dsb->put_aux(dsb, pos, 1, value); /* Front right */
|
||||
dsb->put_aux(dsb, pos, 3, value); /* Back right */
|
||||
}
|
||||
}
|
||||
|
||||
void mixieee32(float *src, float *dst, unsigned samples)
|
||||
{
|
||||
TRACE("%p - %p %d\n", src, dst, samples);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "wine/list.h"
|
||||
|
||||
#define DS_MAX_CHANNELS 2
|
||||
#define DS_MAX_CHANNELS 4
|
||||
|
||||
extern int ds_hel_buflen DECLSPEC_HIDDEN;
|
||||
extern int ds_snd_queue_max DECLSPEC_HIDDEN;
|
||||
|
@ -179,6 +179,8 @@ struct IDirectSoundBufferImpl
|
|||
|
||||
float get_mono(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel) DECLSPEC_HIDDEN;
|
||||
void put_mono2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
|
||||
void put_mono2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
|
||||
void put_stereo2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT IDirectSoundBufferImpl_Create(
|
||||
DirectSoundDevice *device,
|
||||
|
|
|
@ -151,13 +151,22 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb)
|
|||
else if (ichannels == 1)
|
||||
{
|
||||
dsb->mix_channels = 1;
|
||||
dsb->put = put_mono2stereo;
|
||||
|
||||
if (ochannels == 2)
|
||||
dsb->put = put_mono2stereo;
|
||||
else if (ochannels == 4)
|
||||
dsb->put = put_mono2quad;
|
||||
}
|
||||
else if (ochannels == 1)
|
||||
{
|
||||
dsb->mix_channels = 1;
|
||||
dsb->get = get_mono;
|
||||
}
|
||||
else if (ichannels == 2 && ochannels == 4)
|
||||
{
|
||||
dsb->mix_channels = 2;
|
||||
dsb->put = put_stereo2quad;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ichannels > 2)
|
||||
|
|
|
@ -67,6 +67,9 @@ static DWORD speaker_config_to_channel_mask(DWORD speaker_config)
|
|||
case DSSPEAKER_STEREO:
|
||||
case DSSPEAKER_HEADPHONE:
|
||||
return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
|
||||
|
||||
case DSSPEAKER_QUAD:
|
||||
return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
|
||||
}
|
||||
|
||||
WARN("unknown speaker_config %u\n", speaker_config);
|
||||
|
@ -192,7 +195,9 @@ static DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice)
|
|||
PropVariantClear(&pv);
|
||||
IPropertyStore_Release(store);
|
||||
|
||||
if ((phys_speakers & KSAUDIO_SPEAKER_STEREO) == KSAUDIO_SPEAKER_STEREO)
|
||||
if ((phys_speakers & KSAUDIO_SPEAKER_QUAD) == KSAUDIO_SPEAKER_QUAD)
|
||||
return DSSPEAKER_QUAD;
|
||||
else if ((phys_speakers & KSAUDIO_SPEAKER_STEREO) == KSAUDIO_SPEAKER_STEREO)
|
||||
return DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE);
|
||||
else if ((phys_speakers & KSAUDIO_SPEAKER_MONO) == KSAUDIO_SPEAKER_MONO)
|
||||
return DSSPEAKER_MONO;
|
||||
|
|
Loading…
Reference in New Issue