示例#1
0
        void Run()
        {
            var quit = new ManualResetEvent(false);
            Console.CancelKeyPress += (s, a) => {
                quit.Set();
                a.Cancel = true;
            };

            using (var fmod = new FmodSystem())
            {
                fmod.Init();
                using (oscillator = (Oscillator)fmod.CreateDsp(DspType.Oscillator))
                {
                    oscillator.Play();

                    while (!quit.WaitOne(0))
                    {
                        ShowPrompt();
                        ProcessInput(quit);
                        Thread.Sleep(1);
                    }
                }
                fmod.CloseSystem();
            }
        }
示例#2
0
        void Run()
        {
            var quit = new ManualResetEvent(false);

            Console.CancelKeyPress += (s, a) => {
                quit.Set();
                a.Cancel = true;
            };

            using (var fmod = new FmodSystem())
            {
                fmod.Init();
                using (oscillator = (Oscillator)fmod.CreateDsp(DspType.Oscillator))
                {
                    oscillator.Play();

                    while (!quit.WaitOne(0))
                    {
                        ShowPrompt();
                        ProcessInput(quit);
                        Thread.Sleep(1);
                    }
                }
                fmod.CloseSystem();
            }
        }
示例#3
0
 public async Task Init(bool isMobile)
 {
     await Task.Run(() =>
     {
         Factory.SystemCreate(out _fmodSys);
         _fmodSys.Init(1, InitFlags.Normal, IntPtr.Zero);
         _channelEndCallback = new ChannelCallback(ChannelEndCallback);
     });
 }
示例#4
0
        private void btnGetSystemObjectWhenNotInitialized_Click(object sender, EventArgs e)
        {
            var fmod = new FmodSystem();
            fmod.Init();
            var dsp = fmod.CreateDsp(DspType.Oscillator);
            var channel = fmod.PlayDsp(dsp);

            var fmod2 = channel.SystemInstance;

            fmod.CloseSystem();
        }
示例#5
0
 public async Task Init(bool isMobile)
 {
     await Task.Run(() =>
     {
         var res = Factory.SystemCreate(out _fmodSys);
         res     = Fmod.Debug.Initialize(DebugFlags.Log | DebugFlags.Error, DebugMode.File, null, @"D:\Music\fmod.log");
         res     = _fmodSys.Init(1, InitFlags.Normal, IntPtr.Zero);
         //res = _fmodSys.SetFileSystem(new FileOpenCallback(Open), new FileCloseCallback(Close), new FileReadCallback(Read), new FileSeekCallback(Seek), null, null,-1);
         _channelEndCallback = new ChannelCallback(ChannelEndCallback);
     });
 }
示例#6
0
        public frmMain()
        {
            InitializeComponent();

            fmod = new FmodSystem();
            fmod.Init();

            var timer = new Timer();
            timer.Interval = 33; // approx 30FPS
            timer.Tick += (sender, args) => Render();
            timer.Start();
        }
示例#7
0
        private void btnGetSystemObjectWhenNotInitialized_Click(object sender, EventArgs e)
        {
            var fmod = new FmodSystem();

            fmod.Init();
            var dsp     = fmod.CreateDsp(DspType.Oscillator);
            var channel = fmod.PlayDsp(dsp);

            var fmod2 = channel.SystemInstance;

            fmod.CloseSystem();
        }
 public SoundController(string fmodPath, float dopplerScale, float distanceFactor, float rollerScale)
 {
     DopplerScale   = dopplerScale;
     DistanceFactor = distanceFactor;
     MaxDistance    = distanceFactor * 8192f;
     MinDistance    = distanceFactor * 0.5f;
     RollerScale    = rollerScale;
     Fmod.SetLibraryLocation(fmodPath);
     FmodSystem = Fmod.CreateSystem();
     FmodSystem.Init(32);
     FmodSystem.Set3DSettings(dopplerScale, distanceFactor, rollerScale);
 }
示例#9
0
        public frmMain()
        {
            InitializeComponent();

            fmod = new FmodSystem();
            fmod.Init();

            var timer = new Timer();

            timer.Interval = 33; // approx 30FPS
            timer.Tick    += (sender, args) => Render();
            timer.Start();
        }
示例#10
0
        public frmMain()
        {
            InitializeComponent();

            fmod = new FmodSystem();
            fmod.Init();

            numSpectrumDetail_ValueChanged(null,null);

            var timer = new Timer();
            timer.Interval = 1000 / 60; // second number = desired FPS
            timer.Tick += (sender, args) => Render();
            timer.Start();
        }
        public static void Init()
        {
            _fmodSystem = Fmod.CreateSystem();
            _fmodSystem.Init(32);

            _basePlugin = _fmodSystem.LoadPlugin("resonanceaudio.dll");

            _listenerPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 0);
            _listenerDSP = _fmodSystem.CreateDSPByPlugin(_listenerPlugin);
            _soundFieldPlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 1);
            _sourcePlugin = _fmodSystem.GetNestedPlugin(_basePlugin, 2);

            _masterChannelGroup = _fmodSystem.MasterChannelGroup;
            _spatialChannelGroup = _fmodSystem.CreateChannelGroup("spatial");
            _masterChannelGroup.AddGroup(_spatialChannelGroup, false);

            _masterChannelGroup.AddDSP(ChannelControlDSPIndex.DspHead, _listenerDSP);
        }
示例#12
0
        public frmMain()
        {
            InitializeComponent();
            _fmod = new FmodSystem();
            _fmod.Init(32, InitFlags.SoftwareHRTF);
            _fmod.SetDspBufferSize(256,2);

            _drums = new Dictionary<DrumType, Sound>();
            const SoundMode flags = SoundMode.NonBlocking | SoundMode.SoftwareProcessing;
            _drums[DrumType.Snare] = _fmod.CreateSound("data/snare.wav", flags);
            _drums[DrumType.TomMid] = _fmod.CreateSound("data/tom_mid.wav", flags);
            _drums[DrumType.TomLow] = _fmod.CreateSound("data/tom_low.wav", flags);
            _drums[DrumType.TomFloor] = _fmod.CreateSound("data/tom_floor.wav", flags);
            _drums[DrumType.Kick] = _fmod.CreateSound("data/kick.wav", flags);
            _drums[DrumType.HihatOpen] = _fmod.CreateSound("data/cym_hatopen.wav", flags);
            _drums[DrumType.HihatMid] = _fmod.CreateSound("data/cym_hatmid.wav", flags);
            _drums[DrumType.HithatClosed] = _fmod.CreateSound("data/cym_hatclosed.wav", flags);
            _drums[DrumType.CymbalCrash] = _fmod.CreateSound("data/cym_crash.wav", flags);
            _drums[DrumType.CymbalRide] = _fmod.CreateSound("data/cym_ride.wav", flags);
        }
示例#13
0
        public frmMain()
        {
            InitializeComponent();
            _fmod = new FmodSystem();
            _fmod.Init(32, InitFlags.SoftwareHRTF);
            _fmod.SetDspBufferSize(256, 2);

            _drums = new Dictionary <DrumType, Sound>();
            const SoundMode flags = SoundMode.NonBlocking | SoundMode.SoftwareProcessing;

            _drums[DrumType.Snare]        = _fmod.CreateSound("data/snare.wav", flags);
            _drums[DrumType.TomMid]       = _fmod.CreateSound("data/tom_mid.wav", flags);
            _drums[DrumType.TomLow]       = _fmod.CreateSound("data/tom_low.wav", flags);
            _drums[DrumType.TomFloor]     = _fmod.CreateSound("data/tom_floor.wav", flags);
            _drums[DrumType.Kick]         = _fmod.CreateSound("data/kick.wav", flags);
            _drums[DrumType.HihatOpen]    = _fmod.CreateSound("data/cym_hatopen.wav", flags);
            _drums[DrumType.HihatMid]     = _fmod.CreateSound("data/cym_hatmid.wav", flags);
            _drums[DrumType.HithatClosed] = _fmod.CreateSound("data/cym_hatclosed.wav", flags);
            _drums[DrumType.CymbalCrash]  = _fmod.CreateSound("data/cym_crash.wav", flags);
            _drums[DrumType.CymbalRide]   = _fmod.CreateSound("data/cym_ride.wav", flags);
        }
示例#14
0
 public override void Initialise()
 {
     Log.Warn("FmodCore audio engine initialising");
     system.Init(999);
 }