mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
From now, load streamed sound into memory as deferred loading is currently unsupported
This commit is contained in:
parent
5af8e127f8
commit
bf4780bbdb
1 changed files with 41 additions and 10 deletions
|
@ -416,8 +416,11 @@ DownSampleWav_MILES
|
||||||
*/
|
*/
|
||||||
int DownSampleWav_MILES(wavinfo_t *info, byte *wav, int wavlength, int newkhz, byte **newdata)
|
int DownSampleWav_MILES(wavinfo_t *info, byte *wav, int wavlength, int newkhz, byte **newdata)
|
||||||
{
|
{
|
||||||
STUB_DESC("sound stuff");
|
//STUB_DESC("sound stuff");
|
||||||
return 0;
|
//return 0;
|
||||||
|
// FIXME: unimplemented
|
||||||
|
// Fallback to software downsampling
|
||||||
|
return DownSampleWav(info, wav, wavlength, newkhz, newdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -438,6 +441,25 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removed because of OpenAL
|
||||||
|
/*
|
||||||
|
if (streamed) {
|
||||||
|
//
|
||||||
|
// Added in 2.0
|
||||||
|
// Will be loaded next time
|
||||||
|
sfx->length = 5000;
|
||||||
|
sfx->width = 1;
|
||||||
|
sfx->iFlags |= SFX_FLAG_STREAMED;
|
||||||
|
sfx->time_length = 5000.0;
|
||||||
|
sfx->data = 0;
|
||||||
|
return qtrue;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (clc.state != CA_LOADING && !force_load) {
|
||||||
|
Com_Printf("**************S_LoadSound: %s\n", fileName);
|
||||||
|
}
|
||||||
|
|
||||||
if (strstr(fileName, ".mp3")) {
|
if (strstr(fileName, ".mp3")) {
|
||||||
return S_LoadMP3(fileName, sfx);
|
return S_LoadMP3(fileName, sfx);
|
||||||
}
|
}
|
||||||
|
@ -457,7 +479,7 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
|
||||||
FS_FCloseFile(file_handle);
|
FS_FCloseFile(file_handle);
|
||||||
sfx->info = GetWavinfo(fileName, sfx->data, size);
|
sfx->info = GetWavinfo(fileName, sfx->data, size);
|
||||||
|
|
||||||
if (sfx->info.channels != 1)
|
if (sfx->info.channels != 1 && !streamed)
|
||||||
{
|
{
|
||||||
Com_Printf("%s is a stereo wav file\n", fileName);
|
Com_Printf("%s is a stereo wav file\n", fileName);
|
||||||
Z_Free(sfx->data);
|
Z_Free(sfx->data);
|
||||||
|
@ -469,14 +491,17 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
|
||||||
sfx->iFlags |= SFX_FLAG_NO_OFFSET;
|
sfx->iFlags |= SFX_FLAG_NO_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
realKhz = 11025;
|
switch (s_khz->integer) {
|
||||||
|
case 11:
|
||||||
if (s_khz->integer != 11)
|
realKhz = 11025;
|
||||||
{
|
break;
|
||||||
|
case 22:
|
||||||
|
default:
|
||||||
realKhz = 22050;
|
realKhz = 22050;
|
||||||
if (s_khz->integer == 44) {
|
break;
|
||||||
realKhz = 44100;
|
case 44:
|
||||||
}
|
realKhz = 44100;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(sfx->iFlags & SFX_FLAG_STREAMED) && realKhz < sfx->info.rate) {
|
if (!(sfx->iFlags & SFX_FLAG_STREAMED) && realKhz < sfx->info.rate) {
|
||||||
|
@ -507,6 +532,12 @@ qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean fo
|
||||||
|
|
||||||
sprintf(tempName, "k%s", fileName);
|
sprintf(tempName, "k%s", fileName);
|
||||||
UI_LoadResource(tempName);
|
UI_LoadResource(tempName);
|
||||||
|
|
||||||
|
if (strstr(fileName, "sound/null.wav")) {
|
||||||
|
sfx->iFlags |= SFX_FLAG_NULL;
|
||||||
|
return qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
return qtrue;
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue