Answered
0
0

I just upgraded my FMOD and came across various compatibility problems, first of all EventInstance is now a struct and I used to compare it to null in quite a few places, can instance.”isValid()” be used as a work around?

Also I followed this example to set up my pogrammer sounds
https://www.fmod.org/documentation/#content/generated/engine_new_unity/script_example_programmersounds.html

I solved the EVENT_CALLBACK problem changing, it to receive the EventInstance instead of it’s pointer but I still have problems with Sound not receicing a point on it’s constructor anymore and missing the getRaw function.

example of broken code:

case EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND:
{
var parameter = (PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(PROGRAMMER_SOUND_PROPERTIES));
SOUND_INFO dialogueSoundInfo;

                    RESULT keyResult;

                    if (key == null)
                        keyResult = RuntimeManager.StudioSystem.getSoundInfo(parameter.name, out dialogueSoundInfo);
                    else
                        keyResult = RuntimeManager.StudioSystem.getSoundInfo(key, out dialogueSoundInfo);

                    if (keyResult != RESULT.OK)
                        break;

                    Sound dialogueSound;
                    var soundResult = RuntimeManager.LowlevelSystem.createSound(dialogueSoundInfo.name_or_data, dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out dialogueSound);
                    if (soundResult == RESULT.OK)
                    {
                        parameter.sound = dialogueSound.getRaw();// There's no getRaw()
                        parameter.subsoundIndex = dialogueSoundInfo.subsoundindex;
                        Marshal.StructureToPtr(parameter, parameterPtr, false);
                    }
                }
                break;
            case EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND:
                {
                    var parameter = (PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(PROGRAMMER_SOUND_PROPERTIES));
                    var sound = new Sound(parameter.sound);//No param allowed
                    sound.release();
                }

What’s the alternative for Sound.GetRaw() so I can pass it into my PROGRAMMER_SOUND_PROPERTIES.sound? And what property was previously set when I passed a point on Sound constructor? So I can try creating a new one and setting the soundPtr afterwards.

  • You must to post comments
Best Answer
1
0

I would recommend using this link below, the one you referred to is out of date for 1.10.
https://fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/script_example_programmersounds.html#/

The GetRaw function has been replaced with a ‘handle’ member variable.
The previous constructor took in an IntPtr, which as you suggested, you will need to set after creation if you want to overwrite it.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.