0
0

Hi all,

Details: C# compiled on Vista x64, but as an x86 application – so it’s running as 32 bit. Using the 32bit fmodex.dll.

Callbacks dont work; fmod update throws an "Object reference not set to an instance of an object" error. I get the same error if I switch to compile as an x64 using the 64bit fmod dll.

Code where i set the callback:
[code:2yzrzszm]
public static bool PlaySong(int SongIndex)
{
FMOD.RESULT lresult;

        if (SongIndex < Playlist.List.Count)
        {
            Structures.Song.SongItem lSongItem = Playlist.List[SongIndex];
            lresult = system.createSound(lSongItem.Filename, (FMOD.MODE._2D | FMOD.MODE.HARDWARE | FMOD.MODE.CREATESTREAM), ref sound);
            ERRCHECK(lresult);
            if (lresult == FMOD.RESULT.OK)
            {
                lresult = system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);
                channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, SongStopped, 1);
                ERRCHECK(lresult);
                if (lresult == FMOD.RESULT.OK)
                {
                    if (OnSongStart != null)
                    {
                        OnSongStart(SongIndex);
                    }
                    PlayingIndex = SongIndex;
                    Playing = true;
                    return true;
                }
                else
                {
                    Playing = false;
                    return false;
                }
            }
        }
        Playing = false;
        return false;
    }

[/code:2yzrzszm]

My callback:
[code:2yzrzszm]
private static FMOD.RESULT SongStopped (IntPtr channelraw, FMOD.CHANNEL_CALLBACKTYPE type, int command, uint commanddata1, uint commanddata2)
{
if (Playing)
{
NextSong();
}
return FMOD.RESULT.OK;
}
[/code:2yzrzszm]

Any thoughts?

Andy

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.