Program stuck when calling FMOD::System::Release() on exit

I’m still fairly new to creating singleton managers and OOP in general, so I’m not sure what I’m doing wrong. Here’s my code:

In AudioManager.h,

class AudioManager : public Singleton<AudioManager>
{
public:
    AudioManager(m_dirty);    // m_dirty is a struct to prevent extra declarations
    static void Init();
    ~AudioManager();
private:
    static FMOD::System* _system;
    static FMOD::Sound* _testSound;
}

in AudioManager.cpp,

AudioManager(m_dirty)
{
	std::cout << "AudioManager Created" << std::endl;
}

void AudioManager::Init()
{
	FMOD::System_Create(&_system);
	_system->init(1, FMOD_INIT_NORMAL, nullptr);

	// play sound on startup
	_system->createSound("test.wav", FMOD_DEFAULT, nullptr, &_testSound);
	_system->playSound(_testSound, nullptr, false, nullptr);
}

AudioManager::~AudioManager()
{
	_testSound->release();

	std::cout << "Releasing audio system..." << std::endl;
	_system->release();    //  /!\ program is stuck here, seemingly on infinite loop?
	std::cout << "Audio system released" << std::endl;

	std::cout << "AudioManager Destroyed" << std::endl;
}

Would be nice to receive a reply ASAP, thanks.

I’m not seeing anything obviously wrong with your FMOD usage, System::release should not hang. I’d recommend you check the error codes returned from each function to ensure things are working as expected. Also link with the logging version of FMOD to get logging info in the Visual Studio output window to help debugging.

I’ve linked the logging version to my project as you suggested. This is what I’ve logged:

[LOG] SystemI::init                            : Initialize version=20104 (111454), maxchannels=1, flags=0x00000000
[LOG] SystemI::setOutputInternal               : Setting output to 'FMOD WASAPI Output'
[LOG] OutputWASAPI::init                       : Mix Format (WAVEFORMATEX): wFormatTag=0xFFFE, nChannels=2, nSamplesPerSec=48000, nAvgBytesPerSec=384000, nBlockAlign=8, wBitsPerSample=32, cbSize=22.
[LOG] OutputWASAPI::init                       : Mix Format (WAVEFORMATEXTENSIBLE): wValidBitsPerSample=32, dwChannelMask=0x00000003, SubFormat=00000003-0000-0010-8000-00AA00389B71.
[LOG] OutputWASAPI::init                       : Output buffer size: 4096 samples, latency: 0.00ms, period: 10.00ms, DSP buffer: 1024 * 4
[LOG] Thread::initThread                       : Init FMOD stream thread. Affinity: 0x8000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes.
[LOG] Thread::initThread                       : Init FMOD mixer thread. Affinity: 0x8000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: No, Sleep Time: 0, Looping: Yes.
[LOG] SystemI::createSoundInternal             : Create name='../TestSound/EngineProofTest.wav', mode=0x00000000
[LOG] SystemI::createSoundInternal             : Sample 0/0: name='(null)', format=2, channels=2, frequency=44100, lengthbytes=583680, lengthpcm=145920, pcmblocksize=0, loopstart=0, loopend=0, mode=0x00000000, channelmask=0x00000000, channelorder=0, peakvolume=0.000000.
[LOG] SoundI::release                          : EngineProofTest.wav (0000027CDF7D01E8)

I’ve also checked the error codes returned from each function; they all returned FMOD_OK.

Have you tried our examples? Do you get a hang with those too?
If not, are you able to modify our examples to demonstrate the hang to help us debug your problem?