/// <summary> /// Removed instances of one or more active instruments having the provided instrument name. /// How many active instances of the instrument are deactivated can be determined by the KillInstanceMode enumeration /// and whether release trails occur as the instrument is deactivated can be controlled by the allowRelease flag. /// Calls csoundKillInstance. /// </summary> /// <param name="instrName">name of instrument to deactivate</param> /// <param name="mode">controls which, if any, instances of instr to remove</param> /// <param name="allowRelease">if true, release phase of an instrument will still occur upon deactivation; if false, no release phase occurs</param> /// <returns></returns> public CsoundStatus DeactivateInstrumentInstance(string instrName, KillInstanceMode mode, bool allowRelease) { IntPtr pName = Marshal.StringToHGlobalAnsi(instrName); int result = NativeMethods.csoundKillInstance(Engine, -1, pName, (int)mode, (allowRelease ? 1 : 0)); Marshal.FreeHGlobal(pName); return(Int2StatusEnum(result)); }
/// <summary> /// Removes instances of one or more active instruments having the provided instrument number. /// How many active instances of the instrument are deactivated can be determined by the KillInstanceMode enumeration /// and whether release trails occur as the instrument is deactivated can be controlled by the allowRelease flag. /// Calls csoundKillInstance. /// </summary> /// <param name="instNbr">Number of the instrument to be released</param> /// <param name="mode">controls which, if any, instances of instNbr to remove (all, oldest, newest, etc)</param> /// <param name="allowRelease">if true, release phase of an instrument will still occur upon deactivation; if false, no release phase occurs</param> /// <returns></returns> public CsoundStatus DeactivateInstrumentInstance(double instNbr, KillInstanceMode mode, bool allowRelease) { return(Int2StatusEnum(NativeMethods.csoundKillInstance(Engine, instNbr, IntPtr.Zero, (int)mode, (allowRelease ? 1 : 0)))); }