Пример #1
0
        static void StartAudioOutput(string pluginPath, string waveFilePath)
        {
            try
            {
                var hostCmdStub      = new HostCommandStub();
                VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub);

                // add custom data to the context
                ctx.Set("PluginPath", pluginPath);
                ctx.Set("HostCmdStub", hostCmdStub);

                // actually open the plugin itself
                ctx.PluginCommandStub.Open();

                var audioOut = new AudioOutput(
                    new List <IVstPluginCommandStub>()
                {
                    ctx.PluginCommandStub
                },
                    waveFilePath);
                Thread.Sleep(100);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Пример #2
0
		private VstPluginContext OpenPlugin(string pluginPath)
		{
			try
			{
				var hostCmdStub = new HostCommandStub();
				hostCmdStub.PluginCalled += new EventHandler<PluginCalledEventArgs>(HostCmdStub_PluginCalled);

				VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub);

				// add custom data to the context
				ctx.Set("PluginPath", pluginPath);
				ctx.Set("HostCmdStub", hostCmdStub);

				// actually open the plugin itself
				ctx.PluginCommandStub.Open();
					
				return ctx;
			}
			catch (Exception e)
			{
				MessageBox.Show(this, e.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
			}

			return null;
		}
Пример #3
0
        private VstPluginContext OpenPlugin(string pluginPath)
        {
            try
            {
                HostCommandStub hostCmdStub = new HostCommandStub();
                hostCmdStub.PluginCalled += new EventHandler <PluginCalledEventArgs>(HostCmdStub_PluginCalled);

                VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub);

                // add custom data to the context
                ctx.Set("PluginPath", pluginPath);
                ctx.Set("HostCmdStub", hostCmdStub);

                // actually open the plugin itself
                ctx.PluginCommandStub.Open();

                return(ctx);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(null);
        }
Пример #4
0
        private void HostCmdStub_PluginCalled(object sender, PluginCalledEventArgs e)
        {
            HostCommandStub hostCmdStub = (HostCommandStub)sender;

            // can be null when called from inside the plugin main entry point.
            if (hostCmdStub.PluginContext.PluginInfo != null)
            {
                Debug.WriteLine("Plugin " + hostCmdStub.PluginContext.PluginInfo.PluginID + " called:" + e.Message);
            }
            else
            {
                Debug.WriteLine("The loading Plugin called:" + e.Message);
            }
        }
Пример #5
0
        static void StartVstHost(string pluginPath, string waveInputFilePath, string fxpFilePath, string waveOutputFilePath, bool doPlay)
        {
            VstHost             host        = VstHost.Instance;
            IVstHostCommandStub hostCmdStub = new HostCommandStub();

            host.OpenPlugin(pluginPath, hostCmdStub);
            host.InputWave = waveInputFilePath;
            // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
            // tblock = 0.15 makes blocksize = 6615.
            int sampleRate = 44100;
            int blockSize  = (int)(sampleRate * 0.15f);             //6615;
            int channels   = 2;

            host.Init(blockSize, sampleRate, channels);
            System.Diagnostics.Debug.WriteLine(host.getPluginInfo());
            host.LoadFXP(fxpFilePath);

            if (doPlay)
            {
                var playback = new VstPlaybackNAudio(host);
                playback.Play();

                Console.WriteLine("Started Audio Playback");

                // make sure to play while the stream is playing
                while (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
                {
                    Thread.Sleep(100);
                }

                Console.WriteLine("Ending Audio Playback");
                playback.Stop();
                Console.WriteLine("Stopped Audio Playback");
                playback.Dispose();
            }

            if (waveOutputFilePath != "")
            {
                var fileWriter = new VstFileWriter(host);
                fileWriter.CreateWaveFile(waveOutputFilePath);
            }
        }
Пример #6
0
		static void StartVstHost(string pluginPath, string waveInputFilePath, string fxpFilePath, string waveOutputFilePath, bool doPlay) {

			VstHost host = VstHost.Instance;
			IVstHostCommandStub hostCmdStub = new HostCommandStub();
			host.OpenPlugin(pluginPath, hostCmdStub);
			host.InputWave = waveInputFilePath;
			// with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
			// tblock = 0.15 makes blocksize = 6615.
			int sampleRate = 44100;
			int blockSize = (int) (sampleRate * 0.15f); //6615;
			int channels = 2;
			host.Init(blockSize, sampleRate, channels);
			System.Diagnostics.Debug.WriteLine(host.getPluginInfo());
			host.LoadFXP(fxpFilePath);

			if (doPlay) {
				var playback = new VstPlaybackNAudio(host);
				playback.Play();
				
				Console.WriteLine("Started Audio Playback");
				
				// make sure to play while the stream is playing
				while (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
				{
					Thread.Sleep(100);
				}
				
				Console.WriteLine("Ending Audio Playback");
				playback.Stop();
				Console.WriteLine("Stopped Audio Playback");
				playback.Dispose();
			}
			
			if (waveOutputFilePath != "") {
				var fileWriter = new VstFileWriter(host);
				fileWriter.CreateWaveFile(waveOutputFilePath);
			}
		}
Пример #7
0
		static void StartAudioOutput(string pluginPath, string waveFilePath) {
			try
			{
				var hostCmdStub = new HostCommandStub();
				VstPluginContext ctx = VstPluginContext.Create(pluginPath, hostCmdStub);
				
				// add custom data to the context
				ctx.Set("PluginPath", pluginPath);
				ctx.Set("HostCmdStub", hostCmdStub);
				
				// actually open the plugin itself
				ctx.PluginCommandStub.Open();
				
				AudioOutput audioOut = new AudioOutput(
					new List<IVstPluginCommandStub>() {ctx.PluginCommandStub},
					waveFilePath);
				Thread.Sleep(100);
			}
			catch (Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex);
			}
		}