diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 8 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 28 |
4 files changed, 42 insertions, 1 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index b67c7034..dd046da8 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -32,6 +32,8 @@ enum UserFmtChannels { UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ + UserFmtBFormat2D = 0x10000000, /* WXY */ + UserFmtBFormat3D, /* WXYZ */ }; ALuint BytesFromUserFmt(enum UserFmtType type) DECL_CONST; @@ -56,6 +58,8 @@ enum FmtChannels { FmtX51 = UserFmtX51, FmtX61 = UserFmtX61, FmtX71 = UserFmtX71, + FmtBFormat2D = UserFmtBFormat2D, + FmtBFormat3D = UserFmtBFormat3D, }; #define MAX_INPUT_CHANNELS (8) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 191c35b7..833b5fa2 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -587,7 +587,8 @@ typedef struct ChannelConfig { enum Channel ChanName; ALfloat Angle; ALfloat Elevation; - ALfloat Coeff[MAX_AMBI_COEFFS]; + ALfloat HOACoeff[MAX_AMBI_COEFFS]; + ALfloat FOACoeff[4]; } ChannelConfig; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index fb16d143..0bf252f5 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -218,6 +218,14 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation, ALfloat ingain, ALfloat gains[MaxChannels]); /** + * ComputeBFormatGains + * + * Sets channel gains for a given (first-order) B-Format channel. The channel + * number must not be greater than 4, and the resulting gains may be negative. + */ +void ComputeBFormatGains(const ALCdevice *device, ALuint channum, ALfloat ingain, ALfloat gains[MaxChannels]); + +/** * SetGains * * Helper to set the appropriate channels to the specified gain. diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index c82b8833..09471fe8 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -189,6 +189,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi case UserFmtX51: newformat = AL_FORMAT_51CHN32; break; case UserFmtX61: newformat = AL_FORMAT_61CHN32; break; case UserFmtX71: newformat = AL_FORMAT_71CHN32; break; + case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_FLOAT32; break; + case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_FLOAT32; break; } err = LoadData(albuf, freq, newformat, size/framesize*align, srcchannels, srctype, data, align, AL_TRUE); @@ -211,6 +213,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; + case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; + case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; } err = LoadData(albuf, freq, newformat, size/framesize*align, srcchannels, srctype, data, align, AL_TRUE); @@ -233,6 +237,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; + case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; + case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; } err = LoadData(albuf, freq, newformat, size/framesize*align, srcchannels, srctype, data, align, AL_TRUE); @@ -255,6 +261,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; + case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; + case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; } err = LoadData(albuf, freq, newformat, size/framesize*align, srcchannels, srctype, data, align, AL_TRUE); @@ -1045,6 +1053,8 @@ ALuint ChannelsFromUserFmt(enum UserFmtChannels chans) case UserFmtX51: return 6; case UserFmtX61: return 7; case UserFmtX71: return 8; + case UserFmtBFormat2D: return 3; + case UserFmtBFormat3D: return 4; } return 0; } @@ -1101,6 +1111,14 @@ static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, { AL_FORMAT_71CHN16, UserFmtX71, UserFmtShort }, { AL_FORMAT_71CHN32, UserFmtX71, UserFmtFloat }, { AL_FORMAT_71CHN_MULAW, UserFmtX71, UserFmtMulaw }, + + { AL_FORMAT_BFORMAT2D_8, UserFmtBFormat2D, UserFmtUByte }, + { AL_FORMAT_BFORMAT2D_16, UserFmtBFormat2D, UserFmtShort }, + { AL_FORMAT_BFORMAT2D_FLOAT32, UserFmtBFormat2D, UserFmtFloat }, + + { AL_FORMAT_BFORMAT3D_8, UserFmtBFormat3D, UserFmtUByte }, + { AL_FORMAT_BFORMAT3D_16, UserFmtBFormat3D, UserFmtShort }, + { AL_FORMAT_BFORMAT3D_FLOAT32, UserFmtBFormat3D, UserFmtFloat }, }; ALuint i; @@ -1138,6 +1156,8 @@ ALuint ChannelsFromFmt(enum FmtChannels chans) case FmtX51: return 6; case FmtX61: return 7; case FmtX71: return 8; + case FmtBFormat2D: return 3; + case FmtBFormat3D: return 4; } return 0; } @@ -1178,6 +1198,14 @@ static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum Fm { AL_7POINT1_8_SOFT, FmtX71, FmtByte }, { AL_7POINT1_16_SOFT, FmtX71, FmtShort }, { AL_7POINT1_32F_SOFT, FmtX71, FmtFloat }, + + { AL_FORMAT_BFORMAT2D_8, FmtBFormat2D, FmtByte }, + { AL_FORMAT_BFORMAT2D_16, FmtBFormat2D, FmtShort }, + { AL_FORMAT_BFORMAT2D_FLOAT32, FmtBFormat2D, FmtFloat }, + + { AL_FORMAT_BFORMAT3D_8, FmtBFormat3D, FmtByte }, + { AL_FORMAT_BFORMAT3D_16, FmtBFormat3D, FmtShort }, + { AL_FORMAT_BFORMAT3D_FLOAT32, FmtBFormat3D, FmtFloat }, }; ALuint i; |