Downloaded from https://salsa.debian.org/games-team/teeworlds/raw/master/debian/patches/new-wavpack.patch. From: Markus Koschany Date: Thu, 25 Oct 2018 20:52:27 +0200 Subject: new-wavpack Make wavpack compatible with Debian's version. --- src/engine/client/sound.cpp | 33 +++++++++++++++------------------ src/engine/client/sound.h | 4 ---- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp index 048ec24..80de3c5 100644 --- a/src/engine/client/sound.cpp +++ b/src/engine/client/sound.cpp @@ -325,10 +325,6 @@ void CSound::RateConvert(int SampleID) pSample->m_NumFrames = NumFrames; } -int CSound::ReadData(void *pBuffer, int Size) -{ - return io_read(ms_File, pBuffer, Size); -} ISound::CSampleHandle CSound::LoadWV(const char *pFilename) { @@ -336,6 +332,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) int SampleID = -1; char aError[100]; WavpackContext *pContext; + char aWholePath[1024]; + IOHANDLE File; // don't waste memory on sound when we are stress testing if(g_Config.m_DbgStress) @@ -349,25 +347,29 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) return CSampleHandle(); lock_wait(m_SoundLock); - ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL); - if(!ms_File) + File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath)); + if(!File) { dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename); lock_unlock(m_SoundLock); return CSampleHandle(); } + else + { + io_close(File); + } SampleID = AllocID(); if(SampleID < 0) { - io_close(ms_File); - ms_File = 0; + io_close(File); + File = 0; lock_unlock(m_SoundLock); return CSampleHandle(); } pSample = &m_aSamples[SampleID]; - pContext = WavpackOpenFileInput(ReadData, aError); + pContext = WavpackOpenFileInput(aWholePath, aError, OPEN_2CH_MAX, 0); if (pContext) { int m_aSamples = WavpackGetNumSamples(pContext); @@ -385,8 +387,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) if(pSample->m_Channels > 2) { dbg_msg("sound/wv", "file is not mono or stereo. filename='%s'", pFilename); - io_close(ms_File); - ms_File = 0; + io_close(File); + File = 0; lock_unlock(m_SoundLock); return CSampleHandle(); } @@ -401,8 +403,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) if(BitsPerSample != 16) { dbg_msg("sound/wv", "bps is %d, not 16, filname='%s'", BitsPerSample, pFilename); - io_close(ms_File); - ms_File = 0; + io_close(File); + File = 0; lock_unlock(m_SoundLock); return CSampleHandle(); } @@ -429,9 +431,6 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename) dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError); } - io_close(ms_File); - ms_File = NULL; - if(g_Config.m_Debug) dbg_msg("sound/wv", "loaded %s", pFilename); @@ -560,7 +559,5 @@ bool CSound::IsPlaying(CSampleHandle SampleID) return Ret; } -IOHANDLE CSound::ms_File = 0; - IEngineSound *CreateEngineSound() { return new CSound; } diff --git a/src/engine/client/sound.h b/src/engine/client/sound.h index ff357c0..cec2cde 100644 --- a/src/engine/client/sound.h +++ b/src/engine/client/sound.h @@ -21,10 +21,6 @@ public: static void RateConvert(int SampleID); - // TODO: Refactor: clean this mess up - static IOHANDLE ms_File; - static int ReadData(void *pBuffer, int Size); - virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; } virtual CSampleHandle LoadWV(const char *pFilename); ail'>...* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Add support for multiple paths; (home-fontconfig-service-type): Honor it; * doc/guix.texi (Fonts Services): Document it. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Giacomo Leidi 2022-03-20home: Migrate fountutils and xdg modules to xdg-configuration-files....* gnu/home/services/fontutils.scm (home-fontconfig-service-type): Migrate to xdg-configuration-files. * gnu/home/services/xdg.scm (home-xdg-user-directories-service-type, home-xdg-mime-applications-service-type): Migrate to xdg-configuration-files. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Andrew Tropin 2021-10-09Move (gnu home-services) to (gnu home services)....* gnu/home-services.scm (%guix-home-root-directory): Replace gnu/home-services.scm with "gnu/home/services.scm". Rename to gnu/home/services.scm. * gnu/local.mk (GNU_SYSTEM_MODULES): Rename gnu/home-services.scm to gnu/home/services.scm. * doc/he-config-bare-bones.scm: Replace (gnu home-services) with (gnu home services). * gnu/home.scm: Same. * gnu/home/services/fontutils.scm: Same. * gnu/home/services/mcron.scm: Same. * gnu/home/services/shells.scm: Same. * gnu/home/services/shepherd.scm: Same. * gnu/home/services/symlink-manager.scm: Same. * gnu/home/services/xdg.scm: Same. * guix/scripts/home.scm: Same. * guix/self.scm: Same. Oleg Pykhalov 2021-10-08gnu: Move (gnu home-services) to (gnu home services)....* gnu/home-services/configuration.scm: Move the content ... * gnu/home/services/configuration.scm: ... here. * doc/guix.texi: Replace (gnu home-services mcron) with (gnu home services mcron). Replace (gnu home-services) with (gnu home services). * gnu/home.scm: Replace (gnu home-services fontutils) with (gnu services fontutils). Replace (gnu home-services shells) with (gnu home services shells). Replace (gnu home-services symlink-manager) with (gnu home services symlink-manager). Replace (gnu home-services xdg) with (gnu home services xdg). * gnu/home-services/fontutils.scm: Rename to gnu/services/fontutils.scm. * gnu/home-services/mcron.scm: Move to gnu/home/services/mcron.scm. Replace (gnu home-services shepherd) with (gnu home services shepherd). * gnu/home-services.scm (%service-type-path): Search home services in "gnu/services". * gnu/home-services/shells.scm: Replace (gnu home-services configuration) with (gnu home services configuration). Rename to gnu/home/services/shells.scm. Replace (gnu home-services utils) with (gnu home services utils). * gnu/home-services/shepherd.scm: Move to gnu/home/services/shepherd.scm. * gnu/home-services/symlink-manager.scm: Rename to gnu/home/services/symlink-manager.scm. * gnu/home-services/utils.scm: Rename to gnu/home/services/utils.scm. * gnu/home-services/xdg.scm: Rename to gnu/home/services/xdg.scm. * guix/scripts/home/import.scm: Replace (gnu home-services bash) with (gnu home services bash). * gnu/home-services.scm: Update documentation string. * doc/he-config-bare-bones.scm: Apply new (gnu home-services ...) modules location. * gnu/local.mk (GNU_SYSTEM_MODULES): Same. Oleg Pykhalov