bool AllMembersDead()
    {
        foreach (Transform childPositionGameObject in transform)
        {
            if (childPositionGameObject.childCount > 0)
            {
                return(false);
            }
        }

        waveRecorder.Wave();

        if (WaveRecorder.GetWave() % 5 == 0)
        {
            shipController.DisplayBombCounter(addBombsPer5Wave);
            shipController.DisplayHealth(addHealthPer5Wave);
        }

        if (WaveRecorder.GetWave() % 10 == 0)
        {
            shipController.DisplayBombCounter(addBombsPer10Wave);
            shipController.DisplayHealth(addHealthPer10Wave);
        }

        return(true);
    }
Beispiel #2
0
        public unsafe void Play()
        {
            if (this._wavePlayer == null && this._waveDuplex == null)
            {
                this._isPlaying = true;
                try
                {
                    switch (this._inputType)
                    {
                    case InputType.SoundCard:
                        if (this._inputDevice == this._outputDevice)
                        {
                            this._waveDuplex = new WaveDuplex(this._inputDevice, this._inputSampleRate, this._inputBufferSize, this.DuplexFiller);
                        }
                        else
                        {
                            this._iqCircularBuffer    = new ComplexCircularBuffer(this._inputBufferSize, 6);
                            this._audioCircularBuffer = new FloatCircularBuffer(this._outputBufferSize, 2);
                            this._waveRecorder        = new WaveRecorder(this._inputDevice, this._inputSampleRate, this._inputBufferSize, this.RecorderFiller);
                            this._wavePlayer          = new WavePlayer(this._outputDevice, this._outputSampleRate, this._outputBufferSize / 2, this.PlayerFiller);
                            this._dspThread           = new Thread(this.DSPProc);
                            this._dspThread.Start();
                        }
                        break;

                    case InputType.WaveFile:
                        this._iqCircularBuffer    = new ComplexCircularBuffer(this._inputBufferSize, 6);
                        this._audioCircularBuffer = new FloatCircularBuffer(this._outputBufferSize, 2);
                        this._wavePlayer          = new WavePlayer(this._outputDevice, this._outputSampleRate, this._outputBufferSize / 2, this.PlayerFiller);
                        this._waveReadThread      = new Thread(this.WaveFileFiller);
                        this._waveReadThread.Start();
                        this._dspThread = new Thread(this.DSPProc);
                        this._dspThread.Start();
                        break;

                    case InputType.Plugin:
                        this._iqCircularBuffer    = new ComplexCircularBuffer(this._inputBufferSize, 6);
                        this._audioCircularBuffer = new FloatCircularBuffer(this._outputBufferSize, 2);
                        this._wavePlayer          = new WavePlayer(this._outputDevice, this._outputSampleRate, this._outputBufferSize / 2, this.PlayerFiller);
                        if (this._frontend is IIQStreamController)
                        {
                            ((IIQStreamController)this._frontend).Start(this.FrontendFiller);
                        }
                        this._dspThread = new Thread(this.DSPProc);
                        this._dspThread.Start();
                        break;
                    }
                    if (this._dspThread != null)
                    {
                        this._dspThread.Name = "DSP Thread";
                    }
                }
                catch
                {
                    this._isPlaying = false;
                    throw;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WaveRecorderViewModel"/> class.
        /// </summary>
        public AudioProcessor(string file)
        {
            SampleRate  = 16000;
            IsRecording = true;
            var app = Resolver.Resolve <IXFormsApp>();

            var device = Resolver.Resolve <IDevice>();

            if (device != null)
            {
                _audioStream = device.Microphone;
                _recorder    = new WaveRecorder();
            }
            var fileStream = DependencyService.Get <IFileLoader>().LoadWriteStream(file);

            Record = new Command(
                () => {
                _audioStream.OnBroadcast += audioStream_OnBroadcast;
                //this.audioStream.Start.Execute(this.SampleRate);
                _recorder.StartRecorder(
                    _audioStream,
                    fileStream,
                    SampleRate).ContinueWith(t => {
                    if (t.IsCompleted)
                    {
                        IsRecording = t.Result;
                        System.Diagnostics.Debug.WriteLine("Microphone recorder {0}.", IsRecording ? "was started" : "failed to start.");
                        Record.ChangeCanExecute();
                        Stop.ChangeCanExecute();
                    }
                    else if (t.IsFaulted)
                    {
                        _audioStream.OnBroadcast -= audioStream_OnBroadcast;
                    }
                });
            },
                () => RecordingEnabled &&
                _audioStream.SupportedSampleRates.Contains(SampleRate) &&
                !IsRecording &&
                device.FileManager != null
                );

            Stop = new Command(
                async() => {
                _audioStream.OnBroadcast -= audioStream_OnBroadcast;
                await _recorder.StopRecorder();
                //this.audioStream.Stop.Execute(this);
                Debug.WriteLine("Microphone recorder was stopped.");
                Record.ChangeCanExecute();
                Stop.ChangeCanExecute();
                IsRecording = false;
            },
                () => {
                return(IsRecording);
            }
                );
        }
Beispiel #4
0
        public override async Task <CommandResult> RunVoiceCommand(string[] args, CommandContext context, ConnectionModel connection)
        {
            if (connection.Recording)
            {
                connection.Recording = false;
            }
            else
            {
                try
                {
                    SilenceProvider silence = new SilenceProvider(format);
                    mixer.AddInputStream(new Wave16ToFloatProvider(silence));
                    mixer.AddInputStream(new Wave16ToFloatProvider(new VolumeWaveProvider16(connection.RecordBuffer)
                    {
                        Volume = 0.1f
                    }));

                    path = Path.ChangeExtension(Path.GetTempFileName(), ".wav");

                    recorder = new WaveRecorder(mixer, path);
                    model    = connection;

                    connection.Connection.VoiceReceived += Connection_VoiceReceived;
                    connection.Disconnected             += Connection_Disconnected;
                    connection.Recording = true;

                    await context.ReplyAsync("Now recording...");

                    output = new WaveOut();
                    output.Init(new VolumeWaveProvider16(new WaveFloatTo16Provider(recorder))
                    {
                        Volume = 0.0f
                    });

                    int pingInSamples = (48000 * (connection.Connection.Ping / 1000)) * 2;
                    connection.RecordBuffer.ClearBuffer();
                    connection.RecordBuffer.AddSamples(Enumerable.Repeat((byte)0, pingInSamples).ToArray(), 0, pingInSamples);
                    output.Play();
                }
                catch { }

                while (connection.Connected && connection.Recording)
                {
                    await Task.Delay(100);
                }

                await CleanupAsync();

                string newPath = new Uri(Path.Combine(Path.GetTempPath(), $"{context.Guild.Name.ToLower()} - {DateTime.Now.ToString("dd-MM-yyyy HH-mm", CultureInfo.InvariantCulture)}.mp3")).LocalPath;
                MediaFoundationEncoder.EncodeToMp3(new WaveFileReader(path), newPath);
                await context.Channel.SendFileAsync(newPath, $"Here's your ~~clusterfuck~~ recording!");
            }

            return(CommandResult.Empty);
        }
Beispiel #5
0
 public void Stop()
 {
     if (this._inputType == InputType.Plugin && this._frontend != null)
     {
         this._frontend.Stop();
         this._frontend = null;
     }
     if (this._wavePlayer != null)
     {
         this._wavePlayer.Dispose();
         this._wavePlayer = null;
     }
     if (this._waveRecorder != null)
     {
         this._waveRecorder.Dispose();
         this._waveRecorder = null;
     }
     if (this._waveDuplex != null)
     {
         this._waveDuplex.Dispose();
         this._waveDuplex = null;
     }
     this._inputSampleRate = 0.0;
     if (this._waveReadThread != null)
     {
         this._waveReadThread.Join();
         this._waveReadThread = null;
     }
     if (this._iqStream != null)
     {
         this._iqStream.Close();
     }
     if (this._audioStream != null)
     {
         this._audioStream.Close();
     }
     if (this._dspThread != null)
     {
         this._dspThread.Join();
         this._dspThread = null;
     }
     if (this._waveFile != null)
     {
         this._waveFile.Dispose();
         this._waveFile = null;
     }
     if (this._iqStream != null)
     {
         this._iqStream.Dispose();
         this._iqStream = null;
     }
     this._audioStream  = null;
     this._dspOutBuffer = null;
     this._iqInBuffer   = null;
 }
Beispiel #6
0
        public MainWindow()
        {
            InitializeComponent();

            WaveRecorderSettings defaultSettings = WaveRecorderSettings.CreateDefault();
            _fft = new Fft(defaultSettings.SamplesPerSecond);

            _recorder = new WaveRecorder();
            _recorder.SoundRecorded +=
                data => Dispatcher.Invoke(new WaveRecorder.SoundRecordedAction(_recorder_SoundRecorded), data);
        }
Beispiel #7
0
 public void Stop()
 {
     this._isPlaying = false;
     if (this._inputType == InputType.Plugin && this._frontend is IIQStreamController)
     {
         ((IIQStreamController)this._frontend).Stop();
         this._frontend = null;
     }
     if (this._iqCircularBuffer != null)
     {
         this._iqCircularBuffer.Close();
     }
     if (this._audioCircularBuffer != null)
     {
         this._audioCircularBuffer.Close();
     }
     if (this._wavePlayer != null)
     {
         this._wavePlayer.Dispose();
         this._wavePlayer = null;
     }
     if (this._waveRecorder != null)
     {
         this._waveRecorder.Dispose();
         this._waveRecorder = null;
     }
     if (this._waveDuplex != null)
     {
         this._waveDuplex.Dispose();
         this._waveDuplex = null;
     }
     this._inputSampleRate = 0.0;
     if (this._waveReadThread != null)
     {
         this._waveReadThread.Join();
         this._waveReadThread = null;
     }
     if (this._dspThread != null)
     {
         this._dspThread.Join();
         this._dspThread = null;
     }
     if (this._waveFile != null)
     {
         this._waveFile.Dispose();
         this._waveFile = null;
     }
     this._iqCircularBuffer    = null;
     this._audioCircularBuffer = null;
     this._dspOutBuffer        = null;
 }
Beispiel #8
0
        private void PlayChord()
        {
            var recorder = new WaveRecorder();

            var melody = GetMelody();//new Melody(Chord.Maj(NoteKey.C3));
            var wav    = new WaveFile
            {
                Wave = recorder.ToBytes(melody)
            };

            using var stream = File.OpenWrite("chord.wav");
            recorder.Record(stream, wav);

            new WaveVisualiser().Visualize(wav.Wave, 800, 600).Save("chord.png", ImageFormat.Png);
        }
    // Use this for initialization
    void Start()
    {
        waveRecorder = GameObject.Find("Enemy_Wave").GetComponent <WaveRecorder>();

        float depth = transform.position.z - Camera.main.transform.position.z;

        bottomLeftBoundary = Camera.main.ViewportToWorldPoint(new Vector3(0f, 0.3f, depth));
        topRightBoundary   = Camera.main.ViewportToWorldPoint(new Vector3(1f, 1f, depth));
        xMin = bottomLeftBoundary.x + xPadding;
        xMax = topRightBoundary.x - xPadding;
        yMin = bottomLeftBoundary.y + yPadding;
        yMax = topRightBoundary.y - yPadding;

        shipController = GameObject.Find("Player_Ship").GetComponent <ShipController>();

        SpawnEnemies();
    }
        public void Play()
        {
            if (_wavePlayer != null || _waveDuplex != null)
            {
                return;
            }

            switch (_inputType)
            {
            case InputType.SoundCard:
                if (_inputDevice == _outputDevice)
                {
                    _waveDuplex = new WaveDuplex(_inputDevice, _inputSampleRate, _inputBufferSize, DuplexFiller);
                }
                else
                {
                    _iqStream     = new ComplexFifoStream(BlockMode.BlockingRead);
                    _audioStream  = new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize);
                    _waveRecorder = new WaveRecorder(_inputDevice, _inputSampleRate, _inputBufferSize, RecorderFiller);
                    _wavePlayer   = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                    _dspThread    = new Thread(DSPProc);
                    _dspThread.Start();
                }
                break;

            case InputType.WaveFile:
                _iqStream       = new ComplexFifoStream(BlockMode.BlockingRead);
                _audioStream    = new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize);
                _wavePlayer     = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                _waveReadThread = new Thread(WaveFileFiller);
                _waveReadThread.Start();
                _dspThread = new Thread(DSPProc);
                _dspThread.Start();
                break;

            case InputType.Plugin:
                _iqStream    = new ComplexFifoStream(BlockMode.BlockingRead);
                _audioStream = new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize);
                _wavePlayer  = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                _frontend.Start(FrontendFiller);
                _dspThread = new Thread(DSPProc);
                _dspThread.Start();
                break;
            }
        }
Beispiel #11
0
        private void PlayNew()
        {
            PlayChord();
            return;


            var durations = new[]
            {
                NoteDuration.Eighth,
                NoteDuration.Quarter,
            };
            var generator = new MelodyGenerator(new RandomDurationGenerator(durations: durations));
            var melody    = generator.Generate(Gammas.CMaj5, 80);

            var bassDurations = new[]
            {
                NoteDuration.Half,
                NoteDuration.Half,
                NoteDuration.Quarter
            };
            var bassGenerator = new MelodyGenerator(new RandomDurationGenerator(durations: bassDurations));
            var bass          = bassGenerator.GenerateMajChords(Gammas.CMaj3, 40);

            //var drums = new MelodyGenerator(new RandomDurationGenerator(durations: new [] {NoteDuration.Whole}))
            //    .Generate(new [] {NoteKey.C2}, 40);

            using var memoryStream = File.OpenWrite("temp.wav");
            using var binaryWriter = new BinaryWriter(memoryStream);
            var recorder = new WaveRecorder();

            //var wave = recorder.Record(binaryWriter, new [] {melody, bass});

            //new WaveVisualiser().Visualize(wave, 800, 600).Save("temp.png", ImageFormat.Png);
            //memoryStream.Position = 0;

            //new SoundPlayer(memoryStream).Play();
        }
