コード例 #1
0
ファイル: Program.cs プロジェクト: LuckyLuik/AudioVSTToolbox
		public static void Main(string[] args)
		{
			string pluginPath = "";
			string waveInputFilePath = "";
			string waveOutputFilePath = "";
			string fxpFilePath = "";
			float volume = 1.0f;
			bool doPlay = false;

			// Command line parsing
			var CommandLine = new Arguments(args);
			if(CommandLine["plugin"] != null) {
				pluginPath = CommandLine["plugin"];
			}
			if(CommandLine["wavein"] != null) {
				waveInputFilePath = CommandLine["wavein"];
			}
			if(CommandLine["waveout"] != null) {
				waveOutputFilePath = CommandLine["waveout"];
			}
			if(CommandLine["fxp"] != null) {
				fxpFilePath = CommandLine["fxp"];
			}
			if(CommandLine["volume"] != null) {
				float f = 1.0f;
				float.TryParse(CommandLine["volume"], NumberStyles.Number,CultureInfo.InvariantCulture, out f);
				volume = f;
			}
			if(CommandLine["play"] != null) {
				doPlay = true;
			}
			
			if ((pluginPath == "" || waveInputFilePath == "" || waveOutputFilePath == "")) {
				PrintUsage();
				return;
			}
			
			if (!File.Exists(pluginPath)) {
				Console.WriteLine("VST Plugin cannot be found! ({0})", pluginPath);
				Console.WriteLine("Processing Failed!");
				PrintUsage();
				return;
			}
			if (!File.Exists(waveInputFilePath)) {
				Console.WriteLine("Wave Input File cannot be found! ({0})", waveInputFilePath);
				Console.WriteLine("Processing Failed!");
				PrintUsage();
				return;
			}

			var processVSTPlugin = new ProcessVSTPlugin();
			if (!processVSTPlugin.Process(waveInputFilePath, waveOutputFilePath, pluginPath, fxpFilePath, volume, doPlay)) {
				Console.WriteLine("Processing Failed!");

				Console.WriteLine("");
				Console.Write("Press any key to continue . . . ");
				Console.ReadKey(true);
			}

			// clean up
			processVSTPlugin.Dispose();
			processVSTPlugin = null;
		}