diff options
Diffstat (limited to 'src/client/snd_mem.c')
-rw-r--r-- | src/client/snd_mem.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/snd_mem.c b/src/client/snd_mem.c index decab20d..f10510b7 100644 --- a/src/client/snd_mem.c +++ b/src/client/snd_mem.c @@ -201,7 +201,7 @@ qboolean S_LoadSound( sfx_t *sfx ) byte *data; short *samples; snd_info_t info; -// int size; + int size_per_sec; // player specific sounds are never directly loaded if ( sfx->soundName[0] == '*') { @@ -213,6 +213,10 @@ qboolean S_LoadSound( sfx_t *sfx ) if(!data) return qfalse; + size_per_sec = info.rate * info.channels * info.width; + if( size_per_sec > 0 ) + sfx->duration = (int)(1000.0f * ((double)info.size / size_per_sec)); + if ( info.width == 1 ) { Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is a 8 bit wav file\n", sfx->soundName); } |