Hi,
I am using FMOD to replace an audio engine in a video game that was originally programmed to use DirectSound. I am linking to the fmod_vc (fmodL_vc for debug) lib within a MSVC++ 2019 project, C++ 11. I am using the latest FMOD SDK, version 2.02.07.
I have followed the examples and various other resources to write an implementation, but as soon as I call FMOD::System::init, the debugger window is continuously filled with;
[ERR] assert : assertion: 'length == blockSize' failed
[ERR] Output::mix : Error during mix. FMOD_RESULT = 28 -- An error occurred that wasn't supposed to. Contact support.
It seems like the FMOD thread is continuously perform a task but I am unable to obtain more information as to what the issue is.
The full log is;
[LOG] SystemI::init : Initialize version=20207 (125130), maxchannels=1024, flags=0x00110000
[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: 4092 samples, latency: 0.00ms, period: 9.99ms, DSP buffer: 1024 * 4
[LOG] Thread::initThread : Init FMOD stream thread. Affinity: 0x4000000000000003, Priority: 0xFFFF7FFB, Stack Size: 98304, Semaphore: No, Sleep Time: 10, Looping: Yes.
[LOG] Thread::initThread : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: No, Sleep Time: 0, Looping: Yes.
[ERR] assert : assertion: 'length == blockSize' failed
[ERR] Output::mix : Error during mix. FMOD_RESULT = 28 -- An error occurred that wasn't supposed to. Contact support.
...repeated
Here is a trimmed-down version of my init process;
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
FMOD::System_Create(&System);
System->setSoftwareFormat(48000, FMOD_SPEAKERMODE_STEREO, 0);
System->setStreamBufferSize(32768, FMOD_TIMEUNIT_RAWBYTES);
System->init(1024, FMOD_INIT_NORMAL|FMOD_INIT_THREAD_UNSAFE, nullptr);
System->createChannelGroup("Effects", &SfxChannelGroup);
System->createChannelGroup("Effects", &MusicChannelGroup);
System->getMasterChannelGroup(&MasterGroup);
MasterGroup->addGroup(SfxChannelGroup);
MasterGroup->addGroup(MusicChannelGroup);
System->setCallback(FMOD_ErrorCallback, FMOD_SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED);
System->setFileSystem(FMOD_FileOpenCallback, FMOD_FileCloseCallback, FMOD_FileReadCallback, FMOD_FileSeekCallback, nullptr, nullptr, -1);
This is a single-threaded application currently, my thought process is;
- I need to retain a DirectSound currently audio instance currently as the video games movie format is decoded in chunks and pushed into DirectSound, and I have yet to find a solution for this in FMOD. Can FMOD work alongside an existing DirectSound thread opened by the application or do I need to abandon this? EDIT: Disabling the movies/DirectSound altogether made no difference.
- I am linking to the library directly, would there be a difference if I loaded the imports from the DLL and worked with FMOD on a C level?
I hope I have provided enough information,
Regards,