public void SetDevice(DirectSoundDeviceInfo device, FunstimParameters parameters)
        {
            if (_device != null)
            {
                _device.Dispose();
                OnDeviceRemoved(_device);
            }

            _device = new FunstimAudioDevice(device, parameters);
            OnDeviceFound(_device);
        }
Esempio n. 2
0
        public FunstimAudioDevice(DirectSoundDeviceInfo device, FunstimParameters parameters)
        {
            Name = "Funstim - " + device.Description;

            _soundOut = new DirectSoundOut(device.Guid);

            try
            {
                List <int> frequencies = Array.ConvertAll(parameters.Frequencies.Split(','), int.Parse).Where(x => x != 0).ToList();

                _provider = new FunstimSampleProvider(frequencies, (int)parameters.FadeMs.TotalMilliseconds, parameters.FadeOnPause);

                _soundOut.Init(_provider);
                _soundOut.Play();

                MinDelayBetweenCommands = TimeSpan.Zero;
            }
            catch (FormatException e)
            {
            }
        }