public FModMediaPlayer() { myopen = new FMOD.FILE_OPENCALLBACK(OPENCALLBACK); myclose = new FMOD.FILE_CLOSECALLBACK(CLOSECALLBACK); myread = new FMOD.FILE_READCALLBACK(READCALLBACK); myseek = new FMOD.FILE_SEEKCALLBACK(SEEKCALLBACK); FMOD.RESULT result; uint version = 0; result = FMOD.Factory.System_Create(ref system); ErrorCheck(result, "System_Create"); result = system.getVersion(ref version); ErrorCheck(result, "system.getVersion"); if (version != FMOD.VERSION.number) throw new ArgumentOutOfRangeException("version", version, "Unexpected version"); result = system.init(MAX_CHANNELS, FMOD.INITFLAGS.NORMAL, (IntPtr)null); ErrorCheck(result, "system.init"); result = system.setFileSystem(myopen, myclose, myread, myseek, null, null, 2048); ErrorCheck(result, "system.setFileSystem"); channel_callback = channelCallbackHandler; }
public void Play() { if (endCallback == null) { endCallback = new FMOD.CHANNEL_CALLBACK(soundEndCallback); } channel.setCallback(FMOD.CHANNEL_CALLBACKTYPE.END, endCallback, 0); FMOD.RESULT result = channel.setPaused(false); SoundManager.CheckResults(result); }
public Music(FMOD.System system, ISynchronizeInvoke invoker, bool isInitialized) { this.system = system; this.invoker = invoker; this.isInitialized = isInitialized; if (isInitialized && system == null) { isInitialized = false; } musicType = MusicType.Peace; manualMusicEnd = false; isMuted = false; endPlayCallback = new FMOD.CHANNEL_CALLBACK(endPlayCallbackFunction); }
public Sound(FMOD.System system, ISynchronizeInvoke invoker, bool isInitialized) { this.system = system; this.invoker = invoker; this.isInitialized = isInitialized; if (isInitialized && system == null) { isInitialized = false; } misc = new FMOD.Sound[Enum.GetValues(typeof(MiscSoundType)).Length]; houses = new Dictionary <short, FMOD.Sound[]>(); sequentialPlayList = new List <HouseSoundType>(); endPlayCallback = new FMOD.CHANNEL_CALLBACK(endPlayCallbackFunction); isMuted = false; }
public SoundInstance(FMOD.Channel channel, Sound sound) { Sound = sound; Channel = channel; //We have to hold a reference or the GC will collect and crash everything _callback = (channelPtr, controlType, callbackType, data1, data2) => { if (callbackType == FMOD.CHANNELCONTROL_CALLBACK_TYPE.END) { _ended = true; Sound.Player.ActiveSoundInstanceQueue.Remove(this); if (_endedCallback != null) { _endedCallback(this); } } return(FMOD.RESULT.OK); }; FMOD.Error.Check(Channel.setCallback(_callback)); }