Commit ce452ca6 authored by Gerhard Stein's avatar Gerhard Stein

Last fixes with Audio. Hope it is much better now... Version update

parent ec74f4e9
......@@ -31,7 +31,7 @@ string(REGEX REPLACE "[\r\n]" "" CG_VERSION "${CG_VERSION}")
# Since shell script get_version is not processed properly on windows, we have to define manually here.
# TODO: Better system for defining the version
IF(WIN32)
set(CG_VERSION "2.0.3")
set(CG_VERSION "2.0.5")
endif()
# Generate the README file with the correct version string
......
Subproject commit 870bb712a33da9e645995e441ff6434fa1d078f8
Subproject commit ac2f64044ba5703b69d02d421d0acb21aa4ab897
v2.0.5:
-------
- SDL_mixer added which fixes many problems
v2.0.2:
-------
- Bug fixes basically
......
......@@ -73,7 +73,7 @@ void CAudioSettings::refresh()
mpDepth->setSelection( mAudioSpec.format == AUDIO_U8 ? "8-bit" : "16-bit" );
#endif
mpSBToggle->setSelection( mSoundblaster ? "Soundblaster" : "PC Speaker" );
gMusicPlayer.play();
gMusicPlayer.play();
}
......@@ -82,7 +82,9 @@ void CAudioSettings::ponder(const float deltaT)
GalaxyMenu::ponder(0);
if( mSoundVolume != mpSoundVolume->getSelection() )
{
gSound.playSound(SOUND_GET_ITEM);
}
mSoundVolume = mpSoundVolume->getSelection();
......
......@@ -237,9 +237,7 @@ void Audio::destroy()
stopAllSounds();
#if defined(USE_SDLMIXER)
Mix_CloseAudio();
#else
#if !defined(USE_SDLMIXER)
SDL_LockAudio();
SDL_CloseAudio();
......@@ -250,19 +248,27 @@ void Audio::destroy()
if(!mSndChnlVec.empty())
{
mSndChnlVec.clear();
}
// Shutdown the OPL Emulator here!
gLogging.ftextOut("SoundDrv_Stop(): shut down.<br>");
m_OPL_Player.shutdown();
#if defined(USE_SDLMIXER)
Mix_CloseAudio();
#endif
}
// stops all currently playing sounds
void Audio::stopAllSounds()
{
for( auto &snd_chnl : mSndChnlVec )
{
snd_chnl.stopSound();
}
}
// pauses any currently playing sounds
......
......@@ -171,7 +171,7 @@ class CAudioResources
{
public:
CAudioResources();
virtual ~CAudioResources() {}
virtual ~CAudioResources() {}
virtual bool loadSoundData(const unsigned int dictOffset) = 0;
virtual void unloadSound() = 0;
......
......@@ -161,7 +161,7 @@ bool CMusic::load(const std::string &musicfile)
void CMusic::reload()
{
gSound.pauseAudio();
//gSound.pauseAudio();
#if defined(USE_SDLMIXER)
Mix_RewindMusic();
......@@ -174,7 +174,7 @@ void CMusic::reload()
mpPlayer->reload();
#endif
gSound.resumeAudio();
//gSound.resumeAudio();
}
void CMusic::play()
......
......@@ -10,6 +10,7 @@
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <base/GsLogging.h>
......@@ -28,17 +29,30 @@ m_AudioSpec(AudioSpec)
mTotNumChannels++;
}
CSoundChannel::
CSoundChannel(const CSoundChannel &chnl)
{
*this = chnl;
mId = mTotNumChannels;
mTotNumChannels++;
}
CSoundChannel::
~CSoundChannel()
{
mTotNumChannels--;
if(mTotNumChannels < 0)
{
assert(0);
}
}
void
CSoundChannel::
stopSound()
{
#if defined(USE_SDLMIXER)
#if !defined(USE_SDLMIXER)
SDL_LockAudio();
#endif
......@@ -49,6 +63,8 @@ stopSound()
mSoundPlaying = false;
#if defined(USE_SDLMIXER)
Mix_HaltChannel(mId);
#else
SDL_UnlockAudio();
#endif
}
......
......@@ -49,6 +49,9 @@ class CSoundChannel
public:
CSoundChannel(const SDL_AudioSpec &AudioSpec);
CSoundChannel(const CSoundChannel &chnl);
virtual ~CSoundChannel();
void stopSound();
......
......@@ -272,11 +272,14 @@ void CSoundSlot::unload()
if(!mSounddata.empty())
{
mSounddata.clear();
}
}
#if defined(USE_SDLMIXER)
Mix_FreeChunk(mpWaveChunk);
mpWaveChunk = nullptr;
if(mpWaveChunk)
{
Mix_FreeChunk(mpWaveChunk);
mpWaveChunk = nullptr;
}
#endif
}
......
#ifndef CG__VERSION_H
#define CG__VERSION_H
#define CGVERSION "2.0.3-Release"
#define CGVERSION "2.0.5-Release"
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment