예제 #1
0
        public void PlayDSP(DSP dsp, bool paused, Channel.Channel chn)
        {
            IntPtr channel = chn.DangerousGetHandle();

            Code returnCode = PlayDSP(DangerousGetHandle(), Index.Reuse, dsp.DangerousGetHandle(), paused, ref channel);
            Errors.ThrowError(returnCode);

            //This can't really happend.
            //Check just in case...
            if (chn.DangerousGetHandle() != channel)
                throw new Exception("Channel handle got changed by Fmod.");
        }
예제 #2
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        this.SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();
        this.SoundSystem.Init();

        this.SoundFile = SoundSystem.CreateSound (@"/home/madrang/Music/Tetris.mp3", Linsft.FmodSharp.Mode.Default);

        if(this.Channel != null)
            this.Channel.Dispose();

        this.Channel = this.SoundSystem.PlaySound(SoundFile);

        this.fft_Draw = new Linsft.FmodSharp.Gtk.FFTDraw();
        this.fft_Draw.Source = this.Channel;
        this.fft_Draw.Show();
        this.Add(this.fft_Draw);
    }
예제 #3
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        this.SoundSystem = new Linsft.FmodSharp.SoundSystem.SoundSystem();
        this.SoundSystem.Init();

        this.SoundFile = SoundSystem.CreateSound(@"/home/madrang/Music/Tetris.mp3", Linsft.FmodSharp.Mode.Default);

        if (this.Channel != null)
        {
            this.Channel.Dispose();
        }

        this.Channel = this.SoundSystem.PlaySound(SoundFile);


        this.fft_Draw        = new Linsft.FmodSharp.Gtk.FFTDraw();
        this.fft_Draw.Source = this.Channel;
        this.fft_Draw.Show();
        this.Add(this.fft_Draw);
    }
예제 #4
0
        public void Dispose()
        {
            Stop();

            if (EqualizerEngine != null)
            {
                EqualizerEngine.Dispose();
                EqualizerEngine = null;
            }
            if (_channel != null)
            {
                _soundFile.Dispose();
                _soundFile = null;
                _channel.Dispose();
                _channel = null;
            }

            if (_soundSystem != null)
            {
                _soundSystem.Dispose();
                _soundSystem = null;
            }
        }
예제 #5
0
 public void Stop()
 {
     lock (_playerLock)
     {
         if (_channel != null)
         {
             _channel.SetCallback(null);
             _channel.Stop();
             _channel = null;
             _isLoaded = false;
         }
     }
 }
예제 #6
0
        public void Play()
        {
            Stop();
            Task.Factory.StartNew(() =>
                {
                    var openState = OpenState.Error;
                    uint percent = 0;

                    while (openState != OpenState.Ready)
                    {
                        _soundFile.GetOpenState(ref openState, ref percent);
                        Thread.Sleep(10);
                    }

                    _channel = _soundSystem.PlaySound(_soundFile);
                    _channel.Volume = Volume;
                    _channel.SetCallback(_callback);

                    while (_channel != null)
                    {
                        if (_soundSystem != null)
                            _soundSystem.Update();

                        Thread.Sleep(50);
                    }
                });
        }
예제 #7
0
        private void PlaySound(Sound.Sound snd, bool paused, Channel.Channel chn)
        {
            //FIXME The handle is changed most of the time on some system.
            //Only use the other metods to be safe.

            IntPtr channel = chn.DangerousGetHandle();

            Code returnCode = PlaySound(DangerousGetHandle(), Index.Reuse, snd.DangerousGetHandle(), paused, ref channel);
            Errors.ThrowError(returnCode);

            //This can't really happend.
            //Check just in case...
            if (chn.DangerousGetHandle() == channel)
                throw new Exception("Channel handle got changed by Fmod.");
        }