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

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