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