Ejemplo n.º 1
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);
        }
Ejemplo n.º 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;
		}
Ejemplo n.º 3
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);
            }
        }
        static void StartVstHost(string pluginPath, string waveInputFilePath, string fxpFilePath, string waveOutputFilePath, bool doPlay)
        {
            VstHost host = VstHost.Instance;
            var     hcs  = new HostCommandStub();

            host.OpenPlugin(pluginPath, hcs);
            host.InputWave = waveInputFilePath;

            // with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
            // tblock = 0.15 makes blocksize = 6615.
            const int sampleRate = 44100;
            const int blockSize  = 8192;
            const 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
                if (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
                {
                    Thread.Sleep(5000);
                }

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

            if (waveOutputFilePath != "")
            {
                var fileWriter = new VstFileWriter(host);
                fileWriter.CreateWaveFile(waveOutputFilePath);
            }
        }
Ejemplo n.º 5
0
		static void StartVstHost(string pluginPath, string waveInputFilePath, string fxpFilePath, string waveOutputFilePath, bool doPlay) {

			VstHost host = VstHost.Instance;
			var hcs = new HostCommandStub();
			host.OpenPlugin(pluginPath, hcs);
			host.InputWave = waveInputFilePath;
			
			// with iblock=1...Nblocks and blocksize = Fs * tblock. Fs = 44100 and
			// tblock = 0.15 makes blocksize = 6615.
			const int sampleRate = 44100;
			const int blockSize = 8192;
			const 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
				if (playback.PlaybackDevice.PlaybackState == PlaybackState.Playing)
				{
					Thread.Sleep(5000);
				}
				
				Console.WriteLine("Ending Audio Playback");
				playback.Stop();
				Console.WriteLine("Stopped Audio Playback");
				playback.Dispose();
			}

			if (waveOutputFilePath != "") {
				var fileWriter = new VstFileWriter(host);
				fileWriter.CreateWaveFile(waveOutputFilePath);
			}
		}