1 Downloaded from https://anonscm.debian.org/cgit/pkg-games/teeworlds.git/plain/debian/patches/new-wavpack.patch.
3 This patch lets us build teeworlds with wavpack 5.1.0.
5 --- a/src/engine/client/sound.cpp
6 +++ b/src/engine/client/sound.cpp
7 @@ -328,17 +328,14 @@ void CSound::RateConvert(int SampleID)
8 pSample->m_NumFrames = NumFrames;
11 -int CSound::ReadData(void *pBuffer, int Size)
13 - return io_read(ms_File, pBuffer, Size);
16 int CSound::LoadWV(const char *pFilename)
21 WavpackContext *pContext;
22 + char aWholePath[1024];
25 // don't waste memory on sound when we are stress testing
26 if(g_Config.m_DbgStress)
27 @@ -351,19 +348,23 @@ int CSound::LoadWV(const char *pFilename
31 - ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
33 + File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath));
36 dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
47 pSample = &m_aSamples[SampleID];
49 - pContext = WavpackOpenFileInput(ReadData, aError);
50 + pContext = WavpackOpenFileInput(aWholePath, aError, OPEN_2CH_MAX, 0);
53 int m_aSamples = WavpackGetNumSamples(pContext);
54 @@ -419,9 +420,6 @@ int CSound::LoadWV(const char *pFilename
55 dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError);
62 dbg_msg("sound/wv", "loaded %s", pFilename);
64 @@ -527,7 +525,5 @@ void CSound::StopAll()
65 lock_unlock(m_SoundLock);
68 -IOHANDLE CSound::ms_File = 0;
70 IEngineSound *CreateEngineSound() { return new CSound; }
72 --- a/src/engine/client/sound.h
73 +++ b/src/engine/client/sound.h
74 @@ -21,10 +21,6 @@ public:
76 static void RateConvert(int SampleID);
78 - // TODO: Refactor: clean this mess up
79 - static IOHANDLE ms_File;
80 - static int ReadData(void *pBuffer, int Size);
82 virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
84 virtual int LoadWV(const char *pFilename);