X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=snd_ogg.c;h=e1f8d93dea603d52ce8a15cb3aec7c4945e9278d;hb=cb872df2ca589d4b30c733dc239986dfd64f0c12;hp=7e37fe7e841c25cf4feacf7bd22dbcf312ae8666;hpb=aa33d8f8642530f7f266d6cde1422f95aa74b2be;p=xonotic%2Fdarkplaces.git diff --git a/snd_ogg.c b/snd_ogg.c index 7e37fe7e..e1f8d93d 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -221,7 +221,7 @@ static dllhandle_t vf_dll = NULL; typedef struct { - qbyte *buffer; + unsigned char *buffer; ogg_int64_t ind, buffsize; } ov_decode_t; @@ -297,8 +297,9 @@ qboolean OGG_OpenLibrary (void) const char* dllnames_vo [] = { #if defined(WIN64) - "vorbis64.dll", + "libvorbis64.dll", #elif defined(WIN32) + "libvorbis.dll", "vorbis.dll", #elif defined(MACOSX) "libvorbis.dylib", @@ -311,8 +312,9 @@ qboolean OGG_OpenLibrary (void) const char* dllnames_vf [] = { #if defined(WIN64) - "vorbisfile64.dll", + "libvorbisfile64.dll", #elif defined(WIN32) + "libvorbisfile.dll", "vorbisfile.dll", #elif defined(MACOSX) "libvorbisfile.dylib", @@ -374,13 +376,13 @@ void OGG_CloseLibrary (void) // We work with 1 sec sequences, so this buffer must be able to contain // 1 sec of sound of the highest quality (48 KHz, 16 bit samples, stereo) -static qbyte resampling_buffer [48000 * 2 * 2]; +static unsigned char resampling_buffer [48000 * 2 * 2]; // Per-sfx data structure typedef struct { - qbyte *file; + unsigned char *file; size_t filesize; snd_format_t format; } ogg_stream_persfx_t; @@ -570,7 +572,8 @@ Load an Ogg Vorbis file into memory */ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) { - qbyte *data; + unsigned char *data; + fs_offset_t filesize; ov_decode_t ov_decode; OggVorbis_File vf; vorbis_info *vi; @@ -584,7 +587,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) return true; // Load the file - data = FS_LoadFile (filename, snd_mempool, false); + data = FS_LoadFile (filename, snd_mempool, false, &filesize); if (data == NULL) return false; @@ -593,7 +596,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) // Open it with the VorbisFile API ov_decode.buffer = data; ov_decode.ind = 0; - ov_decode.buffsize = fs_filesize; + ov_decode.buffsize = filesize; if (qov_open_callbacks (&ov_decode, &vf, NULL, 0, callbacks) < 0) { Con_Printf ("error while opening Ogg Vorbis file \"%s\"\n", filename); @@ -616,7 +619,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) // Decide if we go for a stream or a simple PCM cache buff_len = ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels)); - if (snd_streaming.integer && len > (ogg_int64_t)fs_filesize + 3 * buff_len) + if (snd_streaming.integer && len > (ogg_int64_t)filesize + 3 * buff_len) { ogg_stream_persfx_t* per_sfx; @@ -624,8 +627,8 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) per_sfx = (ogg_stream_persfx_t *)Mem_Alloc (snd_mempool, sizeof (*per_sfx)); s->memsize += sizeof (*per_sfx); per_sfx->file = data; - per_sfx->filesize = fs_filesize; - s->memsize += fs_filesize; + per_sfx->filesize = filesize; + s->memsize += filesize; per_sfx->format.speed = vi->rate; per_sfx->format.width = 2; // We always work with 16 bits samples @@ -678,7 +681,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) s->loopstart = -1; s->flags &= ~SFXFLAG_STREAMED; - sb->length = (unsigned int)ResampleSfx ((qbyte *)buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name); + sb->length = (unsigned int)ResampleSfx ((unsigned char *)buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name); s->format.speed = shm->format.speed; s->total_length = sb->length; sb->offset = 0;