mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Add per-sound volume support to audiolib. This allows you to control the volume of sounds independently from the distance-based system exposed through CON. To use this, you must define your sounds via the .def syntax and set the "volume" property--default is 1.0.
git-svn-id: https://svn.eduke32.com/eduke32@7117 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
98f42cba6f
commit
374a09536d
16 changed files with 297 additions and 352 deletions
|
@ -64,9 +64,9 @@ int32_t FX_Shutdown(void);
|
|||
|
||||
|
||||
int32_t FX_Play(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t FX_Play3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval);
|
||||
int32_t distance, int32_t priority, float volume, uint32_t callbackval);
|
||||
|
||||
|
||||
int32_t FX_SetPrintf(void(*function)(const char *, ...));
|
||||
|
|
|
@ -86,30 +86,30 @@ void MV_SetReverbDelay(int32_t delay);
|
|||
// int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits );
|
||||
// int32_t MV_StartPlayback( void );
|
||||
// void MV_StopPlayback( void );
|
||||
int32_t MV_PlayWAV3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayWAV(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayVOC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayVOC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayVorbis3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayFLAC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayXA3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayXA(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayXMP3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval);
|
||||
int32_t MV_PlayWAV3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority,
|
||||
float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayWAV(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayVOC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority,
|
||||
float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayVOC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayVorbis3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority,
|
||||
float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayFLAC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority,
|
||||
float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayXA3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, float volume,
|
||||
uint32_t callbackval);
|
||||
int32_t MV_PlayXA(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayXMP3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority,
|
||||
float volume, uint32_t callbackval);
|
||||
int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval);
|
||||
|
||||
int MV_IdentifyXMP(char const *ptr, uint32_t length);
|
||||
|
||||
|
|
|
@ -49,13 +49,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define MV_MAXPANPOSITION 127 /* formerly 31 */
|
||||
#define MV_NUMPANPOSITIONS ( MV_MAXPANPOSITION + 1 )
|
||||
#define MV_MAXTOTALVOLUME 255
|
||||
#define MV_MAXVOLUME 255 /* formerly 63 */
|
||||
#define MV_MAXVOLUME 127 /* formerly 63 */
|
||||
#define MV_NUMVOICES 8
|
||||
|
||||
// mirrors FX_MUSIC_PRIORITY from fx_man.h
|
||||
#define MV_MUSIC_PRIORITY INT_MAX
|
||||
|
||||
#define MIX_VOLUME(volume) ((max(0, min((volume), 255)) * (MV_MAXVOLUME + 1)) >> 8)
|
||||
#define MV_VOLUME(src) (Blrintf((float)(src) * volume))
|
||||
|
||||
#define MV_MIXBUFFERSIZE 256
|
||||
#define MV_NUMBEROFBUFFERS 16
|
||||
|
@ -77,7 +78,7 @@ typedef struct VoiceNode
|
|||
|
||||
playbackstatus (*GetSound)(struct VoiceNode *voice);
|
||||
|
||||
void (*mix)(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void (*mix)(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
|
||||
const char *sound;
|
||||
|
||||
|
@ -94,6 +95,8 @@ typedef struct VoiceNode
|
|||
char bits;
|
||||
char channels;
|
||||
|
||||
float volume;
|
||||
|
||||
unsigned LoopCount;
|
||||
uint32_t LoopSize;
|
||||
uint32_t BlockLength;
|
||||
|
@ -178,17 +181,17 @@ void MV_ReleaseXAVoice(VoiceNode *voice);
|
|||
void MV_ReleaseXMPVoice(VoiceNode *voice);
|
||||
|
||||
// implemented in mix.c
|
||||
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_16BitReverb( char const *src, char *dest, int16_t *volume, int32_t count );
|
||||
|
||||
// implemented in mixst.c
|
||||
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length);
|
||||
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume);
|
||||
|
||||
extern char *MV_MixDestination; // pointer to the next output sample
|
||||
extern uint32_t MV_MixPosition; // return value of where the source pointer got to
|
||||
|
|
|
@ -378,14 +378,12 @@ Begin playback of sound data at specified angle and distance
|
|||
from listener.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayFLAC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
|
||||
int32_t MV_PlayFLAC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
int32_t mid;
|
||||
int32_t volume;
|
||||
int32_t vol;
|
||||
int32_t status;
|
||||
|
||||
if (!MV_Installed)
|
||||
|
@ -400,16 +398,16 @@ int32_t MV_PlayFLAC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pi
|
|||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
volume = MIX_VOLUME(distance);
|
||||
vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[angle][volume].left;
|
||||
right = MV_PanTable[angle][volume].right;
|
||||
left = MV_PanTable[angle][vol].left;
|
||||
right = MV_PanTable[angle][vol].right;
|
||||
mid = max(0, 255 - distance);
|
||||
|
||||
status = MV_PlayFLAC(ptr, ptrlength, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
|
||||
status = MV_PlayFLAC(ptr, length, loophow, -1, pitchoffset, mid, left, right, priority, volume, callbackval);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -422,9 +420,7 @@ Begin playback of sound data with the given sound levels and
|
|||
priority.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
|
||||
int32_t MV_PlayFLAC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
VoiceNode *voice;
|
||||
flac_data *fd = 0;
|
||||
|
@ -448,7 +444,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo
|
|||
fd->ptr = ptr;
|
||||
fd->pos = 0;
|
||||
fd->blocksize = 0;
|
||||
fd->length = ptrlength;
|
||||
fd->length = length;
|
||||
|
||||
fd->block = NULL;
|
||||
|
||||
|
@ -638,6 +634,8 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo
|
|||
voice->FixedPointBufferSize = (voice->RateScale * MV_MIXBUFFERSIZE) - voice->RateScale;
|
||||
MV_SetVoiceMixMode(voice);
|
||||
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoiceVolume(voice, vol, left, right);
|
||||
MV_PlayVoice(voice);
|
||||
|
||||
|
@ -668,7 +666,7 @@ void MV_ReleaseFLACVoice(VoiceNode *voice)
|
|||
#include "_multivc.h"
|
||||
|
||||
int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -679,6 +677,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo
|
|||
UNREFERENCED_PARAMETER(left);
|
||||
UNREFERENCED_PARAMETER(right);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf("MV_PlayFLAC: FLAC support not included in this binary.\n");
|
||||
|
@ -686,7 +685,7 @@ int32_t MV_PlayFLAC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t lo
|
|||
}
|
||||
|
||||
int32_t MV_PlayFLAC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -695,6 +694,7 @@ int32_t MV_PlayFLAC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pi
|
|||
UNREFERENCED_PARAMETER(angle);
|
||||
UNREFERENCED_PARAMETER(distance);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf("MV_PlayFLAC: FLAC support not included in this binary.\n");
|
||||
|
|
|
@ -308,7 +308,7 @@ end_of_data:
|
|||
}
|
||||
|
||||
int32_t MV_PlayWAV3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval)
|
||||
int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
if (!MV_Installed)
|
||||
return MV_Error;
|
||||
|
@ -319,17 +319,17 @@ int32_t MV_PlayWAV3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitcho
|
|||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
int const volume = MIX_VOLUME(distance);
|
||||
int const vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
return MV_PlayWAV(ptr, length, loophow, -1, pitchoffset, max(0, 255 - distance),
|
||||
MV_PanTable[ angle ][ volume ].left, MV_PanTable[ angle ][ volume ].right, priority, callbackval);
|
||||
MV_PanTable[ angle ][ vol ].left, MV_PanTable[ angle ][ vol ].right, priority, volume, callbackval);
|
||||
}
|
||||
|
||||
int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayWAV(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
if (!MV_Installed)
|
||||
return MV_Error;
|
||||
|
@ -381,28 +381,28 @@ int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
voice->channels = format.nChannels;
|
||||
voice->GetSound = MV_GetNextWAVBlock;
|
||||
|
||||
int32_t length = data.size;
|
||||
int32_t blocklen = data.size;
|
||||
|
||||
if (voice->bits == 16)
|
||||
{
|
||||
data.size &= ~1;
|
||||
length /= 2;
|
||||
blocklen /= 2;
|
||||
}
|
||||
|
||||
if (voice->channels == 2)
|
||||
{
|
||||
data.size &= ~1;
|
||||
length /= 2;
|
||||
blocklen /= 2;
|
||||
}
|
||||
|
||||
voice->rawdataptr = (uint8_t *)ptr;
|
||||
voice->ptrlength = ptrlength;
|
||||
voice->ptrlength = length;
|
||||
voice->Playing = TRUE;
|
||||
voice->Paused = FALSE;
|
||||
voice->LoopCount = 0;
|
||||
voice->position = 0;
|
||||
voice->length = 0;
|
||||
voice->BlockLength = length;
|
||||
voice->BlockLength = blocklen;
|
||||
voice->NextBlock = (char *)((intptr_t) ptr + sizeof(riff_header) + riff.format_size + sizeof(data_header));
|
||||
voice->next = NULL;
|
||||
voice->prev = NULL;
|
||||
|
@ -410,7 +410,8 @@ int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
voice->callbackval = callbackval;
|
||||
voice->LoopStart = loopstart >= 0 ? voice->NextBlock : NULL;
|
||||
voice->LoopEnd = NULL;
|
||||
voice->LoopSize = loopend > 0 ? loopend - loopstart + 1 : length;
|
||||
voice->LoopSize = loopend > 0 ? loopend - loopstart + 1 : blocklen;
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoicePitch(voice, format.nSamplesPerSec, pitchoffset);
|
||||
MV_SetVoiceVolume(voice, vol, left, right);
|
||||
|
@ -419,8 +420,8 @@ int32_t MV_PlayWAV(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
return voice->handle;
|
||||
}
|
||||
|
||||
int32_t MV_PlayVOC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayVOC3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
if (!MV_Installed)
|
||||
return MV_Error;
|
||||
|
@ -431,17 +432,17 @@ int32_t MV_PlayVOC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pit
|
|||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
int const volume = MIX_VOLUME(distance);
|
||||
int const vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
return MV_PlayVOC(ptr, ptrlength, loophow, -1, pitchoffset, max(0, 255 - distance),
|
||||
MV_PanTable[ angle ][ volume ].left, MV_PanTable[ angle ][ volume ].right, priority, callbackval);
|
||||
return MV_PlayVOC(ptr, length, loophow, -1, pitchoffset, max(0, 255 - distance),
|
||||
MV_PanTable[ angle ][ vol ].left, MV_PanTable[ angle ][ vol ].right, priority, volume, callbackval);
|
||||
}
|
||||
|
||||
int32_t MV_PlayVOC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayVOC(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
if (!MV_Installed)
|
||||
return MV_Error;
|
||||
|
@ -463,7 +464,7 @@ int32_t MV_PlayVOC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
}
|
||||
|
||||
voice->rawdataptr = (uint8_t *)ptr;
|
||||
voice->ptrlength = ptrlength;
|
||||
voice->ptrlength = length;
|
||||
voice->Playing = TRUE;
|
||||
voice->Paused = FALSE;
|
||||
voice->wavetype = FMT_VOC;
|
||||
|
@ -483,6 +484,8 @@ int32_t MV_PlayVOC(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
voice->LoopEnd = NULL;
|
||||
voice->LoopSize = loopend - loopstart + 1;
|
||||
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoiceVolume(voice, vol, left, right);
|
||||
MV_PlayVoice(voice);
|
||||
|
||||
|
|
|
@ -134,18 +134,18 @@ static wavefmt_t FX_DetectFormat(char const * const ptr, uint32_t length)
|
|||
return fmt;
|
||||
}
|
||||
|
||||
int32_t FX_Play(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t FX_Play(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
static int32_t(*const func[])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t) =
|
||||
static int32_t(*const func[])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, float, uint32_t) =
|
||||
{ NULL, NULL, MV_PlayVOC, MV_PlayWAV, MV_PlayVorbis, MV_PlayFLAC, MV_PlayXA, MV_PlayXMP };
|
||||
|
||||
EDUKE32_STATIC_ASSERT(FMT_MAX == ARRAY_SIZE(func));
|
||||
|
||||
wavefmt_t const fmt = FX_DetectFormat(ptr, length);
|
||||
wavefmt_t const fmt = FX_DetectFormat(ptr, ptrlength);
|
||||
|
||||
int handle =
|
||||
(func[fmt]) ? func[fmt](ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval) : -1;
|
||||
(func[fmt]) ? func[fmt](ptr, ptrlength, loopstart, loopend, pitchoffset, vol, left, right, priority, volume, callbackval) : -1;
|
||||
|
||||
if (handle <= MV_Ok)
|
||||
{
|
||||
|
@ -156,18 +156,18 @@ int32_t FX_Play(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend,
|
|||
return handle;
|
||||
}
|
||||
|
||||
int32_t FX_Play3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, uint32_t callbackval)
|
||||
int32_t FX_Play3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance,
|
||||
int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
static int32_t (*const func[])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t) =
|
||||
static int32_t (*const func[])(char *, uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, float, uint32_t) =
|
||||
{ NULL, NULL, MV_PlayVOC3D, MV_PlayWAV3D, MV_PlayVorbis3D, MV_PlayFLAC3D, MV_PlayXA3D, MV_PlayXMP3D };
|
||||
|
||||
EDUKE32_STATIC_ASSERT(FMT_MAX == ARRAY_SIZE(func));
|
||||
|
||||
wavefmt_t const fmt = FX_DetectFormat(ptr, length);
|
||||
wavefmt_t const fmt = FX_DetectFormat(ptr, ptrlength);
|
||||
|
||||
int handle =
|
||||
(func[fmt]) ? func[fmt](ptr, length, loophow, pitchoffset, angle, distance, priority, callbackval) : -1;
|
||||
(func[fmt]) ? func[fmt](ptr, ptrlength, loophow, pitchoffset, angle, distance, priority, volume, callbackval) : -1;
|
||||
|
||||
if (handle <= MV_Ok)
|
||||
{
|
||||
|
|
|
@ -21,160 +21,137 @@
|
|||
#include "_multivc.h"
|
||||
|
||||
/*
|
||||
JBF:
|
||||
|
||||
position = offset of starting sample in start
|
||||
rate = resampling increment
|
||||
start = sound data
|
||||
length = count of samples to mix
|
||||
volume = direct volume adjustment, 1.0 = no change
|
||||
*/
|
||||
|
||||
// 8-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint8_t const * const source = (uint8_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0;
|
||||
auto const source = (uint8_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[position >> 16];
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[position >> 16]);
|
||||
position += rate;
|
||||
|
||||
sample0 = MV_LeftVolume[sample0] + *dest;
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(MV_LeftVolume[sample0] + *dest, INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 8-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint8_t const * const source = (uint8_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0, sample1;
|
||||
auto const source = (uint8_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[position >> 16];
|
||||
sample1 = sample0;
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[position >> 16]);
|
||||
position += rate;
|
||||
|
||||
sample0 = MV_LeftVolume[sample0] + *dest;
|
||||
sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2);
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
if (sample1 < -32768) sample1 = -32768;
|
||||
else if (sample1 > 32767) sample1 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(MV_LeftVolume[sample0] + *dest, INT16_MIN, INT16_MAX);
|
||||
*(dest + (MV_RightChannelOffset >> 1))
|
||||
= (int16_t)clamp(MV_RightVolume[sample0] + *(dest + (MV_RightChannelOffset >> 1)), INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 16-bit mono source, 16-bit mono output
|
||||
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint16_t const * const source = (uint16_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0l, sample0h, sample0;
|
||||
auto const source = (uint16_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[position >> 16];
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[position >> 16]);
|
||||
#ifdef BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
int sample0l = sample0 >> 8;
|
||||
int sample0h = (sample0 & 255) ^ 128;
|
||||
#else
|
||||
sample0l = sample0 & 255;
|
||||
sample0h = (sample0 >> 8) ^ 128;
|
||||
int sample0l = sample0 & 255;
|
||||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
#endif
|
||||
position += rate;
|
||||
|
||||
sample0l = MV_LeftVolume[sample0l] >> 8;
|
||||
sample0h = MV_LeftVolume[sample0h];
|
||||
sample0 = sample0l + sample0h + 128 + *dest;
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
*dest = (int16_t)clamp(sample0l + sample0h + 128 + *dest, INT16_MIN, INT16_MAX);
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 16-bit mono source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint16_t const * const source = (uint16_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0l, sample0h, sample0;
|
||||
int32_t sample1l, sample1h, sample1;
|
||||
auto const source = (uint16_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[position >> 16];
|
||||
#ifdef BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
#else
|
||||
sample0l = sample0 & 255;
|
||||
sample0h = (sample0 >> 8) ^ 128;
|
||||
#endif
|
||||
sample1l = sample0l;
|
||||
sample1h = sample0h;
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[position >> 16]);
|
||||
position += rate;
|
||||
|
||||
#ifdef BIGENDIAN
|
||||
int sample0l = sample0 >> 8;
|
||||
int sample0h = (sample0 & 255) ^ 128;
|
||||
#else
|
||||
int sample0l = sample0 & 255;
|
||||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
#endif
|
||||
|
||||
int const sample1l = MV_RightVolume[sample0l] >> 8;
|
||||
int const sample1h = MV_RightVolume[sample0h];
|
||||
|
||||
sample0l = MV_LeftVolume[sample0l] >> 8;
|
||||
sample0h = MV_LeftVolume[sample0h];
|
||||
sample1l = MV_RightVolume[sample1l] >> 8;
|
||||
sample1h = MV_RightVolume[sample1h];
|
||||
sample0 = sample0l + sample0h + 128 + *dest;
|
||||
sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2);
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
if (sample1 < -32768) sample1 = -32768;
|
||||
else if (sample1 > 32767) sample1 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
|
||||
*dest = (int16_t)clamp(sample0l + sample0h + 128 + *dest, INT16_MIN, INT16_MAX);
|
||||
*(dest + (MV_RightChannelOffset >> 1))
|
||||
= (int16_t)clamp(sample1l + sample1h + 128 + *(dest + (MV_RightChannelOffset >> 1)), INT16_MIN, INT16_MAX);
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
|
||||
{
|
||||
uint16_t const * input = (uint16_t const *) src;
|
||||
int16_t * output = (int16_t *) dest;
|
||||
int16_t sample0l, sample0h, sample0;
|
||||
auto input = (uint16_t const *)src;
|
||||
int16_t *output = (int16_t *)dest;
|
||||
|
||||
do {
|
||||
sample0 = *input++;
|
||||
#if 0 //def BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
do
|
||||
{
|
||||
int const sample0 = *input++;
|
||||
#if 0 // def BIGENDIAN
|
||||
int sample0l = sample0 >> 8;
|
||||
int sample0h = (sample0 & 255) ^ 128;
|
||||
#else
|
||||
sample0l = sample0 & 255;
|
||||
sample0h = (sample0 >> 8) ^ 128;
|
||||
int sample0l = sample0 & 255;
|
||||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
#endif
|
||||
|
||||
sample0l = ((int16_t *) volume)[sample0l] >> 8;
|
||||
sample0h = ((int16_t *) volume)[sample0h];
|
||||
*output++ = (int16_t) (sample0l + sample0h + 128);
|
||||
sample0l = ((int16_t *)volume)[sample0l] >> 8;
|
||||
sample0h = ((int16_t *)volume)[sample0h];
|
||||
*output++ = (int16_t)(sample0l + sample0h + 128);
|
||||
} while (--count > 0);
|
||||
}
|
||||
|
|
|
@ -20,155 +20,130 @@
|
|||
|
||||
#include "_multivc.h"
|
||||
|
||||
|
||||
/*
|
||||
JBF:
|
||||
|
||||
position = offset of starting sample in start
|
||||
rate = resampling increment
|
||||
start = sound data
|
||||
length = count of samples to mix
|
||||
volume = direct volume adjustment, 1.0 = no change
|
||||
*/
|
||||
|
||||
// 8-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint8_t const * const source = (uint8_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0, sample1;
|
||||
auto const source = (uint8_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[(position >> 16) << 1];
|
||||
sample1 = source[((position >> 16) << 1) + 1];
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[(position >> 16) << 1]);
|
||||
int const sample1 = MV_VOLUME(source[((position >> 16) << 1) + 1]);
|
||||
position += rate;
|
||||
|
||||
sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest;
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(((MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) >> 1) + *dest, INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 8-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint8_t const * const source = (uint8_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0, sample1;
|
||||
auto const source = (uint8_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[(position >> 16) << 1];
|
||||
sample1 = source[((position >> 16) << 1) + 1];
|
||||
while (length--)
|
||||
{
|
||||
int const sample0 = MV_VOLUME(source[(position >> 16) << 1]);
|
||||
int const sample1 = MV_VOLUME(source[((position >> 16) << 1) + 1]);
|
||||
position += rate;
|
||||
|
||||
sample0 = MV_LeftVolume[sample0] + *dest;
|
||||
sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2);
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
if (sample1 < -32768) sample1 = -32768;
|
||||
else if (sample1 > 32767) sample1 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(MV_LeftVolume[sample0] + *dest, INT16_MIN, INT16_MAX);
|
||||
*(dest + (MV_RightChannelOffset >> 1))
|
||||
= (int16_t)clamp(MV_RightVolume[sample1] + *(dest + (MV_RightChannelOffset >> 1)), INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 16-bit stereo source, 16-bit mono output
|
||||
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint16_t const * const source = (uint16_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0l, sample0h, sample0;
|
||||
int32_t sample1l, sample1h, sample1;
|
||||
auto const source = (uint16_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[(position >> 16) << 1];
|
||||
sample1 = source[((position >> 16) << 1) + 1];
|
||||
while (length--)
|
||||
{
|
||||
int sample0 = MV_VOLUME(source[(position >> 16) << 1]);
|
||||
int sample1 = MV_VOLUME(source[((position >> 16) << 1) + 1]);
|
||||
#ifdef BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
sample1l = sample1 >> 8;
|
||||
sample1h = (sample1 & 255) ^ 128;
|
||||
int sample0l = sample0 >> 8;
|
||||
int sample0h = (sample0 & 255) ^ 128;
|
||||
int sample1l = sample1 >> 8;
|
||||
int sample1h = (sample1 & 255) ^ 128;
|
||||
#else
|
||||
sample0l = sample0 & 255;
|
||||
sample0h = (sample0 >> 8) ^ 128;
|
||||
sample1l = sample1 & 255;
|
||||
sample1h = (sample1 >> 8) ^ 128;
|
||||
int sample0l = sample0 & 255;
|
||||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
int sample1l = sample1 & 255;
|
||||
int sample1h = (sample1 >> 8) ^ 128;
|
||||
#endif
|
||||
position += rate;
|
||||
|
||||
sample0l = MV_LeftVolume[sample0l] >> 8;
|
||||
sample0h = MV_LeftVolume[sample0h];
|
||||
sample0 = sample0l + sample0h + 128;
|
||||
sample0 = sample0l + sample0h + 128;
|
||||
|
||||
sample1l = MV_LeftVolume[sample1l] >> 8;
|
||||
sample1h = MV_LeftVolume[sample1h];
|
||||
sample1 = sample1l + sample1h + 128;
|
||||
sample1 = sample1l + sample1h + 128;
|
||||
|
||||
sample0 = (sample0 + sample1) / 2 + *dest;
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(((sample0 + sample1) >> 1) + *dest, INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
||||
// 16-bit stereo source, 16-bit stereo output
|
||||
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length)
|
||||
void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *start, uint32_t length, float volume)
|
||||
{
|
||||
uint16_t const * const source = (uint16_t const *) start;
|
||||
int16_t *dest = (int16_t *) MV_MixDestination;
|
||||
int32_t sample0l, sample0h, sample0;
|
||||
int32_t sample1l, sample1h, sample1;
|
||||
auto const source = (uint16_t const *)start;
|
||||
int16_t * dest = (int16_t *)MV_MixDestination;
|
||||
|
||||
while (length--) {
|
||||
sample0 = source[(position >> 16) << 1];
|
||||
sample1 = source[((position >> 16) << 1) + 1];
|
||||
while (length--)
|
||||
{
|
||||
int sample0 = MV_VOLUME(source[(position >> 16) << 1]);
|
||||
int sample1 = MV_VOLUME(source[((position >> 16) << 1) + 1]);
|
||||
#ifdef BIGENDIAN
|
||||
sample0l = sample0 >> 8;
|
||||
sample0h = (sample0 & 255) ^ 128;
|
||||
sample1l = sample1 >> 8;
|
||||
sample1h = (sample1 & 255) ^ 128;
|
||||
int sample0l = sample0 >> 8;
|
||||
int sample0h = (sample0 & 255) ^ 128;
|
||||
int sample1l = sample1 >> 8;
|
||||
int sample1h = (sample1 & 255) ^ 128;
|
||||
#else
|
||||
sample0l = sample0 & 255;
|
||||
sample0h = (sample0 >> 8) ^ 128;
|
||||
sample1l = sample1 & 255;
|
||||
sample1h = (sample1 >> 8) ^ 128;
|
||||
int sample0l = sample0 & 255;
|
||||
int sample0h = (sample0 >> 8) ^ 128;
|
||||
int sample1l = sample1 & 255;
|
||||
int sample1h = (sample1 >> 8) ^ 128;
|
||||
#endif
|
||||
position += rate;
|
||||
|
||||
sample0l = MV_LeftVolume[sample0l] >> 8;
|
||||
sample0h = MV_LeftVolume[sample0h];
|
||||
|
||||
sample1l = MV_RightVolume[sample1l] >> 8;
|
||||
sample1h = MV_RightVolume[sample1h];
|
||||
sample0 = sample0l + sample0h + 128 + *dest;
|
||||
sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2);
|
||||
if (sample0 < -32768) sample0 = -32768;
|
||||
else if (sample0 > 32767) sample0 = 32767;
|
||||
if (sample1 < -32768) sample1 = -32768;
|
||||
else if (sample1 > 32767) sample1 = 32767;
|
||||
|
||||
*dest = (int16_t) sample0;
|
||||
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
|
||||
|
||||
dest += MV_SampleSize / 2;
|
||||
*dest = (int16_t)clamp(sample0l + sample0h + 128 + *dest, INT16_MIN, INT16_MAX);
|
||||
*(dest + (MV_RightChannelOffset >> 1))
|
||||
= (int16_t)clamp(sample1l + sample1h + 128 + *(dest + (MV_RightChannelOffset >> 1)), INT16_MIN, INT16_MAX);
|
||||
dest += MV_SampleSize >> 1;
|
||||
}
|
||||
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *) dest;
|
||||
MV_MixPosition = position;
|
||||
MV_MixDestination = (char *)dest;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ static void MV_Mix(VoiceNode *voice, int const buffer)
|
|||
voclength = length;
|
||||
|
||||
if (voice->mix)
|
||||
voice->mix(position, rate, start, voclength);
|
||||
voice->mix(position, rate, start, voclength, voice->volume);
|
||||
|
||||
voice->position = MV_MixPosition;
|
||||
|
||||
|
|
|
@ -338,8 +338,7 @@ Begin playback of sound data at specified angle and distance
|
|||
from listener.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayVorbis3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayVorbis3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
if (!MV_Installed)
|
||||
{
|
||||
|
@ -353,13 +352,13 @@ int32_t MV_PlayVorbis3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t
|
|||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
int const volume = MIX_VOLUME(distance);
|
||||
int const vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
return MV_PlayVorbis(ptr, ptrlength, loophow, -1, pitchoffset, max(0, 255 - distance),
|
||||
MV_PanTable[angle][volume].left, MV_PanTable[angle][volume].right, priority, callbackval);
|
||||
return MV_PlayVorbis(ptr, length, loophow, -1, pitchoffset, max(0, 255 - distance),
|
||||
MV_PanTable[angle][vol].left, MV_PanTable[angle][vol].right, priority, volume, callbackval);
|
||||
}
|
||||
|
||||
|
||||
|
@ -370,8 +369,7 @@ Begin playback of sound data with the given sound levels and
|
|||
priority.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(loopend);
|
||||
|
||||
|
@ -391,7 +389,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t
|
|||
|
||||
vd->ptr = ptr;
|
||||
vd->pos = 0;
|
||||
vd->length = ptrlength;
|
||||
vd->length = length;
|
||||
vd->lastbitstream = -1;
|
||||
|
||||
int32_t status = ov_open_callbacks((void *)vd, &vd->vf, 0, 0, vorbis_callbacks);
|
||||
|
@ -460,6 +458,8 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t
|
|||
MV_SetVoicePitch(voice, vi->rate, pitchoffset);
|
||||
MV_SetVoiceMixMode( voice );
|
||||
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoiceVolume( voice, vol, left, right );
|
||||
MV_PlayVoice( voice );
|
||||
|
||||
|
@ -482,7 +482,7 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
|||
#include "_multivc.h"
|
||||
|
||||
int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset,
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -493,6 +493,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t
|
|||
UNREFERENCED_PARAMETER(left);
|
||||
UNREFERENCED_PARAMETER(right);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf("MV_PlayVorbis: OggVorbis support not included in this binary.\n");
|
||||
|
@ -500,7 +501,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t
|
|||
}
|
||||
|
||||
int32_t MV_PlayVorbis3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -509,6 +510,7 @@ int32_t MV_PlayVorbis3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t
|
|||
UNREFERENCED_PARAMETER(angle);
|
||||
UNREFERENCED_PARAMETER(distance);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf("MV_PlayVorbis: OggVorbis support not included in this binary.\n");
|
||||
|
|
|
@ -370,48 +370,39 @@ Begin playback of sound data at specified angle and distance
|
|||
from listener.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayXA3D
|
||||
(
|
||||
char *ptr,
|
||||
uint32_t ptrlength,
|
||||
int32_t loophow,
|
||||
int32_t pitchoffset,
|
||||
int32_t angle,
|
||||
int32_t distance,
|
||||
int32_t priority,
|
||||
uint32_t callbackval
|
||||
)
|
||||
int32_t MV_PlayXA3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, float volume,
|
||||
uint32_t callbackval)
|
||||
{
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
int32_t mid;
|
||||
int32_t volume;
|
||||
int32_t status;
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
int32_t mid;
|
||||
int32_t vol;
|
||||
int32_t status;
|
||||
|
||||
if ( !MV_Installed )
|
||||
{
|
||||
MV_SetErrorCode( MV_NotInstalled );
|
||||
return MV_Error;
|
||||
}
|
||||
if (!MV_Installed)
|
||||
{
|
||||
MV_SetErrorCode(MV_NotInstalled);
|
||||
return MV_Error;
|
||||
}
|
||||
|
||||
if ( distance < 0 )
|
||||
{
|
||||
distance = -distance;
|
||||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
if (distance < 0)
|
||||
{
|
||||
distance = -distance;
|
||||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
volume = MIX_VOLUME( distance );
|
||||
vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[ angle ][ volume ].left;
|
||||
right = MV_PanTable[ angle ][ volume ].right;
|
||||
mid = max( 0, 255 - distance );
|
||||
left = MV_PanTable[angle][vol].left;
|
||||
right = MV_PanTable[angle][vol].right;
|
||||
mid = max(0, 255 - distance);
|
||||
|
||||
status = MV_PlayXA(ptr, ptrlength, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
|
||||
status = MV_PlayXA(ptr, length, loophow, -1, pitchoffset, mid, left, right, priority, volume, callbackval);
|
||||
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,20 +413,8 @@ Begin playback of sound data with the given sound levels and
|
|||
priority.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int32_t MV_PlayXA
|
||||
(
|
||||
char *ptr,
|
||||
uint32_t ptrlength,
|
||||
int32_t loopstart,
|
||||
int32_t loopend,
|
||||
int32_t pitchoffset,
|
||||
int32_t vol,
|
||||
int32_t left,
|
||||
int32_t right,
|
||||
int32_t priority,
|
||||
uint32_t callbackval
|
||||
)
|
||||
|
||||
int32_t MV_PlayXA(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
|
||||
int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
VoiceNode *voice;
|
||||
xa_data * xad = 0;
|
||||
|
@ -458,7 +437,7 @@ int32_t MV_PlayXA
|
|||
xad->pos = XA_DATA_START;
|
||||
xad->t1 = xad->t2 = xad->t1_x = xad->t2_x = 0;
|
||||
xad->blocksize = 0;
|
||||
xad->length = ptrlength;
|
||||
xad->length = length;
|
||||
|
||||
xad->block = NULL;
|
||||
|
||||
|
@ -495,6 +474,8 @@ int32_t MV_PlayXA
|
|||
voice->LoopEnd = 0;
|
||||
voice->LoopSize = (loopstart >= 0 ? 1 : 0);
|
||||
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoiceVolume( voice, vol, left, right );
|
||||
MV_PlayVoice( voice );
|
||||
|
||||
|
|
|
@ -69,13 +69,12 @@ static playbackstatus MV_GetNextXMPBlock(VoiceNode *voice)
|
|||
return KeepPlaying;
|
||||
}
|
||||
|
||||
int32_t MV_PlayXMP3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayXMP3D(char *ptr, uint32_t length, int32_t loophow, int32_t pitchoffset, int32_t angle, int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
int32_t left;
|
||||
int32_t right;
|
||||
int32_t mid;
|
||||
int32_t volume;
|
||||
int32_t vol;
|
||||
int32_t status;
|
||||
|
||||
if (!MV_Installed)
|
||||
|
@ -90,22 +89,21 @@ int32_t MV_PlayXMP3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pit
|
|||
angle += MV_NUMPANPOSITIONS / 2;
|
||||
}
|
||||
|
||||
volume = MIX_VOLUME(distance);
|
||||
vol = MIX_VOLUME(distance);
|
||||
|
||||
// Ensure angle is within 0 - 127
|
||||
angle &= MV_MAXPANPOSITION;
|
||||
|
||||
left = MV_PanTable[angle][volume].left;
|
||||
right = MV_PanTable[angle][volume].right;
|
||||
left = MV_PanTable[angle][vol].left;
|
||||
right = MV_PanTable[angle][vol].right;
|
||||
mid = max( 0, 255 - distance );
|
||||
|
||||
status = MV_PlayXMP(ptr, ptrlength, loophow, -1, pitchoffset, mid, left, right, priority, callbackval);
|
||||
status = MV_PlayXMP(ptr, length, loophow, -1, pitchoffset, mid, left, right, priority, volume, callbackval);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t MV_PlayXMP(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
VoiceNode *voice;
|
||||
xmp_data * xmpd = 0;
|
||||
|
@ -127,7 +125,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
}
|
||||
|
||||
xmpd->ptr = ptr;
|
||||
xmpd->length = ptrlength;
|
||||
xmpd->length = length;
|
||||
|
||||
if ((xmpd->context = xmp_create_context()) == NULL)
|
||||
{
|
||||
|
@ -136,7 +134,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
return MV_Error;
|
||||
}
|
||||
|
||||
if ((retval = xmp_load_module_from_memory(xmpd->context, ptr, ptrlength)) != 0)
|
||||
if ((retval = xmp_load_module_from_memory(xmpd->context, ptr, length)) != 0)
|
||||
{
|
||||
free(xmpd);
|
||||
MV_Printf("MV_PlayXMP: xmp_load_module_from_memory failed (%i)\n", retval);
|
||||
|
@ -189,6 +187,8 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
voice->FixedPointBufferSize = (voice->RateScale * MV_MIXBUFFERSIZE) - voice->RateScale;
|
||||
MV_SetVoiceMixMode(voice);
|
||||
|
||||
voice->volume = volume;
|
||||
|
||||
MV_SetVoiceVolume(voice, vol, left, right);
|
||||
MV_PlayVoice(voice);
|
||||
|
||||
|
@ -217,7 +217,7 @@ void MV_ReleaseXMPVoice(VoiceNode * voice)
|
|||
static char const NoXMP[] = "MV_PlayXMP: libxmp-lite support not included in this binary.\n";
|
||||
|
||||
int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol,
|
||||
int32_t left, int32_t right, int32_t priority, uint32_t callbackval)
|
||||
int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -228,6 +228,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
UNREFERENCED_PARAMETER(left);
|
||||
UNREFERENCED_PARAMETER(right);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf(NoXMP);
|
||||
|
@ -235,7 +236,7 @@ int32_t MV_PlayXMP(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t loo
|
|||
}
|
||||
|
||||
int32_t MV_PlayXMP3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pitchoffset, int32_t angle,
|
||||
int32_t distance, int32_t priority, uint32_t callbackval)
|
||||
int32_t distance, int32_t priority, float volume, uint32_t callbackval)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ptr);
|
||||
UNREFERENCED_PARAMETER(ptrlength);
|
||||
|
@ -244,6 +245,7 @@ int32_t MV_PlayXMP3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pit
|
|||
UNREFERENCED_PARAMETER(angle);
|
||||
UNREFERENCED_PARAMETER(distance);
|
||||
UNREFERENCED_PARAMETER(priority);
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
UNREFERENCED_PARAMETER(callbackval);
|
||||
|
||||
MV_Printf(NoXMP);
|
||||
|
|
|
@ -4464,7 +4464,7 @@ extern int G_StartRTS(int lumpNum, int localPlayer)
|
|||
|
||||
if (pData != NULL)
|
||||
{
|
||||
FX_Play3D(pData, RTS_SoundLength(lumpNum - 1), FX_ONESHOT, 0, 0, FX_VOLUME(1), 255, -lumpNum);
|
||||
FX_Play3D(pData, RTS_SoundLength(lumpNum - 1), FX_ONESHOT, 0, 0, FX_VOLUME(1), 255, 1.f, -lumpNum);
|
||||
g_RTSPlaying = 7;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -6136,6 +6136,8 @@ repeatcase:
|
|||
g_sounds[k].vo = *(g_scriptPtr-1);
|
||||
g_scriptPtr -= 5;
|
||||
|
||||
g_sounds[k].volume = 1.f;
|
||||
|
||||
if (k > g_highestSoundIdx)
|
||||
g_highestSoundIdx = k;
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ static int32_t S_PlayMusic(const char *fn)
|
|||
int32_t const mvol = MASTER_VOLUME(ud.config.MusicVolume);
|
||||
int MyMusicVoice = FX_Play(MyMusicPtr, MusicLen, 0, 0,
|
||||
0, mvol, mvol, mvol,
|
||||
FX_MUSIC_PRIORITY, MUSIC_ID);
|
||||
FX_MUSIC_PRIORITY, 1.f, MUSIC_ID);
|
||||
|
||||
if (MyMusicVoice <= FX_Ok)
|
||||
{
|
||||
|
@ -720,13 +720,13 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
|
|||
if (repeatp && !ambsfxp)
|
||||
{
|
||||
// XXX: why is 'right' 0?
|
||||
voice = FX_Play(snd.ptr, snd.soundsiz, 0, -1, pitch, FX_VOLUME(sndist >> 6), FX_VOLUME(sndist >> 6), 0, snd.pr,
|
||||
voice = FX_Play(snd.ptr, snd.soundsiz, 0, -1, pitch, FX_VOLUME(sndist >> 6), FX_VOLUME(sndist >> 6), 0, snd.pr, snd.volume,
|
||||
(sndNum * MAXSOUNDINSTANCES) + sndSlot);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ambient MUSICANDSFX always start playing using the 3D routines!
|
||||
voice = FX_Play3D(snd.ptr, snd.soundsiz, repeatp ? FX_LOOP : FX_ONESHOT, pitch, sndang >> 4, FX_VOLUME(sndist >> 6), snd.pr,
|
||||
voice = FX_Play3D(snd.ptr, snd.soundsiz, repeatp ? FX_LOOP : FX_ONESHOT, pitch, sndang >> 4, FX_VOLUME(sndist >> 6), snd.pr, snd.volume,
|
||||
(sndNum * MAXSOUNDINSTANCES) + sndSlot);
|
||||
}
|
||||
|
||||
|
@ -782,9 +782,9 @@ int32_t S_PlaySound(int32_t num)
|
|||
|
||||
if (snd.m & SF_LOOP)
|
||||
voice = FX_Play(snd.ptr, snd.soundsiz, 0, -1, pitch, FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME), FX_VOLUME(LOUDESTVOLUME),
|
||||
snd.soundsiz, (num * MAXSOUNDINSTANCES) + sndnum);
|
||||
snd.soundsiz, snd.volume, (num * MAXSOUNDINSTANCES) + sndnum);
|
||||
else
|
||||
voice = FX_Play3D(snd.ptr, snd.soundsiz, FX_ONESHOT, pitch, 0, FX_VOLUME(255 - LOUDESTVOLUME), snd.pr, (num * MAXSOUNDINSTANCES) + sndnum);
|
||||
voice = FX_Play3D(snd.ptr, snd.soundsiz, FX_ONESHOT, pitch, 0, FX_VOLUME(255 - LOUDESTVOLUME), snd.pr, snd.volume, (num * MAXSOUNDINSTANCES) + sndnum);
|
||||
|
||||
if (voice <= FX_Ok)
|
||||
{
|
||||
|
|
|
@ -255,12 +255,12 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
|
|||
return -1;
|
||||
|
||||
voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
|
||||
pitch, sndist>>6, sndist>>6, 0, g_sounds[num].pr, num);
|
||||
pitch, sndist>>6, sndist>>6, 0, g_sounds[num].pr, 1.f, num);
|
||||
}
|
||||
else
|
||||
{
|
||||
voice = FX_Play3D(g_sounds[num].ptr, g_sounds[num].soundsiz, FX_ONESHOT,
|
||||
pitch, sndang>>4, sndist>>6, g_sounds[num].pr, num);
|
||||
pitch, sndang>>4, sndist>>6, g_sounds[num].pr, 1.f, num);
|
||||
}
|
||||
|
||||
if (voice >= FX_Ok)
|
||||
|
@ -314,12 +314,12 @@ void S_PlaySound(int32_t num)
|
|||
if (g_sounds[num].m & SF_LOOP)
|
||||
{
|
||||
voice = FX_Play(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
|
||||
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz,num);
|
||||
pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].soundsiz, 1.f,num);
|
||||
}
|
||||
else
|
||||
{
|
||||
voice = FX_Play3D(g_sounds[num].ptr, g_sounds[num].soundsiz, FX_ONESHOT,
|
||||
pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num);
|
||||
pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, 1.f, num);
|
||||
}
|
||||
|
||||
if (voice >= FX_Ok)
|
||||
|
|
Loading…
Reference in a new issue