mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
Fixed: Crash on exit caused by incomplete music channel reset
This commit is contained in:
parent
eb293f5325
commit
f815bb2549
3 changed files with 32 additions and 1 deletions
|
@ -230,6 +230,8 @@ public:
|
|||
virtual uint getSourcesInstanceCount() const { return (uint)_Sources.size(); }
|
||||
/// Return the number of playing sources (slow)
|
||||
virtual uint getPlayingSourcesCount() const;
|
||||
uint countPlayingSimpleSources() const; // debug
|
||||
uint countSimpleSources() const; // debug
|
||||
/// Return the number of available tracks
|
||||
virtual uint getAvailableTracksCount() const;
|
||||
/// Return the number of used tracks
|
||||
|
|
|
@ -221,6 +221,7 @@ void CAudioMixerUser::writeProfile(std::string& out)
|
|||
*/
|
||||
out += "Sound mixer: \n";
|
||||
out += "\tPlaying sources: " + toString (getPlayingSourcesCount()) + " \n";
|
||||
out += "\tPlaying simple sources: " + toString(countPlayingSimpleSources()) + " / " + toString(countSimpleSources()) + " \n";
|
||||
out += "\tAvailable tracks: " + toString (getAvailableTracksCount()) + " \n";
|
||||
out += "\tUsed tracks: " + toString (getUsedTracksCount()) + " \n";
|
||||
// out << "\tMuted sources: " << nb << " \n";
|
||||
|
@ -270,7 +271,8 @@ void CAudioMixerUser::reset()
|
|||
|
||||
_SourceWaitingForPlay.clear();
|
||||
|
||||
_MusicChannelFaders->reset();
|
||||
for (uint i = 0; i < _NbMusicChannelFaders; ++i)
|
||||
_MusicChannelFaders[i].reset();
|
||||
|
||||
// Stop tracks
|
||||
uint i;
|
||||
|
@ -2173,6 +2175,32 @@ uint CAudioMixerUser::getPlayingSourcesCount() const
|
|||
return _PlayingSources;
|
||||
}
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
|
||||
uint CAudioMixerUser::countPlayingSimpleSources() const
|
||||
{
|
||||
uint count = 0;
|
||||
for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it)
|
||||
{
|
||||
if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE && (*it)->isPlaying())
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
uint CAudioMixerUser::countSimpleSources() const
|
||||
{
|
||||
uint count = 0;
|
||||
for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it)
|
||||
{
|
||||
if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
// ******************************************************************
|
||||
|
||||
uint CAudioMixerUser::getAvailableTracksCount() const
|
||||
|
|
|
@ -48,6 +48,7 @@ CSourceMusicChannel::CSourceMusicChannel() : m_Source(NULL), m_Gain(1.0f)
|
|||
|
||||
CSourceMusicChannel::~CSourceMusicChannel()
|
||||
{
|
||||
nlassert(!m_Source);
|
||||
delete m_Source;
|
||||
m_Source = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue