Example #1
0
        /// <summary>
        /// This method is called by the main Audio Device Initialization method: Prepare(…).
        /// </summary>
        void DriverInit()
        {
            if (audioDriver==Driver.Wasapi) xAudio = new WasapiOut(AudioClientShareMode.Shared,Settings.Latency);
            else if (audioDriver==Driver.Wave) xAudio = new WaveOut();
            else if (audioDriver==Driver.DirectSound)
            {
                if (DriverId!=Guid.Empty) xAudio = new DirectSoundOut(DriverId, Settings.Latency);
                else xAudio = new DirectSoundOut(Settings.Latency);
            }
            else if (audioDriver==Driver.ASIO) xAudio = new AsioOut(1);

              if (CurrentChannel!=null) { CurrentChannel.Dispose(); CurrentChannel = null; }

            xAudio.PlaybackStopped -= Event_PlaybackStopped;
            xAudio.PlaybackStopped += Event_PlaybackStopped;
        }
Example #2
0
 /// <summary>
 /// Main NAudio WaveOut initialization call.
 /// </summary>
 public void Prepare(/*params IVstPluginContext[] context*/)
 {
     DriverInit();
     CurrentChannel = new VSTStream32();
     CurrentChannel.SetWaveFormat( Settings.Rate, Settings.Channels );
     CurrentChannel.Parent = this;
     xAudio.Init(CurrentChannel);
     CurrentChannel.Volume = volume;
     if (PlaybackStarted != null) PlaybackStarted(this,EventArgs.Empty);
 }