Esempio n. 1
0
        public static void Dispose()
        {
            if (mp3Channel != null) mp3Channel.Dispose();
            DisposeVST();

            if (UsedLibrary == AudioLibrary.NAudio)
            {
                //NAUDIO
                Samples.Clear();
                if (playbackDevice != null)
                {
                    playbackDevice.Stop();
                    playbackDevice.Dispose();
                    playbackDevice = null;
                }

                if (Mixer32 != null) { Mixer32.Dispose(); Mixer32 = null; }
            }
            UsedLibrary = AudioLibrary.Null;
        }
Esempio n. 2
0
        public static void Dispose()
        {
            if (mp3Channel != null) mp3Channel.Dispose();
            if (GeneralSFZ != null) GeneralSFZ.Dispose();
            DisposeVST();

            if (UsedLibrary == AudioLibrary.NAudio)
            {
                //NAUDIO
                Samples.Clear();
                if (playbackDevice != null)
                {
                    playbackDevice.Stop();
                    playbackDevice.Dispose();
                    playbackDevice = null;
                }
                if (Mixer32 != null) { Mixer32.Dispose(); Mixer32 = null; }

                //=============================================
            }
            UsedLibrary = AudioLibrary.Null;
            //if (midiOut != null) midiOut.Close();
        }
Esempio n. 3
0
		//=============================================

		public static bool OpenAudio(AudioLibrary AL, int sampleRate, int channels)
		{
			if (UsedLibrary != AudioLibrary.Null ||(playbackDevice != null && playbackDevice.PlaybackState == PlaybackState.Playing)) return false;

			UsedLibrary = AL;

			if (UsedLibrary == AudioLibrary.NAudio)
			{
				//NAUDIO
				Mixer32 = new RecordableMixerStream32(sampleRate, channels);
				Mixer32.AutoStop = false;
				
				// try asio
				playbackDevice = new AsioOut(0);
				
				// if failed, try normal wave out
				if (playbackDevice == null) playbackDevice = new WaveOut();
				if (playbackDevice == null) return false;
				playbackDevice.Init(Mixer32);

				//=============================================
			}
			return true;
		}
Esempio n. 4
0
        //private static MidiOut midiOut = null;
        //=============================================
        public static bool OpenAudio(AudioLibrary AL,AudioEffectChain General)
        {
            if (UsedLibrary != AudioLibrary.Null ||(playbackDevice != null && playbackDevice.PlaybackState == PlaybackState.Playing)) return false;

            UsedLibrary = AL;

            if (UsedLibrary == AudioLibrary.NAudio)
            {
                //if (midiOut != null) midiOut.Close();

                //NAUDIO
                Mixer32 = new RecordableMixerStream32();
                Mixer32.Chain = General;
                Mixer32.AutoStop = false;
                playbackDevice = new AsioOut(0);//new WaveOut();//
                if (playbackDevice == null) playbackDevice = new WaveOut();
                if (playbackDevice == null) return false;
                playbackDevice.Init(Mixer32);

                //=============================================
            }
            return true;
        }