/// <summary> /// Asynchronous version of tableCopyOut() /// </summary> public void tableCopyOutAsync(int table, out MYFLT[] dest) { int len = Csound6.NativeMethods.csoundTableLength(csound, table); dest = new MYFLT[len]; IntPtr des = Marshal.AllocHGlobal(sizeof(MYFLT) * dest.Length); Csound6.NativeMethods.csoundTableCopyOutAsync(csound, table, des); Marshal.Copy(des, dest, 0, len); Marshal.FreeHGlobal(des); }
/// <summary> /// Stores the arguments used to generate function table 'tableNum' in args, and returns the number of arguments used. /// If the table does not exist, args is set to NULL and -1 is returned. /// NB: the argument list starts with the GEN number and is followed by its parameters. eg. f 1 0 1024 10 1 0.5 yields the list {10.0,1.0,0.5} /// </summary> public int getTableArgs(out MYFLT[] args, int index) { IntPtr addr = new IntPtr(); int len = Csound6.NativeMethods.csoundGetTableArgs(csound, out addr, index); args = new MYFLT[len]; if (len != -1) { Marshal.Copy(addr, args, 0, len); } else { args = null; } Marshal.FreeHGlobal(addr); return(len); }
/// <summary> /// Stores values to function table 'tableNum' in tableValues, and returns the table length (not including the guard point). /// If the table does not exist, tableValues is set to NULL and -1 is returned. /// </summary> public int getTable(out MYFLT[] tableValues, int numTable) { int len = Csound6.NativeMethods.csoundTableLength(csound, numTable); IntPtr tablePtr = new IntPtr(); tableValues = new MYFLT[len]; int res = Csound6.NativeMethods.csoundGetTable(csound, out tablePtr, numTable); if (res != -1) { Marshal.Copy(tablePtr, tableValues, 0, len); } else { tableValues = null; } Marshal.FreeHGlobal(tablePtr); return(res); }
/** * Sets the value of a slot in a function table. The table number and index are assumed to be valid. */ public void setTable(int table, int index, MYFLT value) { csound.setTable(table, index, value); }
internal static extern void csoundTableSet([In] IntPtr csound, [In] Int32 table, [In] Int32 index, [In] MYFLT value);
/// <summary> /// Sets the value of a slot in a function table. The table number and index are assumed to be valid. /// </summary> public void setTable(int table, int index, MYFLT value) { Csound6.NativeMethods.csoundTableSet(csound, table, index, value); }