Beispiel #12
0
        public void Play()
        {
            if (_wavePlayer != null || _waveDuplex != null)
            {
                return;
            }

            #region Stream Hooks

            if (_streamHookManager != null)
            {
                _streamHookManager.InitStreams(_inputBufferSize, _outputBufferSize);

                if (_streamHookManager.HaveIqObservers)
                {
                    _streamHookManager.StartIQObserverThread(_inputBufferSize);
                }

                _streamHookManager.OutputSampleRate = _outputSampleRate;
                _streamHookManager.InputSampleRate  = _inputSampleRate;
            }

            #endregion

            Utils.Log($"play() input type: {_inputType}");
            switch (_inputType)
            {
            case InputType.SoundCard:
                if (_inputDevice == _outputDevice)
                {
                    _waveDuplex = new WaveDuplex(_inputDevice, _inputSampleRate, _inputBufferSize, DuplexFiller);
                }
                else
                {
                    _iqStream     = new ComplexFifoStream(BlockMode.BlockingRead);
                    _audioStream  = _streamHookManager == null ? new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize) : _streamHookManager.FirstAudioStream;
                    _waveRecorder = new WaveRecorder(_inputDevice, _inputSampleRate, _inputBufferSize, RecorderFiller);
                    _wavePlayer   = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                    _dspThread    = new Thread(DSPProc);
                    _dspThread.Start();
                }
                break;

            case InputType.WaveFile:
                _iqStream       = new ComplexFifoStream(BlockMode.BlockingRead);
                _audioStream    = _streamHookManager == null ? new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize) : _streamHookManager.FirstAudioStream;
                _wavePlayer     = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                _waveReadThread = new Thread(WaveFileFiller);
                _waveReadThread.Start();
                _dspThread = new Thread(DSPProc);
                _dspThread.Start();
                break;

            case InputType.Plugin:
                _iqStream    = new ComplexFifoStream(BlockMode.BlockingRead);
                _audioStream = _streamHookManager == null ? new FloatFifoStream(BlockMode.BlockingWrite, _outputBufferSize) : _streamHookManager.FirstAudioStream;
                _wavePlayer  = new WavePlayer(_outputDevice, _outputSampleRate, _outputBufferSize / 2, PlayerFiller);
                _frontend.Start(FrontendFiller);
                _dspThread = new Thread(DSPProc);
                _dspThread.Start();
                break;
            }

            Utils.Log($"_dspThread: {_dspThread.ManagedThreadId}");


            if (_streamHookManager != null)
            {
                _streamHookManager.Start();
            }
        }
