/// <summary> /// Runs the represented utility as a separate threaded process using the Name property and GetUtilityArgs method. /// </summary> /// <param name="logger">handler to receive stdout as emitted by utility</param> /// <param name="cancel">token for cancelling utility before done (can be CancellationToken.None, or given timeout)</param> /// <returns></returns> public async Task <int> RunAsync(Csound6MessageEventHandler logger, CancellationToken cancel) { var process = new CsoundExternalProcess(Name, GetUtilityArgs()); if (logger != null) { process.MessageCallback += logger; } long done = await process.RunAsync(cancel); return((int)done); }
/// <summary> /// Creates a Csound instance using the provided arguments, host data object and init flag settings. /// It only needs to be called directly if one must supply a custom hostdata object upon csound's /// construction or setting an InitFlag other than "None". This is atypical. /// </summary> /// <remarks> /// This is the complete constructor which must ultimately be referenced by all other constructors. /// This is the only access to Initialize() and Create() and Destroy() the underlying CSOUND* object /// thereby keeping this C# class synchronized with its csound instance. /// <para> /// An optional message event handler can be supplied in the constructor if initizations should be captured /// </para> /// </remarks> /// <param name="hostdata">any user data object holding data useful during processing</param> /// <param name="initFlag">any of the CsoundInitFlags with CsoundInitFlags.NoFlags being the most typical</param> /// <param name="logger">null or logger if capturing messaging from Initialize() and Create is wanted</param> public Csound6NetRealtime(object data, CsoundInitFlag flags, Csound6MessageEventHandler logger) : base(data, flags, logger) { }
/// <summary> /// Alternate logger, perhaps from a non-console host, where only the logger need be indicated /// upon startup in order to capture all text from csound including Initialize() and Create() /// </summary> /// <param name="logger">an event handler to receive messages form csound</param> public Csound6NetRealtime(Csound6MessageEventHandler logger) : this(null, c_defaultInitFlags, logger) { }
/// <summary> /// /// </summary> /// <param name="argv"></param> /// <param name="inFile"></param> /// <param name="outFile"></param> /// <param name="hostdata"></param> /// <param name="flags"></param> public Cscore6(FileInfo inFile, FileInfo outFile, object hostdata, CsoundInitFlag flags, Csound6MessageEventHandler logger) : base(hostdata, flags, logger) { InitializeCscore(inFile, outFile); }