diff options
-rw-r--r-- | Alc/ALc.c | 108 | ||||
-rw-r--r-- | Alc/ALu.c | 35 | ||||
-rw-r--r-- | Alc/panning.c | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 2 |
4 files changed, 67 insertions, 81 deletions
@@ -1433,63 +1433,63 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) ALuint i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - device->Dry.ChannelName[i] = InvalidChannel; + device->RealOut.ChannelName[i] = InvalidChannel; switch(device->FmtChans) { case DevFmtMono: - device->Dry.ChannelName[0] = FrontCenter; + device->RealOut.ChannelName[0] = FrontCenter; break; case DevFmtStereo: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; break; case DevFmtQuad: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = BackLeft; - device->Dry.ChannelName[3] = BackRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = BackLeft; + device->RealOut.ChannelName[3] = BackRight; break; case DevFmtX51: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = FrontCenter; - device->Dry.ChannelName[3] = LFE; - device->Dry.ChannelName[4] = SideLeft; - device->Dry.ChannelName[5] = SideRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = FrontCenter; + device->RealOut.ChannelName[3] = LFE; + device->RealOut.ChannelName[4] = SideLeft; + device->RealOut.ChannelName[5] = SideRight; break; case DevFmtX51Rear: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = FrontCenter; - device->Dry.ChannelName[3] = LFE; - device->Dry.ChannelName[4] = BackLeft; - device->Dry.ChannelName[5] = BackRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = FrontCenter; + device->RealOut.ChannelName[3] = LFE; + device->RealOut.ChannelName[4] = BackLeft; + device->RealOut.ChannelName[5] = BackRight; break; case DevFmtX61: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = FrontCenter; - device->Dry.ChannelName[3] = LFE; - device->Dry.ChannelName[4] = BackCenter; - device->Dry.ChannelName[5] = SideLeft; - device->Dry.ChannelName[6] = SideRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = FrontCenter; + device->RealOut.ChannelName[3] = LFE; + device->RealOut.ChannelName[4] = BackCenter; + device->RealOut.ChannelName[5] = SideLeft; + device->RealOut.ChannelName[6] = SideRight; break; case DevFmtX71: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = FrontCenter; - device->Dry.ChannelName[3] = LFE; - device->Dry.ChannelName[4] = BackLeft; - device->Dry.ChannelName[5] = BackRight; - device->Dry.ChannelName[6] = SideLeft; - device->Dry.ChannelName[7] = SideRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = FrontCenter; + device->RealOut.ChannelName[3] = LFE; + device->RealOut.ChannelName[4] = BackLeft; + device->RealOut.ChannelName[5] = BackRight; + device->RealOut.ChannelName[6] = SideLeft; + device->RealOut.ChannelName[7] = SideRight; break; case DevFmtBFormat3D: - device->Dry.ChannelName[0] = BFormatW; - device->Dry.ChannelName[1] = BFormatX; - device->Dry.ChannelName[2] = BFormatY; - device->Dry.ChannelName[3] = BFormatZ; + device->RealOut.ChannelName[0] = BFormatW; + device->RealOut.ChannelName[1] = BFormatX; + device->RealOut.ChannelName[2] = BFormatY; + device->RealOut.ChannelName[3] = BFormatZ; break; } } @@ -1503,27 +1503,27 @@ void SetDefaultChannelOrder(ALCdevice *device) ALuint i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - device->Dry.ChannelName[i] = InvalidChannel; + device->RealOut.ChannelName[i] = InvalidChannel; switch(device->FmtChans) { case DevFmtX51Rear: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = BackLeft; - device->Dry.ChannelName[3] = BackRight; - device->Dry.ChannelName[4] = FrontCenter; - device->Dry.ChannelName[5] = LFE; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = BackLeft; + device->RealOut.ChannelName[3] = BackRight; + device->RealOut.ChannelName[4] = FrontCenter; + device->RealOut.ChannelName[5] = LFE; return; case DevFmtX71: - device->Dry.ChannelName[0] = FrontLeft; - device->Dry.ChannelName[1] = FrontRight; - device->Dry.ChannelName[2] = BackLeft; - device->Dry.ChannelName[3] = BackRight; - device->Dry.ChannelName[4] = FrontCenter; - device->Dry.ChannelName[5] = LFE; - device->Dry.ChannelName[6] = SideLeft; - device->Dry.ChannelName[7] = SideRight; + device->RealOut.ChannelName[0] = FrontLeft; + device->RealOut.ChannelName[1] = FrontRight; + device->RealOut.ChannelName[2] = BackLeft; + device->RealOut.ChannelName[3] = BackRight; + device->RealOut.ChannelName[4] = FrontCenter; + device->RealOut.ChannelName[5] = LFE; + device->RealOut.ChannelName[6] = SideLeft; + device->RealOut.ChannelName[7] = SideRight; return; /* Same as WFX order */ @@ -101,28 +101,6 @@ extern inline void aluMatrixdSet(aluMatrixd *matrix, ALdouble m30, ALdouble m31, ALdouble m32, ALdouble m33); -/* NOTE: HRTF and UHJ are set up a bit special in the device. Normally the - * device's DryBuffer, NumChannels, ChannelName, and Channel fields correspond - * to the output format, and the DryBuffer is then converted and written to the - * backend's audio buffer. - * - * With HRTF or UHJ, these fields correspond to a virtual format, and the - * actual output is stored in DryBuffer[NumChannels] for the left channel and - * DryBuffer[NumChannels+1] for the right. As a final output step, - * the virtual channels will have HRTF filters or UHJ encoding applied and - * written to the actual output. - * - * Sources that get mixed using HRTF directly (or that want to skip HRTF or UHJ - * completely) will need to offset the output buffer so that they skip the - * virtual output and write to the actual output channels. This is the reason - * you'll see - * - * voice->Direct.OutBuffer += voice->Direct.OutChannels; - * voice->Direct.OutChannels = 2; - * - * at various points in the code where HRTF is explicitly used or bypassed. - */ - static inline HrtfMixerFunc SelectHrtfMixer(void) { #ifdef HAVE_SSE @@ -587,11 +565,14 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A { for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) voice->Direct.Gains[c].Target[j] = 0.0f; - - if(chans[c].channel == FrontLeft) - voice->Direct.Gains[c].Target[0] = DryGain; - else if(chans[c].channel == FrontRight) - voice->Direct.Gains[c].Target[1] = DryGain; + for(j = 0;j < Device->RealOut.NumChannels;j++) + { + if(chans[c].channel == Device->RealOut.ChannelName[j]) + { + voice->Direct.Gains[c].Target[j] = DryGain; + break; + } + } } } else for(c = 0;c < num_channels;c++) diff --git a/Alc/panning.c b/Alc/panning.c index 8ac1d4d2..beb928d9 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -557,6 +557,9 @@ ALvoid aluInitPanning(ALCdevice *device) return; } + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + device->Dry.ChannelName[i] = device->RealOut.ChannelName[i]; + if(LoadChannelSetup(device)) return; diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 837b2be8..fc55b93b 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -510,6 +510,8 @@ struct ALCdevice_struct } VirtOut; /* "Real" output, which will be written to the device buffer. */ struct { + enum Channel ChannelName[MAX_OUTPUT_CHANNELS]; + ALfloat (*Buffer)[BUFFERSIZE]; ALuint NumChannels; } RealOut; |