Beispiel #13
0
 public void Stop()
 {
     if (_inputType == InputType.Plugin && _frontend != null)
     {
         _frontend.Stop();
         _frontend = null;
     }
     if (_wavePlayer != null)
     {
         _wavePlayer.Dispose();
         _wavePlayer = null;
     }
     if (_waveRecorder != null)
     {
         _waveRecorder.Dispose();
         _waveRecorder = null;
     }
     if (_waveDuplex != null)
     {
         _waveDuplex.Dispose();
         _waveDuplex = null;
     }
     _inputSampleRate = 0;
     if (_waveReadThread != null)
     {
         _waveReadThread.Join();
         _waveReadThread = null;
     }
     if (_iqStream != null)
     {
         _iqStream.Close();
     }
     if (_audioStream != null)
     {
         _audioStream.Close();
     }
     if (_streamHookManager != null)
     {
         _streamHookManager.CloseStreams();
         _streamHookManager.Stop();
     }
     if (_dspThread != null)
     {
         _dspThread.Join();
         _dspThread = null;
     }
     if (_streamHookManager != null)
     {
         _streamHookManager.StopIQObserverThread();
     }
     if (_waveFile != null)
     {
         _waveFile.Dispose();
         _waveFile = null;
     }
     if (_iqStream != null)
     {
         _iqStream.Dispose();
         _iqStream = null;
     }
     if (_streamHookManager != null)
     {
         _streamHookManager.DisposeStreams();
     }
     _audioStream  = null;
     _dspOutBuffer = null;
     _iqInBuffer   = null;
 }
        public WaveRecorderViewModel()
        {
            this.SampleRate = 16000;

            var app = Resolver.Resolve <IXFormsApp>();

            //this.FileName = System.IO.Path.Combine(app.AppDataDirectory, "audiosample.wav");
            this.FileName = Device.OnPlatform(
                System.IO.Path.Combine(app.AppDataDirectory, "audiosample.wav"),
                "audiosample.wav",
                System.IO.Path.Combine(app.AppDataDirectory, "audiosample.wav")
                );

            var device = Resolver.Resolve <IDevice>();

            if (device != null)
            {
                this.audioStream = device.Microphone;
                this.recorder    = new WaveRecorder();
            }

            this.Record = new Command(
                () =>
            {
                this.audioStream.OnBroadcast += audioStream_OnBroadcast;
                //this.audioStream.Start.Execute(this.SampleRate);
                this.recorder.StartRecorder(
                    this.audioStream,
                    device.FileManager.OpenFile(this.FileName, Services.IO.FileMode.Create, Services.IO.FileAccess.Write),
                    this.SampleRate).ContinueWith(t =>
                {
                    if (t.IsCompleted)
                    {
                        this.IsRecording = t.Result;
                        System.Diagnostics.Debug.WriteLine("Microphone recorder {0}.", this.IsRecording ? "was started" : "failed to start.");
                        this.Record.ChangeCanExecute();
                        this.Stop.ChangeCanExecute();
                    }
                    else if (t.IsFaulted)
                    {
                        this.audioStream.OnBroadcast -= audioStream_OnBroadcast;
                    }
                });
            },
                () => this.RecordingEnabled &&
                this.audioStream.SupportedSampleRates.Contains(this.SampleRate) &&
                !this.IsRecording &&
                device.FileManager != null
                );

            this.Stop = new Command(
                async() =>
            {
                this.audioStream.OnBroadcast -= audioStream_OnBroadcast;
                await this.recorder.StopRecorder();
                //this.audioStream.Stop.Execute(this);
                System.Diagnostics.Debug.WriteLine("Microphone recorder was stopped.");
                this.Record.ChangeCanExecute();
                this.Stop.ChangeCanExecute();
            },
                () =>
            {
                return(this.IsRecording);
            }
                );
        }
 // Use this for initialization
 void Start()
 {
     waveText      = GetComponent <Text>();
     waveText.text = (WaveRecorder.wave - 1).ToString();
     WaveRecorder.ResetWave();
 }
