You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/games-action/teeworlds/files/teeworlds-0.5.2-wavpack.patch

58 lines
1.3 KiB

diff --git a/src/engine/client/ec_snd.c b/src/engine/client/ec_snd.c
index 034dfb2..67e819c 100644
--- a/src/engine/client/ec_snd.c
+++ b/src/engine/client/ec_snd.c
@@ -359,19 +359,13 @@
}
-static IOHANDLE file = NULL;
-
-static int read_data(void *buffer, int size)
-{
- return io_read(file, buffer, size);
-}
-
int snd_load_wv(const char *filename)
{
SAMPLE *snd;
int sid = -1;
char error[100];
WavpackContext *context;
+ char completefilename[512];
/* don't waste memory on sound when we are stress testing */
if(config.dbg_stress)
@@ -381,19 +375,13 @@
if(!sound_enabled)
return 1;
- file = engine_openfile(filename, IOFLAG_READ); /* TODO: use system.h stuff for this */
- if(!file)
- {
- dbg_msg("sound/wv", "failed to open %s", filename);
- return -1;
- }
-
sid = snd_alloc_id();
if(sid < 0)
return -1;
snd = &samples[sid];
- context = WavpackOpenFileInput(read_data, error);
+ engine_getpath(completefilename, sizeof(completefilename), filename, IOFLAG_READ);
+ context = WavpackOpenFileInput(completefilename, error, OPEN_2CH_MAX, 0);
if (context)
{
int samples = WavpackGetNumSamples(context);
@@ -448,9 +436,6 @@
dbg_msg("sound/wv", "failed to open %s: %s", filename, error);
}
- io_close(file);
- file = NULL;
-
if(config.debug)
dbg_msg("sound/wv", "loaded %s", filename);