libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmDspClass.h 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. #ifndef cmDspClass_h
  2. #define cmDspClass_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //( { file_desc:"'snap' unit processor interface." kw:[snap] }
  7. typedef unsigned cmDspRC_t;
  8. enum
  9. {
  10. kOkDspRC = cmOkRC, // 0
  11. kMemAllocFailDspRC, // 1
  12. kLHeapFailDspRC, // 2
  13. kJsonFailDspRC, // 3
  14. kFileSysFailDspRC, // 4
  15. kSymTblFailDspRC, // 5
  16. kThreadFailDspRC, // 6
  17. kNetFailDspRC, // 7
  18. kCsvFailDspRC, // 8
  19. kDspStoreFailDspRC,
  20. kProcFailDspRC,
  21. kAllocInstFailDspRC,
  22. kClassFinalFailDspRC,
  23. kInstFinalFailDspRC,
  24. kInstResetFailDspRC,
  25. kInstExecFailDspRC,
  26. kInstStoreFailDspRC,
  27. kInstRecallFailDspRC,
  28. kInstMsgRcvFailDspRC,
  29. kNetSendAllocFailDspRC,
  30. kClassNotFoundDspRC,
  31. kInstNotFoundDspRC,
  32. kDuplInstSymIdDspRC,
  33. kVarNotFoundDspRC,
  34. kSrcVarNotFoundDspRC,
  35. kRsrcNotFoundDspRC,
  36. kSymNotFoundDspRC,
  37. kNetNodeNotFoundDspRC,
  38. kDuplPresetInstDspRC,
  39. kDuplPresetVarDspRC,
  40. kPresetGrpNotFoundDspRC,
  41. kPresetPreNotFoundDspRC,
  42. kPresetInstNotFoundDspRC,
  43. kPresetVarNotFoundDspRC,
  44. kVarDuplicateDspRC,
  45. kVarTypeErrDspRC,
  46. kVarNotValidDspRC,
  47. kVarArgParseFailDspRC,
  48. kInstCbInstallFailDspRC,
  49. kConnectFailDspRC,
  50. kInstSetFlagsFailDspRC,
  51. kSerializeUiMsgFailDspRC,
  52. kSendToHostFailDspRC,
  53. kUiEleCreateFailDspRC,
  54. kInvalidArgDspRC,
  55. kInvalidStateDspRC,
  56. kSubSysFailDspRC,
  57. kFileWriteFailDspRC,
  58. kFileReadFailDspRC,
  59. kFileOpenFailDspRC,
  60. kFileCloseFailDspRC,
  61. kInvalidPgmIdxDspRC,
  62. kPgmCfgFailDspRC
  63. };
  64. struct cmDspClass_str;
  65. struct cmDspInst_str;
  66. enum
  67. {
  68. kUiDspFl = 0x01, // set in cmDspSysHandleUiMsg() to indicate that a msg originated from a UI control.
  69. kUiEchoDspFl = 0x02, // set in cmDspSysHandleUiMsg() to indicate that the value set from a UI control should sent back to it by the DSP engine.
  70. kDfltEvtDspFlags = 0
  71. };
  72. // DSP event record
  73. typedef struct
  74. {
  75. unsigned flags; // See kXXDspFl
  76. struct cmDspInst_str* srcInstPtr; // source instance of the event or NULL if the system generated the event
  77. unsigned srcVarId; // source selector id used to identify this event (See Note 1 below.)
  78. unsigned dstVarId; // dest. selector id used to identify the target of the event
  79. void* dstDataPtr; // dest. supplied custom callback data pointer
  80. const cmDspValue_t* valuePtr; // event message data
  81. } cmDspEvt_t;
  82. #define cmDspEvtCopy( e0, e1 ) (*(e0)) = (*(e1))
  83. // Note 1: When the event was generated from a UI msg then:
  84. // a. The kUiDspFl is set and the kUiEchoDspFl if the UI requested duplex operation.
  85. // b. srcVarId is set with the cmDspUiHdr_t selId value of the UI msg.
  86. typedef struct cmDspClass_str* (*cmDspClassConsFunc_t)(cmDspCtx_t* ctx);
  87. typedef cmDspRC_t (*cmDspClassFunc_t)( cmDspCtx_t* ctx, struct cmDspClass_str* classPtr );
  88. typedef struct cmDspInst_str* (*cmDspConsFunc_t)( cmDspCtx_t* ctx, struct cmDspClass_str* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl );
  89. typedef cmDspRC_t (*cmDspFunc_t)( cmDspCtx_t* ctx, struct cmDspInst_str* thisPtr, const cmDspEvt_t* evtPtr );
  90. typedef cmDspRC_t (*cmDspStoreFunc_t)( cmDspCtx_t* ctx, struct cmDspInst_str* thisPtr, bool Fl );
  91. typedef cmDspRC_t (*cmDspAttrSymFunc_t)(cmDspCtx_t* ctx, struct cmDspInst_str* thisPtr, unsigned attrSymId, const cmDspValue_t* value );
  92. // DSP class record
  93. typedef struct cmDspClass_str
  94. {
  95. cmErr_t err;
  96. const cmChar_t* labelStr;
  97. const cmChar_t* doc;
  98. cmDspClassFunc_t finalClassFunc; // finalize the class
  99. cmDspConsFunc_t allocFunc; // allocate an instance
  100. cmDspFunc_t freeFunc; // free an instance
  101. cmDspFunc_t resetFunc; //
  102. cmDspFunc_t execFunc; //
  103. cmDspFunc_t recvFunc; //
  104. cmDspStoreFunc_t storeFunc; // store the state of this instance
  105. cmDspAttrSymFunc_t sysRecvFunc; // attr/value recv function (see cmDspSysBroadcastValue()
  106. } cmDspClass_t;
  107. // record used to maintain an event target callback chain
  108. typedef struct cmDspInstCb_str
  109. {
  110. unsigned srcVarSymId; // src var symbol id
  111. struct cmDspInst_str* dstInstPtr; // target instance
  112. unsigned dstVarId; // target instance sel id
  113. void* dstDataPtr; // target instance custom data
  114. struct cmDspInstCb_str* linkPtr; // chain link
  115. } cmDspCb_t;
  116. // record used to maintain instance variables
  117. typedef struct
  118. {
  119. unsigned flags; // see xxxDsvFl in cmDspValue.h for possible flag values
  120. unsigned constId; // constant id provided by the instance
  121. unsigned symId; // symbol id assoc'd with this var's label
  122. cmDspValue_t value; // current value of this variable
  123. cmDspValue_t dflt; // default value for this variable
  124. cmDspCb_t* cbList; // event targets registered with this instance
  125. const cmChar_t* doc; // document string
  126. } cmDspVar_t;
  127. typedef struct
  128. {
  129. const char* label;
  130. unsigned constId;
  131. unsigned rn;
  132. unsigned cn;
  133. unsigned flags;
  134. const cmChar_t* doc;
  135. } cmDspVarArg_t;
  136. typedef struct cmDspInstSymId_str
  137. {
  138. unsigned symId; // set to cmInvalidId if the recd is not active
  139. struct cmDspInstSymId_str* link;
  140. } cmDspInstSymId_t;
  141. enum
  142. {
  143. kDisableExecInstFl = 0x01
  144. };
  145. typedef struct cmDspInst_str
  146. {
  147. struct cmDspClass_str* classPtr; // ptr to class for this instance
  148. unsigned symId; // optional unique instance label symbol id
  149. unsigned id; // id is unique among all insts
  150. unsigned flags; // See kXXXInstFl above
  151. cmDspVar_t* varArray; //
  152. unsigned varCnt; //
  153. cmDspFunc_t freeFunc; // free an instance
  154. cmDspFunc_t resetFunc; // reset a instance to its default values
  155. cmDspFunc_t execFunc; // DSP clock tick
  156. cmDspFunc_t recvFunc; // recv an event
  157. cmDspStoreFunc_t storeFunc; //
  158. cmDspAttrSymFunc_t sysRecvFunc;
  159. unsigned presetGroupSymId;//
  160. cmDspInstSymId_t* symIdList; //
  161. } cmDspInst_t;
  162. cmDspRC_t cmDspClassSetup(
  163. cmDspClass_t* classPtr, // class to setup
  164. cmDspCtx_t* ctx, //
  165. const cmChar_t* classLabel, //
  166. cmDspClassFunc_t finalClassFunc, // finalize the class
  167. cmDspConsFunc_t allocFunc, // allocate an instance
  168. cmDspFunc_t freeFunc, // free an instance
  169. cmDspFunc_t resetFunc,
  170. cmDspFunc_t execFunc,
  171. cmDspFunc_t recvFunc,
  172. cmDspStoreFunc_t storeFunc,
  173. cmDspAttrSymFunc_t sysRecvFunc,
  174. const cmChar_t* doc
  175. );
  176. void* cmDspInstAllocate(cmDspCtx_t* ctx, cmDspClass_t* classPtr, const cmDspVarArg_t* argV, unsigned instByteCnt, unsigned instSymId, unsigned instId, unsigned storeSymId, unsigned vargCnt, va_list vl );
  177. #define cmDspInstAlloc(T,ctx,classPtr,args,symId,id,storeSymId,vargCnt,vl) (T*)cmDspInstAllocate(ctx,classPtr,args,sizeof(T),symId,id,storeSymId,vargCnt,vl)
  178. void* cmDspInstAllocateV(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned instByteCnt, unsigned instSymId, unsigned instId, unsigned storeSymId, unsigned vargCnt, va_list vl0, ... );
  179. #define cmDspInstAllocV(T,ctx,classPtr,symId,id,storeSymId,va_cnt,vl, ... ) (T*)cmDspInstAllocateV(ctx,classPtr,sizeof(T),symId,id,storeSymId,va_cnt,vl, __VA_ARGS__ )
  180. bool cmDspInstHasAttrSym( cmDspInst_t* inst, unsigned attrSymId );
  181. cmDspRC_t cmDspInstRegisterAttrSym( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned attrSymId );
  182. cmDspRC_t cmDspInstRemoveAttrSym( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned attrSymId );
  183. cmDspRC_t cmDspClassErr( cmDspCtx_t* ctx, cmDspClass_t* classPtr, cmDspRC_t rc, const cmChar_t* fmt, ... );
  184. cmDspRC_t cmDspInstErr( cmDspCtx_t* ctx, cmDspInst_t* inst, cmDspRC_t rc, const cmChar_t* fmt, ... );
  185. // Helper functions for setting up enumerated cmDspVarArg_t records.
  186. void cmDspArgSetup( cmDspCtx_t* ctx, cmDspVarArg_t* arg, const cmChar_t* labelPrefix, unsigned labelId, unsigned constId, unsigned rn, unsigned cn, unsigned flags, const cmChar_t* docStr );
  187. unsigned cmDspArgCopy( cmDspVarArg_t* argArray, unsigned argN, unsigned dstIdx, const cmDspVarArg_t* s, unsigned sn );
  188. unsigned cmDspArgSetupN( cmDspCtx_t* ctx, cmDspVarArg_t* arg, unsigned argN, unsigned dstIdx, unsigned cnt, const cmChar_t* labelPrefix, unsigned baseConstId, unsigned rn, unsigned cn, unsigned flags, const cmChar_t* staticDocStr );
  189. void cmDspArgSetupNull( cmDspVarArg_t* arg );
  190. const cmChar_t* cmDspInstLabel( cmDspCtx_t* ctx, cmDspInst_t* inst );
  191. // Given and instance and a variable symbol id return a pointer to the variable.
  192. cmDspVar_t* cmDspVarSymbolToPtr( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varSymId, unsigned flags );
  193. // Given an instance and a var id return a pointer to the variable.
  194. const cmDspVar_t* cmDspVarIdToCPtr( const cmDspInst_t* inst, unsigned varId );
  195. cmDspVar_t* cmDspVarIdToPtr( cmDspInst_t* inst, unsigned varId );
  196. const cmChar_t* cmDspVarLabel( cmDspCtx_t* ctx, const cmDspInst_t* inst, unsigned varId );
  197. // Make callbacks for the specified instance var.
  198. cmDspRC_t cmDspOutputEvent( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  199. cmDspRC_t cmDspVarPresetWrite( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  200. cmDspRC_t cmDspVarPresetRead( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  201. cmDspRC_t cmDspVarPresetRdWr( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, bool storeFl );
  202. double cmDspSampleRate( cmDspCtx_t* ctx );
  203. unsigned cmDspSamplesPerCycle( cmDspCtx_t* ctx );
  204. // Query the type of a variable
  205. unsigned cmDspTypeFlags(const cmDspInst_t* inst, unsigned varId );
  206. bool cmDspIsBool( const cmDspInst_t* inst, unsigned varId );
  207. bool cmDspIsInt( const cmDspInst_t* inst, unsigned varId );
  208. bool cmDspIsUInt( const cmDspInst_t* inst, unsigned varId );
  209. bool cmDspIsDouble( const cmDspInst_t* inst, unsigned varId );
  210. bool cmDspIsStrz( const cmDspInst_t* inst, unsigned varId );
  211. bool cmDspIsSymbol( const cmDspInst_t* inst, unsigned varId );
  212. bool cmDspIsJson( const cmDspInst_t* inst, unsigned varId );
  213. // Get the value of an instance variable.
  214. bool cmDspBool( cmDspInst_t* inst, unsigned varId );
  215. int cmDspInt( cmDspInst_t* inst, unsigned varId );
  216. unsigned cmDspUInt( cmDspInst_t* inst, unsigned varId );
  217. double cmDspDouble( cmDspInst_t* inst, unsigned varId );
  218. cmSample_t cmDspSample( cmDspInst_t* inst, unsigned varId );
  219. cmReal_t cmDspReal( cmDspInst_t* inst, unsigned varId );
  220. void* cmDspPtr( cmDspInst_t* inst, unsigned varId );
  221. const cmChar_t* cmDspStrcz( cmDspInst_t* inst, unsigned varId );
  222. unsigned cmDspSymbol( cmDspInst_t* inst, unsigned varId );
  223. cmJsonNode_t* cmDspJson( cmDspInst_t* inst, unsigned varId );
  224. // Get the default value of an instance variable.
  225. bool cmDspDefaultBool( cmDspInst_t* inst, unsigned varId );
  226. int cmDspDefaultInt( cmDspInst_t* inst, unsigned varId );
  227. unsigned cmDspDefaultUInt( cmDspInst_t* inst, unsigned varId );
  228. double cmDspDefaultDouble( cmDspInst_t* inst, unsigned varId );
  229. cmSample_t cmDspDefaultSample( cmDspInst_t* inst, unsigned varId );
  230. cmReal_t cmDspDefaultReal( cmDspInst_t* inst, unsigned varId );
  231. const cmChar_t* cmDspDefaultStrcz( cmDspInst_t* inst, unsigned varId );
  232. unsigned cmDspDefaultSymbol( cmDspInst_t* inst, unsigned varId );
  233. cmJsonNode_t* cmDspDefaultJson( cmDspInst_t* inst, unsigned varId );
  234. // Possible values for cmDspSetXXX()
  235. enum
  236. {
  237. kUpdateUiDspFl = 0x00, //
  238. kNoUpdateUiDspFl = 0x01, // don't callback the UI
  239. kNoAllocDspFl = 0x02, // the caller is handling memory mgmt for the incoming value don't allocate space for it internally
  240. kSetDefaultDspFl = 0x04, // set the var default value rather than the current value
  241. kNoSendDspFl = 0x08 // do not transmit the value to connected objects
  242. };
  243. // Instance variable setter functions:
  244. //
  245. // All forms of the setter assign a value to of the specified instance variable and
  246. // then make the callbacks attached to the variable. Note that callbacks to the UI
  247. // can be prevented by setting the kNoUpdateUiDspFl in the call to cmDspSet<type>X().
  248. //
  249. //
  250. // All setters are implemented in terms of the cmDspValueSet()
  251. //
  252. // Convert the source value (svp) to the type of the target var (inst->varArray[varId])
  253. // and assign it to the var value. All the cmDspSetXXX() functions work in terms of this function.
  254. // See the kXXXDspFl flags above for possible 'flag' values.
  255. cmDspRC_t cmDspValueSet( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmDspValue_t* vp, unsigned flags );
  256. // Assign the default value to the current value (if the the specified variable has a valid default value).
  257. cmDspRC_t cmDspApplyDefault( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  258. // Apply the default value to the current value for all variables which has a valid default value.
  259. // This is
  260. cmDspRC_t cmDspApplyAllDefaults( cmDspCtx_t* ctx, cmDspInst_t* inst );
  261. // Set the default value of a variable.
  262. cmDspRC_t cmDspSetDefault( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmDspValue_t* valPtr );
  263. // Set the default variable of a variable to 'val'.
  264. // The call is ignored (and the default value is not set) if the default
  265. // value was previously set to a vaue which is not equal to 'nonInitVal'.
  266. cmDspRC_t cmDspSetDefaultBool( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, bool nonInitVal, bool val );
  267. cmDspRC_t cmDspSetDefaultInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int nonInitVal, int val );
  268. cmDspRC_t cmDspSetDefaultUInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned nonInitVal, unsigned val );
  269. cmDspRC_t cmDspSetDefaultDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double nonInitVal, double val );
  270. cmDspRC_t cmDspSetDefaultSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t nonInitVal, cmSample_t val );
  271. cmDspRC_t cmDspSetDefaultReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t nonInitVal, cmReal_t val );
  272. cmDspRC_t cmDspSetDefaultStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* nonInitVal, const cmChar_t* val );
  273. cmDspRC_t cmDspSetDefaultSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, /*unsigned cmInvalidId*/ unsigned val );
  274. cmDspRC_t cmDspSetDefaultJson( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t* nonInitVal, cmJsonNode_t* val );
  275. // Set the value of a variable and make any attached callbacks.
  276. // If the kUiDsvFl is set on the variable then the UI is also informed of the new value.
  277. // If the source ('val') type does not match the variable type then if possible the
  278. // source is converted to the dest (variable) type.
  279. // This function is implemented in terms of cmDspValueSet().
  280. cmDspRC_t cmDspSetBool( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, bool val );
  281. cmDspRC_t cmDspSetInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, int val );
  282. cmDspRC_t cmDspSetUInt( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val );
  283. cmDspRC_t cmDspSetDouble( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, double val );
  284. cmDspRC_t cmDspSetSample( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmSample_t val );
  285. cmDspRC_t cmDspSetReal( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmReal_t val );
  286. cmDspRC_t cmDspSetPtr( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, void* val );
  287. cmDspRC_t cmDspSetStrcz( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmChar_t* val );
  288. cmDspRC_t cmDspSetSymbol( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned val );
  289. cmDspRC_t cmDspSetJson( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, cmJsonNode_t* val );
  290. // Set the value of a variable to the *evt->valuePtr and make any attached callbacks.
  291. // If the kUiDsvFl is set and kNoUiEchoDspFl is not set in evt->flags then UI is informed of the new value.
  292. // If the source (*evt->valuePtr) type does not match the variable type then if possible the
  293. // source is converted to the dest (variable) type.
  294. // This function is implemented in terms of cmDspValueSet().
  295. cmDspRC_t cmDspSetEvent( cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt );
  296. // Same as cmDspSetEvent() but the event is automatically echoed to the UI.
  297. cmDspRC_t cmDspSetEventUi( cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt );
  298. // Same as cmDspSetEventUi() but change the event target variable to 'varId'.
  299. cmDspRC_t cmDspSetEventUiId( cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt, unsigned varId );
  300. // Get the row and col count of a matrix valued instance variable.
  301. unsigned cmDspVarRows( cmDspInst_t* inst, unsigned varId );
  302. unsigned cmDspVarCols( cmDspInst_t* inst, unsigned varId );
  303. // Audio buffer helper functions
  304. bool cmDspIsAudioInputConnected( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  305. cmDspRC_t cmDspZeroAudioBuf( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId );
  306. cmSample_t* cmDspAudioBuf( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned chIdx );
  307. unsigned cmDspAudioBufSmpCount( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, unsigned chIdx );
  308. // Register dspInstPtr to receive a callback when srcInstPtr generates an event identified by srcVarId.
  309. cmDspRC_t cmDspInstInstallCb( cmDspCtx_t* ctx, cmDspInst_t* srcInstPtr, unsigned srcVarId, cmDspInst_t* dstInstPtr, unsigned dstVarSymId, void* dstCbDataPtr);
  310. cmDspRC_t cmDspInstallCb( cmDspCtx_t* ctx, cmDspInst_t* srcInstPtr, const cmChar_t* srcVarLabel, cmDspInst_t* dstInstPtr, const cmChar_t* dstVarLabel, void* dstCbDataPtr);
  311. // Uninstall a previous registred instance variable callback function.
  312. cmDspRC_t cmDspInstRemoveCb( cmDspCtx_t* ctx, cmDspInst_t* srcInstPtr, unsigned srcVarId, cmDspInst_t* dstInstPtr, unsigned dstVarId );
  313. cmDspRC_t cmDspRemoveCb( cmDspCtx_t* ctx, cmDspInst_t* srcInstPtr, const cmChar_t* srcVarLabel, cmDspInst_t* dstInstPtr, unsigned dstVarId );
  314. //
  315. cmDspRC_t cmDspInstVarSetFlags( cmDspCtx_t* ctx, cmDspInst_t* instPtr, unsigned varId, unsigned flags );
  316. // Used to transmit messages to the audio system.
  317. cmDspRC_t cmDspSendValueToAudioSys( cmDspCtx_t* ctx, unsigned msgTypeId, unsigned selId, unsigned valId, const cmDspValue_t* valPtr );
  318. // Notify the system that the program is done and can be shutdown
  319. cmDspRC_t cmDspProgramIsDone( cmDspCtx_t* ctx );
  320. // The following functions are used to send message to the UI and are
  321. // implemented in cmDspUi.c. They are declared here because they are
  322. // visible to the cmDspInst functions which use them but are not available
  323. // to the host UI. The other values defined and declared in cmDspUi.h are
  324. // common to both the host UI and the DSP instances.
  325. cmDspRC_t cmDspUiConsolePrint( cmDspCtx_t* ctx, cmChar_t* text );
  326. cmDspRC_t cmDspUiSendValue( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned varId, const cmDspValue_t* valPtr );
  327. cmDspRC_t cmDspUiSendVar( cmDspCtx_t* ctx, cmDspInst_t* inst, cmDspVar_t* var );
  328. cmDspRC_t cmDspUiScalarCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned minVarId, unsigned maxVarId, unsigned stpVarId, unsigned valVarId, unsigned lblVarId );
  329. cmDspRC_t cmDspUiTextCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned valVarId, unsigned lblVarId );
  330. cmDspRC_t cmDspUiMeterCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId, unsigned maxVarId, unsigned valVarId, unsigned lblVarId );
  331. cmDspRC_t cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
  332. cmDspRC_t cmDspUiLabelCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId, unsigned alignVarId );
  333. cmDspRC_t cmDspUiTimeLineCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId, unsigned audPathVarId, unsigned selVarId, unsigned measVarId, unsigned cursVarId );
  334. cmDspRC_t cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx, unsigned kMeasScId );
  335. cmDspRC_t cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId );
  336. cmDspRC_t cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId, unsigned refreshVarId, unsigned selVarId );
  337. cmDspRC_t cmDspUi2dCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId, unsigned yVarId, unsigned radiusVarId, unsigned angleVarId);
  338. cmDspRC_t cmDspUiNewColumn( cmDspCtx_t* ctx, unsigned colW );
  339. cmDspRC_t cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );
  340. cmDspRC_t cmDspUiNewPage( cmDspCtx_t* ctx, const cmChar_t* title );
  341. enum { kFnameFnDspFl=0x00, kFnameDirDspFl=0x01 };
  342. cmDspRC_t cmDspUiFnameCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned valVarId, unsigned patVarId, unsigned dirVarId );
  343. cmDspRC_t cmDspUiMsgListCreate(cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned height, unsigned listVarId, unsigned selVarId );
  344. //)
  345. #ifdef __cplusplus
  346. }
  347. #endif
  348. #endif