From 656651aeeec19ebe3b380595001df2e97ad95b05 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Mon, 20 Jul 2026 10:06:09 -0300 Subject: [PATCH] put static FMOD_ErrorString where it's needed it was in a _header_, being included everywhere. fix it. --- sgp/fmod_errors.h | 30 ------------------------------ sgp/soundman.cpp | 31 ++++++++++++++++++++++++++++++- sgp/soundman.h | 1 - 3 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 sgp/fmod_errors.h diff --git a/sgp/fmod_errors.h b/sgp/fmod_errors.h deleted file mode 100644 index 7a13f59bb..000000000 --- a/sgp/fmod_errors.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _FMOD_ERRORS_H -#define _FMOD_ERRORS_H -static STR8 FMOD_ErrorString(int errcode) -{ - switch (errcode) - { - case FMOD_ERR_NONE: return "No errors"; - case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; - case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; - case FMOD_ERR_PLAY: return "Playing the sound failed."; - case FMOD_ERR_INIT: return "Error initializing output device."; - case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused."; - case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"; - case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware."; - case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer."; - case FMOD_ERR_FILE_NOTFOUND: return "File not found"; - case FMOD_ERR_FILE_FORMAT: return "Unknown file format"; - case FMOD_ERR_FILE_BAD: return "Error loading file"; - case FMOD_ERR_MEMORY: return "Not enough memory "; - case FMOD_ERR_VERSION: return "The version number of this file format is not supported"; - case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function"; - case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output."; - case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel"; - case FMOD_ERR_RECORD: return "Recording not supported on this device"; - case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed"; - - default : return "Unknown error"; - }; -} -#endif diff --git a/sgp/soundman.cpp b/sgp/soundman.cpp index 0d5c8f2cf..b8def812e 100644 --- a/sgp/soundman.cpp +++ b/sgp/soundman.cpp @@ -15,7 +15,6 @@ #include "MemMan.h" #include "random.h" #include "fmod.h" - #include "fmod_errors.h" #include "sgp_logger.h" // sevenfm #include "message.h" @@ -25,6 +24,36 @@ #include #include +namespace { +STR8 FMOD_ErrorString(int errcode) +{ + switch (errcode) + { + case FMOD_ERR_NONE: return "No errors"; + case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; + case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; + case FMOD_ERR_PLAY: return "Playing the sound failed."; + case FMOD_ERR_INIT: return "Error initializing output device."; + case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused."; + case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"; + case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware."; + case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer."; + case FMOD_ERR_FILE_NOTFOUND: return "File not found"; + case FMOD_ERR_FILE_FORMAT: return "Unknown file format"; + case FMOD_ERR_FILE_BAD: return "Error loading file"; + case FMOD_ERR_MEMORY: return "Not enough memory "; + case FMOD_ERR_VERSION: return "The version number of this file format is not supported"; + case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function"; + case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output."; + case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel"; + case FMOD_ERR_RECORD: return "Recording not supported on this device"; + case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed"; + + default : return "Unknown error"; + }; +} +} + // Uncomment this to disable the startup of sound hardware //#define SOUND_DISABLE diff --git a/sgp/soundman.h b/sgp/soundman.h index 9e8817494..fb302c540 100644 --- a/sgp/soundman.h +++ b/sgp/soundman.h @@ -3,7 +3,6 @@ #include "types.h" #include "fmod.h" -#include "fmod_errors.h" /* #ifdef __cplusplus