![]() |
CsoundUnity 3.4.0
https://github.com/rorywalsh/CsoundUnity
|
Classes | |
class | ChannelHints |
This structure holds the parameter hints for control channels. More... | |
class | ChannelInfo |
class | CSOUND_PARAMS |
class | OpcodeArgumentTypes |
Defines a class to hold out and in types, and flags More... | |
Public Types | |
enum | ChannelBehavior { None = 0 , Integer = 1 , Linear = 2 , Exponential = 3 } |
enum | ChannelType { None = 0 , Control = 1 , Audio = 2 , String = 3 , Pvs = 4 , Var = 5 } |
enum | ChannelDirection { Input = 1 , Output = 2 } |
Public Member Functions | |
CsoundUnityBridge (string csdFile, List< EnvironmentSettings > environmentSettings) | |
The CsoundUnityBridge constructor sets up the Csound Global Environment Variables set by the user. Then it creates an instance of Csound and compiles the full csdFile passed as a string. Then it starts Csound. More... | |
int | LoadPlugins (string dir) |
int | GetVersion () |
int | GetAPIVersion () |
void | StopCsound () |
void | OnApplicationQuit () |
void | Cleanup () |
void | Reset () |
bool | CompiledWithoutError () |
int | CompileOrc (string orchStr) |
int | PerformKsmps () |
MYFLT | Get0dbfs () |
long | GetCurrentTimeSamples () |
void | SendScoreEvent (string scoreEvent) |
void | RewindScore () |
void | CsoundSetScoreOffsetSeconds (MYFLT value) |
void | SetChannel (string channel, MYFLT value) |
void | SetStringChannel (string channel, string value) |
void | SetAudioChannel (string name, MYFLT[] audio) |
MYFLT[] | GetAudioChannel (string name) |
int | TableLength (int table) |
Returns the length of a function table (not including the guard point), or -1 if the table does not exist. More... | |
MYFLT | GetTable (int table, int index) |
Returns the value of a slot in a function table. The table number and index are assumed to be valid. More... | |
void | SetTable (int table, int index, MYFLT value) |
Sets the value of a slot in a function table. The table number and index are assumed to be valid. More... | |
void | TableCopyOut (int table, out MYFLT[] dest) |
Copy the contents of a function table into a supplied array dest The table number is assumed to be valid, and the destination needs to have sufficient space to receive all the function table contents. More... | |
void | TableCopyOutAsync (int table, out MYFLT[] dest) |
Asynchronous version of tableCopyOut() More... | |
void | TableCopyIn (int table, MYFLT[] source) |
Copy the contents of an array source into a given function table The table number is assumed to be valid, and the table needs to have sufficient space to receive all the array contents. More... | |
void | TableCopyInAsync (int table, MYFLT[] source) |
Asynchronous version of csoundTableCopyIn() More... | |
int | GetTable (out MYFLT[] tableValues, int numTable) |
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. More... | |
int | GetTableArgs (out MYFLT[] args, int index) |
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} More... | |
int | IsNamedGEN (int num) |
Checks if a given GEN number num is a named GEN if so, it returns the string length (excluding terminating NULL char) Otherwise it returns 0. More... | |
void | GetNamedGEN (int num, out string name, int len) |
Gets the GEN name from a number num, if this is a named GEN The final parameter is the max len of the string (excluding termination) More... | |
IDictionary< string, int > | GetNamedGens () |
Returns a Dictionary keyed by the names of all named table generators. Each name is paired with its internal function number. More... | |
MYFLT | GetSr () |
MYFLT | GetKr () |
uint | GetKsmps () |
MYFLT | GetSpoutSample (int frame, int channel) |
Get a sample from Csound's audio output buffer More... | |
void | AddSpinSample (int frame, int channel, MYFLT sample) |
void | SetSpinSample (int frame, int channel, MYFLT sample) |
Set a sample from Csound's audio output buffer More... | |
void | ClearSpin () |
Clears the input buffer (spin). More... | |
MYFLT[] | GetSpin () |
Returns the Csound audio input working buffer (spin) as a MYFLT array. Enables external software to write audio into Csound before calling csoundPerformKsmps. More... | |
MYFLT[] | GetSpout () |
Returns the Csound audio output working buffer (spout) as a MYFLT array. Enables external software to read audio from Csound after calling csoundPerformKsmps. More... | |
MYFLT | GetChannel (string channel) |
Get a a control channel More... | |
uint | GetNchnlsInput () |
Get number of input channels More... | |
uint | GetNchnls () |
Get number of input channels More... | |
int | GetCsoundMessageCount () |
string | GetCsoundMessage () |
IDictionary< string, IList< OpcodeArgumentTypes > > | GetOpcodeList () |
Returns a sorted Dictionary keyed by all opcodes which are active in the current instance of csound. The values contain argument strings representing signatures for an opcode's output and input parameters. The argument strings pairs are stored in a list to accomodate opcodes with multiple signatures. More... | |
IDictionary< string, ChannelInfo > | GetChannelList () |
Provides a dictionary of all currently defined channels resulting from compilation of an orchestra containing channel definitions. Entries, keyed by name, are polymorphically assigned to their correct data type: control, audio, string, pvc. Used by the Csound6SoftwareBus class to initialize its contents. More... | |
CSOUND_PARAMS | GetParams () |
Fills in a provided raw CSOUND_PARAMS object with csounds current parameter settings. This method is used internally to manage this class and is not expected to be used directly by a host program. More... | |
void | SetParams (CSOUND_PARAMS parms) |
Transfers the contents of the provided raw CSOUND_PARAMS object into csound's internal data structues (chiefly its OPARMS structure). This method is used internally to manage this class and is not expected to be used directly by a host program. Most values are used and reflected in CSOUND_PARAMS. Internally to csound, as of release 6.0.0, Heartbeat and IsComputingOpcodeWeights are ignored and IsUsingCsdLineCounts can only be set and never reset once set. More... | |
string | GetEnv (string key) |
Gets a string value from csound's environment values. Meaningful values include the contents of Windows' OS environment values such as SFDIR or SADIR for path name defaults. More... | |
int | SetGlobalEnv (string name, string value) |
Set the global value of environment variable 'name' to 'value', or delete variable if 'value' is NULL. It is not safe to call this function while any Csound instances are active. See https://csound.com/docs/manual/CommandEnvironment.html for a list of the variables that can be used. More... | |
Static Public Member Functions | |
static string | GetMessageText (IntPtr message) |
Public Attributes | |
IntPtr | csound |
Definition at line 42 of file CsoundUnityBridge.cs.
Enumerator | |
---|---|
None | |
Integer | |
Linear | |
Exponential |
Definition at line 789 of file CsoundUnityBridge.cs.
Enumerator | |
---|---|
Input | |
Output |
Definition at line 811 of file CsoundUnityBridge.cs.
Enumerator | |
---|---|
None | |
Control | |
Audio | |
String | |
Pvs | |
Var |
Definition at line 800 of file CsoundUnityBridge.cs.
CsoundUnityBridge.CsoundUnityBridge | ( | string | csdFile, |
List< EnvironmentSettings > | environmentSettings | ||
) |
The CsoundUnityBridge constructor sets up the Csound Global Environment Variables set by the user. Then it creates an instance of Csound and compiles the full csdFile passed as a string. Then it starts Csound.
csdFile | The Csound (.csd) file content as a string |
environmentSettings | A list of the Csound Environments settings defined by the user |
Definition at line 115 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.AddSpinSample | ( | int | frame, |
int | channel, | ||
MYFLT | sample | ||
) |
Definition at line 471 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.Cleanup | ( | ) |
Definition at line 191 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.ClearSpin | ( | ) |
Clears the input buffer (spin).
Definition at line 487 of file CsoundUnityBridge.cs.
bool CsoundUnityBridge.CompiledWithoutError | ( | ) |
Definition at line 201 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.CompileOrc | ( | string | orchStr | ) |
Definition at line 206 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.CsoundSetScoreOffsetSeconds | ( | MYFLT | value | ) |
Definition at line 236 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.Get0dbfs | ( | ) |
Definition at line 216 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.GetAPIVersion | ( | ) |
Definition at line 173 of file CsoundUnityBridge.cs.
MYFLT[] CsoundUnityBridge.GetAudioChannel | ( | string | name | ) |
Definition at line 260 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.GetChannel | ( | string | channel | ) |
Get a a control channel
Definition at line 523 of file CsoundUnityBridge.cs.
IDictionary< string, ChannelInfo > CsoundUnityBridge.GetChannelList | ( | ) |
Provides a dictionary of all currently defined channels resulting from compilation of an orchestra containing channel definitions. Entries, keyed by name, are polymorphically assigned to their correct data type: control, audio, string, pvc. Used by the Csound6SoftwareBus class to initialize its contents.
Definition at line 609 of file CsoundUnityBridge.cs.
string CsoundUnityBridge.GetCsoundMessage | ( | ) |
Definition at line 549 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.GetCsoundMessageCount | ( | ) |
Definition at line 544 of file CsoundUnityBridge.cs.
long CsoundUnityBridge.GetCurrentTimeSamples | ( | ) |
Definition at line 221 of file CsoundUnityBridge.cs.
string CsoundUnityBridge.GetEnv | ( | string | key | ) |
Gets a string value from csound's environment values. Meaningful values include the contents of Windows' OS environment values such as SFDIR or SADIR for path name defaults.
key | the name of the Environment Variable to get |
Definition at line 866 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.GetKr | ( | ) |
Definition at line 453 of file CsoundUnityBridge.cs.
uint CsoundUnityBridge.GetKsmps | ( | ) |
Definition at line 458 of file CsoundUnityBridge.cs.
|
static |
Definition at line 556 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.GetNamedGEN | ( | int | num, |
out string | name, | ||
int | len | ||
) |
Gets the GEN name from a number num, if this is a named GEN The final parameter is the max len of the string (excluding termination)
Definition at line 414 of file CsoundUnityBridge.cs.
IDictionary< string, int > CsoundUnityBridge.GetNamedGens | ( | ) |
Returns a Dictionary keyed by the names of all named table generators. Each name is paired with its internal function number.
Definition at line 435 of file CsoundUnityBridge.cs.
uint CsoundUnityBridge.GetNchnls | ( | ) |
Get number of input channels
Definition at line 539 of file CsoundUnityBridge.cs.
uint CsoundUnityBridge.GetNchnlsInput | ( | ) |
Get number of input channels
Definition at line 531 of file CsoundUnityBridge.cs.
IDictionary< string, IList< OpcodeArgumentTypes > > CsoundUnityBridge.GetOpcodeList | ( | ) |
Returns a sorted Dictionary keyed by all opcodes which are active in the current instance of csound. The values contain argument strings representing signatures for an opcode's output and input parameters. The argument strings pairs are stored in a list to accomodate opcodes with multiple signatures.
Definition at line 568 of file CsoundUnityBridge.cs.
CSOUND_PARAMS CsoundUnityBridge.GetParams | ( | ) |
Fills in a provided raw CSOUND_PARAMS object with csounds current parameter settings. This method is used internally to manage this class and is not expected to be used directly by a host program.
oparms | a CSOUND_PARAMS structure to be filled in by csound |
Definition at line 647 of file CsoundUnityBridge.cs.
MYFLT[] CsoundUnityBridge.GetSpin | ( | ) |
Returns the Csound audio input working buffer (spin) as a MYFLT array. Enables external software to write audio into Csound before calling csoundPerformKsmps.
Definition at line 497 of file CsoundUnityBridge.cs.
MYFLT[] CsoundUnityBridge.GetSpout | ( | ) |
Returns the Csound audio output working buffer (spout) as a MYFLT array. Enables external software to read audio from Csound after calling csoundPerformKsmps.
Definition at line 511 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.GetSpoutSample | ( | int | frame, |
int | channel | ||
) |
Get a sample from Csound's audio output buffer
Definition at line 466 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.GetSr | ( | ) |
Definition at line 448 of file CsoundUnityBridge.cs.
MYFLT CsoundUnityBridge.GetTable | ( | int | table, |
int | index | ||
) |
Returns the value of a slot in a function table. The table number and index are assumed to be valid.
Definition at line 282 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.GetTable | ( | out MYFLT[] | tableValues, |
int | numTable | ||
) |
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.
Definition at line 364 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.GetTableArgs | ( | out MYFLT[] | args, |
int | index | ||
) |
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}
Definition at line 389 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.GetVersion | ( | ) |
Definition at line 168 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.IsNamedGEN | ( | int | num | ) |
Checks if a given GEN number num is a named GEN if so, it returns the string length (excluding terminating NULL char) Otherwise it returns 0.
Definition at line 405 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.LoadPlugins | ( | string | dir | ) |
Definition at line 162 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.OnApplicationQuit | ( | ) |
Definition at line 183 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.PerformKsmps | ( | ) |
Definition at line 211 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.Reset | ( | ) |
Definition at line 196 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.RewindScore | ( | ) |
Definition at line 231 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SendScoreEvent | ( | string | scoreEvent | ) |
Definition at line 226 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetAudioChannel | ( | string | name, |
MYFLT[] | audio | ||
) |
Definition at line 251 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetChannel | ( | string | channel, |
MYFLT | value | ||
) |
Definition at line 241 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.SetGlobalEnv | ( | string | name, |
string | value | ||
) |
Set the global value of environment variable 'name' to 'value', or delete variable if 'value' is NULL. It is not safe to call this function while any Csound instances are active. See https://csound.com/docs/manual/CommandEnvironment.html for a list of the variables that can be used.
name | The name of the environment variable to set |
value | The value to set, ie a path |
Definition at line 879 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetParams | ( | CSOUND_PARAMS | parms | ) |
Transfers the contents of the provided raw CSOUND_PARAMS object into csound's internal data structues (chiefly its OPARMS structure). This method is used internally to manage this class and is not expected to be used directly by a host program. Most values are used and reflected in CSOUND_PARAMS. Internally to csound, as of release 6.0.0, Heartbeat and IsComputingOpcodeWeights are ignored and IsUsingCsdLineCounts can only be set and never reset once set.
parms | a |
Definition at line 663 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetSpinSample | ( | int | frame, |
int | channel, | ||
MYFLT | sample | ||
) |
Set a sample from Csound's audio output buffer
Definition at line 479 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetStringChannel | ( | string | channel, |
string | value | ||
) |
Definition at line 246 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.SetTable | ( | int | table, |
int | index, | ||
MYFLT | value | ||
) |
Sets the value of a slot in a function table. The table number and index are assumed to be valid.
Definition at line 290 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.StopCsound | ( | ) |
Definition at line 178 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.TableCopyIn | ( | int | table, |
MYFLT[] | source | ||
) |
Copy the contents of an array source into a given function table The table number is assumed to be valid, and the table needs to have sufficient space to receive all the array contents.
Definition at line 337 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.TableCopyInAsync | ( | int | table, |
MYFLT[] | source | ||
) |
Asynchronous version of csoundTableCopyIn()
Definition at line 350 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.TableCopyOut | ( | int | table, |
out MYFLT[] | dest | ||
) |
Copy the contents of a function table into a supplied array dest The table number is assumed to be valid, and the destination needs to have sufficient space to receive all the function table contents.
Definition at line 298 of file CsoundUnityBridge.cs.
void CsoundUnityBridge.TableCopyOutAsync | ( | int | table, |
out MYFLT[] | dest | ||
) |
Asynchronous version of tableCopyOut()
Definition at line 317 of file CsoundUnityBridge.cs.
int CsoundUnityBridge.TableLength | ( | int | table | ) |
Returns the length of a function table (not including the guard point), or -1 if the table does not exist.
Definition at line 274 of file CsoundUnityBridge.cs.
IntPtr CsoundUnityBridge.csound |
Definition at line 44 of file CsoundUnityBridge.cs.