Example #1
0
 public SoundEx(string filename, bool autoDispose = true, int loopCount = 0, bool streaming = true)
 {
     _sound           = _system.CreateSound(filename, Mode.LoopNormal | (streaming ? Mode.CreateStream : Mode.Default));
     _sound.LoopCount = loopCount;
     _autoDispose     = autoDispose;
     _effects         = new List <Dsp>();
 }
 public Sound Load2DSoundFromFile(string path, bool loops = false)
 {
     return(new()
     {
         FModSound = FmodSystem.CreateSound(path, Mode._2D | (loops? Mode.Loop_Normal : Mode.Loop_Off))
     });
 }
Example #3
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     if (channel != null && channel.IsPlaying)
     {
         return;
     }
     sound   = fmod.CreateSound(MP3_PATH);
     channel = fmod.PlaySound(sound);
 }
Example #4
0
 public void LoadSound(FmodSystem system, string filename)
 {
     SoundChanged?.Invoke(this, EventArgs.Empty);
     new Thread(() =>
     {
         using (var sound = system.CreateSound(filename, Mode.Default))
             WaveformPathFactory.Create(sound, out _maxPeakPath, out _avgPeakPath);
         Invoke(new Action(RefreshBrushes));
     }).Start();
 }
        public Sound Load3DSoundFromFile(string path, bool loops = false)
        {
            var sound = new Sound()
            {
                FModSound = FmodSystem.CreateSound(path, Mode._3D | (loops? Mode.Loop_Normal : Mode.Loop_Off))
            };

            sound.FModSound.Set3DMinMaxDistance(MinDistance, MaxDistance);
            return(sound);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
0
        public void Play(string filename, params DspType[] effects)
        {
            var sound = _system.CreateSound(filename, Mode);

            Play(sound, effects);
        }