private static FMOD.RESULT ChannelCallbackMethod(IntPtr channelRaw, FMOD.CHANNEL_CALLBACKTYPE type, IntPtr cmdData1, IntPtr cmdData2) { FMODChannel channel = FMODManager.Instance.GetSoundChannel(channelRaw.ToInt32()); switch (type) { case FMOD.CHANNEL_CALLBACKTYPE.END: if (channel.SoundEnds != null) { channel.SoundEnds(channel, null); } FMODManager.Instance.RemoveChannelMapping(channelRaw.ToInt32()); break; case FMOD.CHANNEL_CALLBACKTYPE.VIRTUALVOICE: if (channel.GoesVirtual != null) { channel.GoesVirtual(channel, null); } break; default: throw new NotImplementedException(); } return(FMOD.RESULT.OK); }
public void SetChannelMapping(int id, FMODChannel channel) { if (channelMapping.ContainsKey(id)) { System.Diagnostics.Debugger.Break(); } channelMapping[id] = channel; }
public IChannelGlue PlaySound(ISoundGlue sound, bool paused, bool looping) { FMOD.Channel channel = null; var result = system.playSound(FMOD.CHANNELINDEX.FREE, (FMOD.Sound)sound.InnerSoundObject, paused, ref channel); if (result == FMOD.RESULT.ERR_NOTREADY) return null; FMODManager.ERRCHECK(result); var fmodChannel = new FMODChannel(channel, looping); return fmodChannel; }
public IChannelGlue PlaySound(ISoundGlue sound, bool paused, bool looping) { FMOD.Channel channel = null; var result = system.playSound(FMOD.CHANNELINDEX.FREE, (FMOD.Sound)sound.InnerSoundObject, paused, ref channel); if (result == FMOD.RESULT.ERR_NOTREADY) { return(null); } FMODManager.ERRCHECK(result); var fmodChannel = new FMODChannel(channel, looping); return(fmodChannel); }