/// <summary> /// Kind of like a DSP factory. But not. /// </summary> internal static Dsp GetInstance(FmodSystem system, DspType type) { IntPtr handle = IntPtr.Zero; Errors.ThrowIfError(CreateDspByType(system.DangerousGetHandle(), type, ref handle)); if (type == DspType.Oscillator) return new Oscillator(handle, system);; // TODO: implement other types throw new NotSupportedException("DSP type " + type + " not currently supported by nFMOD"); }
static void Main(string[] args) { var quit = new ManualResetEvent(false); Console.CancelKeyPress += (s, a) => { quit.Set(); a.Cancel = true; }; using (var fmod = new FmodSystem()) { fmod.Init(); using (var oscillator = fmod.CreateDspByType(DspType.Oscillator)) { var channel = fmod.PlayDsp(oscillator); Console.WriteLine("nFMOD test\nGenerating sine wave; Ctrl+C to quit"); quit.WaitOne(); } fmod.CloseSystem(); } }
static void Main(string[] args) { const string FILE_NAME = @".\doowackadoo.mp3"; var quit = new ManualResetEvent(false); Console.CancelKeyPress += (s, a) => { quit.Set(); a.Cancel = true; }; using (var fmod = new FmodSystem()) { fmod.Init(); using (var audio = fmod.CreateSound(FILE_NAME)) { fmod.PlaySound(audio); Console.WriteLine("nFMOD test\nPlaying doowackadoo; Ctrl+C to quit"); quit.WaitOne(); } fmod.CloseSystem(); } }
internal Dsp(IntPtr hnd, FmodSystem parent) { Parent = parent; SetHandle(hnd); }