Ejemplo n.º 1
0
        /// <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");
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
 internal Dsp(IntPtr hnd, FmodSystem parent)
 {
     Parent = parent;
     SetHandle(hnd);
 }