-moved a few things to mem1, seems like we have enough space

left for that still ;)
-fixed that fatal memory bug, now memory usage looks correct :)
This commit is contained in:
fix94.1 2012-05-18 18:13:49 +00:00
parent 3fc680087f
commit f8a214fb3d
5 changed files with 27 additions and 18 deletions

View File

@ -14,11 +14,11 @@
#define wbfs_fatal(x) do { gprintf(x); wd_last_error = 1; } while(0)
#define wbfs_error(x) do { gprintf(x); wd_last_error = 2; } while(0)
#define wbfs_malloc(x) MEM2_alloc(x)
#define wbfs_free(x) MEM2_free(x)
#define wbfs_malloc(x) MEM1_alloc(x)
#define wbfs_free(x) MEM1_free(x)
#define wbfs_ioalloc(x) MEM2_alloc(((x) + 31) & ~31)
#define wbfs_iofree(x) MEM2_free(x)
#define wbfs_ioalloc(x) MEM1_memalign(32, x)
#define wbfs_iofree(x) MEM1_free(x)
#define wbfs_be16(x) (*((u16*)(x)))
#define wbfs_be32(x) (*((u32*)(x)))

View File

@ -1749,8 +1749,8 @@ void CMenu::_mainLoopCommon(bool withCF, bool blockReboot, bool adjusting)
m_gameSound.Play(m_bnrSndVol);
m_gamesound_changed = false;
}
else if (!m_gameSelected)
m_gameSound.Stop();
else if(!m_gameSelected)
m_gameSound.FreeMemory();
CheckThreads();

View File

@ -380,7 +380,7 @@ void CMenu::_game(bool launch)
}
if (BTN_HOME_PRESSED || BTN_B_PRESSED)
{
m_gameSound.Stop();
m_gameSound.FreeMemory();
CheckGameSoundThread();
break;
}

View File

@ -115,12 +115,23 @@ void SoundHandler::RemoveDecoder(int voice)
if(voice < 0 || voice >= MAX_DECODERS)
return;
if(DecoderList[voice] != NULL)
{
if(DecoderList[voice] != NULL)
{
(*DecoderList[voice]).ClearBuffer();
delete DecoderList[voice];
if(DecoderList[voice]->GetSoundType() == SOUND_OGG)
delete((OggDecoder *)DecoderList[voice]);
else if(DecoderList[voice]->GetSoundType() == SOUND_MP3)
delete((Mp3Decoder *)DecoderList[voice]);
else if(DecoderList[voice]->GetSoundType() == SOUND_WAV)
delete((WavDecoder *)DecoderList[voice]);
else if(DecoderList[voice]->GetSoundType() == SOUND_AIF)
delete((AifDecoder *)DecoderList[voice]);
else if(DecoderList[voice]->GetSoundType() == SOUND_BNS)
delete((BNSDecoder *)DecoderList[voice]);
else
delete DecoderList[voice];
DecoderList[voice] = NULL;
}
}
}
void SoundHandler::ClearDecoderList()

View File

@ -40,9 +40,10 @@ class GuiSound
//!Constructor
//!\param sound Pointer to the sound data
//!\param filesize Length of sound data
GuiSound(std::string filepath, int voice = -1);
GuiSound(std::string filepath, int voice = -1);
GuiSound(const u8 * snd, u32 len, std::string name, bool allocated = false, int voice = -1);
//!Stops sound and frees all memory/closes files
void FreeMemory();
//!Destructor
~GuiSound();
//!Load a file and replace the old one
@ -84,13 +85,10 @@ class GuiSound
//!Initializes the GuiSound object by setting the default values
void Init();
//!Special sound case for sound.bin
void UncompressSoundbin(const u8 * snd, u32 len, bool isallocated);
void UncompressSoundbin(const u8 * snd, u32 len, bool isallocated);
protected:
//!Stops sound and frees all memory/closes files
void FreeMemory();
std::string filepath;
u8 * sound; //!< Pointer to the sound data
u8 *sound; //!< Pointer to the sound data
u32 length; //!< Length of sound data
s32 voice; //!< Currently assigned ASND voice channel
int volume; //!< Sound volume (0-100)