private void OnSoundFinished(FMODChannel channel) { if (this.PlayComplete != null) { this.PlayComplete.BeginInvoke(channel, new AsyncCallback(iar => this.PlayComplete.EndInvoke(iar)), null); } }
private void OnSoundProgress(FMODChannel channel) { if (this.PlayProgress != null) { this.PlayProgress.BeginInvoke(channel, new AsyncCallback(iar => this.PlayProgress.EndInvoke(iar)), null); } }
private FMODChannel PlayFile(string file, bool play) { if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(file)) { throw new System.IO.FileNotFoundException("Can't find file", file ?? string.Empty); } FMOD.Sound sound = this.CreateSoundFromFile(file); FMODChannel container = new FMODChannel(this, this.PlaySound(sound, play), Guid.NewGuid()); lock (this.playingChannels) this.playingChannels.Add(container); return(container); }
/// <summary> /// Removes the specified ChannelContainer and nulls it (for garbage collection) /// </summary> /// <param name="container"></param> internal void RemoveContainer(FMODChannel container) { this.playingChannels.RemoveAll(c => c.ID == container.ID); }