mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-06 19:01:04 +03:00
ioq3 sound
This commit is contained in:
parent
eef8f65830
commit
6e94bb6eca
12 changed files with 140 additions and 13 deletions
|
@ -510,7 +510,7 @@ CL_StartLocalSound
|
|||
====================
|
||||
*/
|
||||
void CL_StartLocalSound(const char* soundName, qboolean forceLoad) {
|
||||
S_StartLocalSoundByName(soundName, qfalse );
|
||||
S_StartLocalSound(soundName, qfalse );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -597,8 +597,8 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
|||
cgi->S_StartLocalSound = CL_StartLocalSound;
|
||||
cgi->S_StopSound = S_StopSound;
|
||||
cgi->S_AddLoopingSound = S_AddLoopingSound;
|
||||
cgi->S_ClearLoopingSounds = S_ClearLoopingSoundsNoParam;
|
||||
cgi->S_Respatialize = S_RespatializeOld;
|
||||
cgi->S_ClearLoopingSounds = S_ClearLoopingSounds;
|
||||
cgi->S_Respatialize = S_Respatialize;
|
||||
cgi->S_BeginRegistration = S_BeginRegistration;
|
||||
cgi->S_EndRegistration = S_EndRegistration;
|
||||
cgi->S_UpdateEntity = S_UpdateEntity;
|
||||
|
|
|
@ -1142,17 +1142,17 @@ redump:
|
|||
case ZA_SOUND_MONO:
|
||||
if (!cinTable[currentHandle].silent) {
|
||||
ssize = RllDecodeMonoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
|
||||
S_RawSamples(0, 22050, 2, 1, (byte *)sbuf, 1.0f);
|
||||
S_RawSamples(0, ssize, 22050, 2, 1, (byte *)sbuf, 1.0f, -1);
|
||||
}
|
||||
break;
|
||||
case ZA_SOUND_STEREO:
|
||||
if (!cinTable[currentHandle].silent) {
|
||||
if (cinTable[currentHandle].numQuads == -1) {
|
||||
S_Update();
|
||||
s_rawend = s_soundtime;
|
||||
s_rawend[0] = s_soundtime;
|
||||
}
|
||||
ssize = RllDecodeStereoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
|
||||
S_RawSamples(0, 22050, 2, 2, (byte *)sbuf, 1.0f);
|
||||
S_RawSamples(0, ssize, 22050, 2, 2, (byte *)sbuf, 1.0f, -1);
|
||||
}
|
||||
break;
|
||||
case ROQ_QUAD_INFO:
|
||||
|
@ -1469,7 +1469,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
|
|||
}
|
||||
|
||||
if (!cinTable[currentHandle].silent) {
|
||||
s_rawend = s_soundtime;
|
||||
s_rawend[0] = s_soundtime;
|
||||
}
|
||||
|
||||
return currentHandle;
|
||||
|
|
|
@ -3187,7 +3187,7 @@ void CL_Init( void ) {
|
|||
Cvar_Set( "cl_running", "1" );
|
||||
|
||||
NET_Init();
|
||||
S_Init();
|
||||
S_Init2();
|
||||
|
||||
// fixme: should we leave it?
|
||||
CL_GenerateQKey();
|
||||
|
|
|
@ -3695,7 +3695,7 @@ sfxHandle_t UI_RegisterSound( const char *sample, qboolean streamed ) {
|
|||
}
|
||||
|
||||
void UI_StartLocalSound( const char *sound_name ) {
|
||||
S_StartLocalSoundByName( sound_name, qtrue );
|
||||
S_StartLocalSound( sound_name, qtrue );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,90 @@
|
|||
#include "../snd_local.h"
|
||||
|
||||
void S_Init2()
|
||||
{
|
||||
S_Init();
|
||||
SND_setup();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_StartSound
|
||||
=================
|
||||
*/
|
||||
void S_StartSound(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, qboolean streamed)
|
||||
{
|
||||
S_StartSound((float*)origin, entNum, entChannel, sfxHandle);
|
||||
// FIXME: partially implemented
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_AddLoopingSound
|
||||
=================
|
||||
*/
|
||||
void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
S_AddLoopingSound(ENTITYNUM_WORLD, origin, velocity, sfxHandle);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_StopAllSounds
|
||||
=================
|
||||
*/
|
||||
void S_StopAllSounds(qboolean stop_music)
|
||||
{
|
||||
// Call the original function
|
||||
S_StopAllSounds();
|
||||
// FIXME: stop music
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
S_ClearLoopingSounds
|
||||
=================
|
||||
*/
|
||||
void S_ClearLoopingSounds(void)
|
||||
{
|
||||
S_ClearLoopingSounds(qtrue);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_Respatialize
|
||||
=================
|
||||
*/
|
||||
void S_Respatialize(int entityNum, const vec3_t origin,
|
||||
vec3_t axis[3])
|
||||
{
|
||||
S_Respatialize(entityNum, origin, axis, 0);
|
||||
}
|
||||
/*
|
||||
=================
|
||||
S_StartLocalSound
|
||||
=================
|
||||
*/
|
||||
void S_StartLocalSound(const char* sound_name, qboolean force_load)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
sfxHandle_t S_RegisterSound(const char* sample, qboolean compressed, qboolean streamed) {
|
||||
return S_RegisterSound(sample, compressed);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_StopSound
|
||||
=================
|
||||
*/
|
||||
void S_StopSound(int entnum, int channel)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_IsSoundPlaying
|
||||
|
@ -9,6 +94,7 @@ int S_IsSoundPlaying(int channelNumber, const char* name)
|
|||
{
|
||||
// FIXME: stub
|
||||
STUB();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
void S_EndRegistration(void);
|
||||
|
||||
void S_Respatialize(int entityNum, const vec3_t origin, vec3_t axis[3]);
|
||||
sfxHandle_t S_RegisterSound(const char* sample, qboolean compressed, qboolean streamed);
|
||||
void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags);
|
||||
void S_StartLocalSound(const char* name, qboolean force_load);
|
||||
void S_StartSound(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, qboolean streamed);
|
||||
void S_StopAllSounds(qboolean stop_music);
|
||||
void S_ClearLoopingSounds(void);
|
||||
qboolean S_IsSoundRegistered(const char* name);
|
||||
void S_Init2();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -26,12 +42,12 @@ qboolean MUSIC_PlaySong(const char* alias);
|
|||
void MUSIC_UpdateMusicVolumes(void);
|
||||
void MUSIC_CheckForStoppedSongs(void);
|
||||
|
||||
void S_StopSound(int entnum, int channel);
|
||||
float S_GetSoundTime(sfxHandle_t handle);
|
||||
void S_SetGlobalAmbientVolumeLevel(float volume);
|
||||
void S_SetReverb(int reverb_type, float reverb_level);
|
||||
int S_IsSoundPlaying(int channelNumber, const char* name);
|
||||
|
||||
void S_RespatializeOld(int entityNum, const vec3_t origin, vec3_t axis[3]);
|
||||
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener);
|
||||
void S_FadeSound(float fTime);
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
|
|||
int length;
|
||||
|
||||
// Try to open the file
|
||||
length = FS_FOpenFileRead(filename, &hnd, qtrue);
|
||||
length = FS_FOpenFileRead(filename, &hnd, qtrue, qtrue);
|
||||
if(!hnd)
|
||||
{
|
||||
Com_DPrintf("Can't read sound file %s\n", filename);
|
||||
|
|
|
@ -201,7 +201,7 @@ void *S_WAV_CodecLoad(const char *filename, snd_info_t *info)
|
|||
void *buffer;
|
||||
|
||||
// Try to open the file
|
||||
FS_FOpenFileRead(filename, &file, qtrue);
|
||||
FS_FOpenFileRead(filename, &file, qtrue, qtrue);
|
||||
if(!file)
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
@ -32,6 +32,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define SND_CHUNK_SIZE_FLOAT (SND_CHUNK_SIZE/2) // floats
|
||||
#define SND_CHUNK_SIZE_BYTE (SND_CHUNK_SIZE*2) // floats
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int left; // the final values will be clamped to +/- 0x00ffff00 and shifted down
|
||||
int right;
|
||||
|
@ -269,3 +274,7 @@ qboolean S_AL_Init( soundInterface_t *si );
|
|||
#ifdef idppc_altivec
|
||||
void S_PaintChannelFrom16_altivec( portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE], int snd_vol, channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset );
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void S_Init( void );
|
||||
void S_Shutdown( void );
|
||||
|
@ -80,4 +83,9 @@ void S_StopCapture(void);
|
|||
void S_MasterGain(float gain);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "new/snd_public_new.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue