I’m building a console application in C#. When i run the program I hear a small artefact, like an electric pop, when the sound should be played, but there is no sound.
My debugging counts the correct number of events in the FMOD project so I assume the banks are found. As I understand it I should not need to specify the output sysem for the sound, but could it help if I try it?
This is how I start the sound, is it correct? Writeline testSound returns “FMOD.Studio.EventDescription”.
This is my first try doing a console app, I have previously only programmed in Unity, so there may be something very basic I have missed. Any help is appreciated.
Examples using the FMOD API can be found in the FMOD engine directory "C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\vs2019\examples.sln" which is a useful tool when learning the API. These examples are in c++ but will still outline how to set up an FMOD system and play some events.
Something else that may help is checking the success of FMOD function calls using FMOD_RESULT. e.g.
FMOD.RESULT result = system.getEvent(“event : / test1”, out testSound);
if (result != FMOD.OK)
{
// Log Error here
}
result = testSound.createInstance(out testInstance);
if (result != FMOD.OK)
{
// Log Error here
}
result = testInstance.start();
if (result != FMOD.OK)
{
// Log Error here
}
As this could let us know if there were any issues when trying to play the instance.
Let me know if any of this helps, if not could it be possible to see the initialization of the studio and core systems?
Thank you Connor! The examples were very helpful, as well as “result”, and I will refer to them in the future.
Another review of the documentation showed that I missed calling studioSystem.update();,
I added this below testInstance.start(); in the code above and now the test sound plays.
Good to hear! If you have any more questions please do not hesitate to ask.
I will also link to the FMOD_RESULT documentation, which can be useful for looking up the definition of the return results: FMOD API | Core API Reference - Common