コード例 #1
0
ファイル: Main.cs プロジェクト: hainam2101/FmodSharp
        public static void Main(string[] args)
        {
            Console.WriteLine("Fmod Play File Test");

#if DEBUG
#else
            Linsft.FmodSharp.Debug.Level = Linsft.FmodSharp.DebugLevel.Error;
#endif

            var SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();

            Console.WriteLine("Default Output: {0}", SoundSystem.Output);

            SoundSystem.Init();
            SoundSystem.ReverbProperties = Linsft.FmodSharp.Reverb.Presets.Room;

            if (args.Length > 0)
            {
                foreach (string StringItem in args)
                {
                    Linsft.FmodSharp.Sound.Sound SoundFile;
                    SoundFile = SoundSystem.CreateSound(StringItem);

                    Linsft.FmodSharp.Channel.Channel Chan;
                    Chan = SoundSystem.PlaySound(SoundFile);

                    while (Chan.IsPlaying)
                    {
                        System.Threading.Thread.Sleep(10);
                    }

                    SoundFile.Dispose();
                    Chan.Dispose();
                }
            }
            else
            {
                Console.WriteLine("No File to play.");
            }

            SoundSystem.CloseSystem();
            SoundSystem.Dispose();
        }
コード例 #2
0
ファイル: Sound.cs プロジェクト: ReyeMe/Sharp-Asteroids
        public void play()
        {
            if (missing || !render.sound_opt || render.sounds > 6)
            {
                return;
            }


            new System.Threading.Thread(() =>
            {
                try {
#if DEBUG
#else
                    Linsft.FmodSharp.Debug.Level = Linsft.FmodSharp.DebugLevel.Error;
#endif

                    var SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();
                    SoundSystem.Init(8, Linsft.FmodSharp.SoundSystem.InitFlags.Normal);

                    //SoundSystem.ReverbProperties = Linsft.FmodSharp.Reverb.Presets.Off;

                    Linsft.FmodSharp.Sound.Sound SoundFile;
                    SoundFile = SoundSystem.CreateSound(path, Linsft.FmodSharp.Mode.Hardware);

                    Linsft.FmodSharp.Channel.Channel Chan;
                    Chan = SoundSystem.PlaySound(SoundFile);
                    render.sounds++;
                    while (Chan.IsPlaying)
                    {
                        System.Threading.Thread.Sleep(10);
                    }

                    SoundFile.Dispose();
                    Chan.Dispose();

                    SoundSystem.CloseSystem();
                    SoundSystem.Dispose();
                    render.sounds--;
                } catch { }
            }).Start();
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: madrang/FmodSharp
        public static void Main(string[] args)
        {
            Console.WriteLine ("Fmod Play File Test");

            #if DEBUG

            #else
            Linsft.FmodSharp.Debug.Level = Linsft.FmodSharp.DebugLevel.Error;
            #endif

            var SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();

            Console.WriteLine ("Default Output: {0}", SoundSystem.Output);

            SoundSystem.Init();
            SoundSystem.ReverbProperties = Linsft.FmodSharp.Reverb.Presets.Room;

            if (args.Length > 0) {
                foreach (string StringItem in args) {
                    Linsft.FmodSharp.Sound.Sound SoundFile;
                    SoundFile = SoundSystem.CreateSound (StringItem);

                    Linsft.FmodSharp.Channel.Channel Chan;
                    Chan = SoundSystem.PlaySound(SoundFile);

                    while(Chan.IsPlaying) {
                        System.Threading.Thread.Sleep(10);
                    }

                    SoundFile.Dispose();
                    Chan.Dispose();
                }

            } else {
                Console.WriteLine ("No File to play.");
            }

            SoundSystem.CloseSystem();
            SoundSystem.Dispose();
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: madrang/FmodSharp
        public static void Main(string[] args)
        {
            Console.WriteLine ("Fmod Sound Test");

            #if DEBUG

            #else
            Linsft.FmodSharp.Debug.Level = Linsft.FmodSharp.DebugLevel.Error;
            #endif

            Console.WriteLine ("Level: {0}", Linsft.FmodSharp.Debug.Level);
            Console.WriteLine ("Type: {0}", Linsft.FmodSharp.Debug.Type);
            Console.WriteLine ("Display: {0}", Linsft.FmodSharp.Debug.Display);

            var SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();

            Console.WriteLine ("Default Output Type: {0}", SoundSystem.Output);

            SoundSystem.Init();

            Linsft.FmodSharp.Channel.Channel Chan = null;

            //Create an oscillator DSP unit for the tone.
            Linsft.FmodSharp.Dsp.Dsp Oscillator;

            Oscillator = SoundSystem.CreateDspByType(Linsft.FmodSharp.Dsp.Type.Oscillator);
            Chan = SoundSystem.PlayDsp(Oscillator);

            Console.WriteLine("\nPress Enter to stop.\n");
            bool Quit = false;
            while(!Quit) {
                switch (Console.ReadKey().Key) {

                case ConsoleKey.Enter:
                case ConsoleKey.Escape:
                    Quit = true;
                    break;

                    //Change note
                case ConsoleKey.LeftArrow :
                    //Oscillator.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, 440.0f);
                    break;

                case ConsoleKey.RightArrow:
                    //Oscillator.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, 440.0f);
                    break;

                    //Change Volume
                case ConsoleKey.UpArrow:
                    Chan.Volume += 0.05f;
                    break;

                case ConsoleKey.DownArrow:
                    Chan.Volume -= 0.05f;
                    break;

                    //Change Tone
                case ConsoleKey.Spacebar:
                    //dsp.setParameter((int)FMOD.DSP_OSCILLATOR.TYPE, 0);
                    //channel.setPaused(false);
                    break;

                default:
                    break;
                }

                System.Threading.Thread.Sleep(10);
            }
            Chan.Dispose();
            SoundSystem.CloseSystem();
            SoundSystem.Dispose();
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: hainam2101/FmodSharp
        public static void Main(string[] args)
        {
            Console.WriteLine("Fmod Sound Test");

#if DEBUG
#else
            Linsft.FmodSharp.Debug.Level = Linsft.FmodSharp.DebugLevel.Error;
#endif

            Console.WriteLine("Level: {0}", Linsft.FmodSharp.Debug.Level);
            Console.WriteLine("Type: {0}", Linsft.FmodSharp.Debug.Type);
            Console.WriteLine("Display: {0}", Linsft.FmodSharp.Debug.Display);

            var SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();

            Console.WriteLine("Default Output Type: {0}", SoundSystem.Output);

            SoundSystem.Init();

            Linsft.FmodSharp.Channel.Channel Chan = null;

            //Create an oscillator DSP unit for the tone.
            Linsft.FmodSharp.Dsp.Dsp Oscillator;

            Oscillator = SoundSystem.CreateDspByType(Linsft.FmodSharp.Dsp.Type.Oscillator);
            Chan       = SoundSystem.PlayDsp(Oscillator);

            Console.WriteLine("\nPress Enter to stop.\n");
            bool Quit = false;
            while (!Quit)
            {
                switch (Console.ReadKey().Key)
                {
                case ConsoleKey.Enter:
                case ConsoleKey.Escape:
                    Quit = true;
                    break;

                //Change note
                case ConsoleKey.LeftArrow:
                    //Oscillator.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, 440.0f);
                    break;

                case ConsoleKey.RightArrow:
                    //Oscillator.setParameter((int)FMOD.DSP_OSCILLATOR.RATE, 440.0f);
                    break;

                //Change Volume
                case ConsoleKey.UpArrow:
                    Chan.Volume += 0.05f;
                    break;

                case ConsoleKey.DownArrow:
                    Chan.Volume -= 0.05f;
                    break;

                //Change Tone
                case ConsoleKey.Spacebar:
                    //dsp.setParameter((int)FMOD.DSP_OSCILLATOR.TYPE, 0);
                    //channel.setPaused(false);
                    break;

                default:
                    break;
                }

                System.Threading.Thread.Sleep(10);
            }
            Chan.Dispose();
            SoundSystem.CloseSystem();
            SoundSystem.Dispose();
        }