Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/audio/internal/audioplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ AudioPlayer::~AudioPlayer()
{
if (m_loaded) {
ma_sound_uninit(m_sound);
ma_decoder_uninit(m_decoder);

if (!m_copy)
ma_decoder_uninit(m_decoder);
}

delete m_decoder;
delete m_sound;

if (!m_copy)
delete m_decoder;
}

bool AudioPlayer::load(unsigned int size, const void *data, unsigned long sampleRate)
Expand Down Expand Up @@ -74,6 +78,7 @@ bool AudioPlayer::loadCopy(IAudioPlayer *player)
}

m_loaded = true;
m_copy = true;
ma_sound_set_volume(m_sound, m_volume);
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/audio/internal/audioplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AudioPlayer : public IAudioPlayer
ma_decoder *m_decoder = nullptr;
ma_sound *m_sound;
bool m_loaded = false;
bool m_copy = false;
bool m_started = false;
float m_volume = 1;
};
Expand Down