public void PlayDsp(ChannelIndex channelId, Dsp dsp, bool paused, ref Channel channel) { if (dsp != null) { currentResult = Result.Ok; IntPtr channelHandle; if (channel != null) { channelHandle = channel.Handle; } else { channel = new Channel(); channelHandle = new IntPtr(); } try { currentResult = NativeMethods.FMOD_System_PlayDSP(handle, channelId, dsp.Handle, paused, ref channelHandle); } catch (System.Runtime.InteropServices.ExternalException) { currentResult = Result.InvalidParameterError; } if (currentResult != Result.Ok) { channel = new Channel(); channel.Handle = channelHandle; } else { channel = null; } } else throw new ArgumentNullException("dsp"); }
public Channel GetChannel(int channelId) { currentResult = Result.Ok; IntPtr channelHandle = new IntPtr(); Channel channel = null; try { currentResult = NativeMethods.FMOD_System_GetChannel(handle, channelId, ref channelHandle); } catch (System.Runtime.InteropServices.ExternalException) { currentResult = Result.InvalidParameterError; } if (currentResult == Result.Ok) { channel = new Channel(); channel.Handle = channelHandle; } return channel; }
internal void PlaySound(ChannelIndex channelId, Sound sound, bool paused, ref Channel channel) { if (sound != null) { currentResult = Result.Ok; IntPtr channelHandle; bool wasMuted = false; if (channel != null) { channelHandle = channel.Handle; wasMuted = channel.Mute; } else { channel = new Channel(); channelHandle = new IntPtr(); } try { currentResult = NativeMethods.FMOD_System_PlaySound(handle, channelId, sound.Handle, paused, ref channelHandle); } catch (System.Runtime.InteropServices.ExternalException) { currentResult = Result.InvalidParameterError; } if (currentResult == Result.Ok) { channel.Handle = channelHandle; if (wasMuted) { channel.Mute = true; } } else { channel = null; } } }