Beispiel #16
0
        public unsafe void Play()
        {
            if (this._wavePlayer == null && this._waveDuplex == null)
            {
                if (this._inputType != InputType.WaveFile)
                {
                    this._waveStart = DateTime.Now.AddYears(1);
                }
                double sampleRate      = this._outputSampleRate;
                int    framesPerBuffer = this._outputBufferSize / 2;
                if (this._soundCardRatio > 1.0)
                {
                    sampleRate      = (double)this._minOutputSampleRate;
                    framesPerBuffer = (int)((double)this._outputBufferSize / (2.0 * this._soundCardRatio));
                }
                switch (this._inputType)
                {
                case InputType.SoundCard:
                    if (this._inputDevice == this._outputDevice)
                    {
                        this._waveDuplex = new WaveDuplex(this._inputDevice, this._inputSampleRate, this._inputBufferSize, this.DuplexFiller);
                    }
                    else
                    {
                        this._iqStream = new ComplexFifoStream(BlockMode.BlockingRead);
                        ComplexFifoStream iqStream2 = this._iqStream;
                        bool read2 = false;
                        iqStream2.SetLog("_iqStream", 20000, read2, true);
                        this._audioStream = new FloatFifoStream(BlockMode.BlockingWrite, this._outputBufferSize);
                        Console.WriteLine("_audioStream created with size " + this._outputBufferSize.ToString());
                        FloatFifoStream audioStream3 = this._audioStream;
                        bool            write3       = false;
                        audioStream3.SetLog("_audioStream", this._outputBufferSize, true, write3);
                        this._waveRecorder = new WaveRecorder(this._inputDevice, this._inputSampleRate, this._inputBufferSize, this.RecorderFiller);
                        this._wavePlayer   = new WavePlayer(this._outputDevice, sampleRate, framesPerBuffer, this.PlayerFiller);
                        this._dspThread    = new Thread(this.DSPProc);
                        this._dspThread.Start();
                    }
                    break;

                case InputType.WaveFile:
                {
                    this._iqStream = new ComplexFifoStream(BlockMode.BlockingRead);
                    this._iqStream.SetLog("_iqStream", 20000, true, true);
                    this._audioStream = new FloatFifoStream(BlockMode.BlockingWrite, this._outputBufferSize * 2);
                    Console.WriteLine("_audioStream created with size " + (this._outputBufferSize * 2).ToString());
                    FloatFifoStream audioStream2 = this._audioStream;
                    bool            write2       = false;
                    audioStream2.SetLog("_audioStream", this._outputBufferSize, true, write2);
                    this._wavePlayer     = new WavePlayer(this._outputDevice, sampleRate, framesPerBuffer, this.PlayerFiller);
                    this._waveReadThread = new Thread(this.WaveFileFiller);
                    this._waveReadThread.Start();
                    this._dspThread = new Thread(this.DSPProc);
                    this._dspThread.Start();
                    break;
                }

                case InputType.Plugin:
                {
                    this._iqStream = new ComplexFifoStream(BlockMode.BlockingRead);
                    ComplexFifoStream iqStream = this._iqStream;
                    bool read = false;
                    iqStream.SetLog("_iqStream", 20000, read, true);
                    this._audioStream = new FloatFifoStream(BlockMode.BlockingWrite, this._outputBufferSize * 2);
                    Console.WriteLine("_audioStream created with size " + (this._outputBufferSize * 2).ToString());
                    FloatFifoStream audioStream = this._audioStream;
                    bool            write       = false;
                    audioStream.SetLog("_audioStream", 0, true, write);
                    this._wavePlayer = new WavePlayer(this._outputDevice, sampleRate, framesPerBuffer, this.PlayerFiller);
                    this._frontend.Start(this.FrontendFiller);
                    this._dspThread = new Thread(this.DSPProc);
                    this._dspThread.Start();
                    break;
                }
                }
            }
        }