libcm is a C development framework with an emphasis on audio signal processing applications.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

cmDevCfg.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef cmDevCfg_h
  2. #define cmDevCfg_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*
  7. IMPLEMENTATION:
  8. 1) A 'cfg' record is a device reference with a 'cfg label'.
  9. There are three kinds of cfg records MIDI,Audio,Net.
  10. The device record identifies a particlar device
  11. end-point or pre-configured setup. The 'cfg label'
  12. associated with this setup allows an application
  13. to refer to the setup by name. This releives the
  14. application from having to handle the details of
  15. forming, storing, and maintaining device configurations.
  16. 2) A 'map' record is a record which links an
  17. application and reference id to a cfg record.
  18. The goal of this is to allow applications to refer to
  19. pre-configured device setups by name and then to
  20. associate a numeric id with this setup.
  21. The application can then send data to the device using
  22. only the numeric id. Likewise data arriving from the
  23. device to the application is tagged with
  24. id of the of the device.
  25. NOTES:
  26. 1) usrAppId's must be unique among all app.s'.
  27. 2) usrDevId's must be unique among all usrDevId's for particular app.
  28. In other words the same 'usrDevId' may not be used by devices
  29. of different types.
  30. 3) The usrAppId's and usrDevIds' are used internally as index
  31. locations. They should therefore be low numbers and
  32. densely packed.
  33. */
  34. struct cmAudioSysArgs_t;
  35. enum
  36. {
  37. kOkDcRC = cmOkRC,
  38. cmLabelNotFoundDcRC,
  39. cmIdNotFoundDcRC,
  40. kInvalidDevArgDcRC
  41. };
  42. typedef enum
  43. {
  44. kInvalidDcmTId,
  45. kMidiDcmTId,
  46. kAudioDcmTId,
  47. kNetDcmTId
  48. } cmTypeDcmId_t;
  49. typedef cmRC_t cmDcRC_t;
  50. typedef cmHandle_t cmDevCfgH_t;
  51. extern cmDevCfgH_t cmDevCfgNullHandle;
  52. cmDcRC_t cmDevCfgMgrAlloc( cmCtx_t* c, cmDevCfgH_t* hp, cmJsonH_t jsH );
  53. cmDcRC_t cmDevCfgMgrFree( cmDevCfgH_t* hp );
  54. cmDcRC_t cmDevCfgIsValid( cmDevCfgH_t h );
  55. // Delete a cfg record created by cmDevCfgNameMidiPort(), cmDevCfgNameAudioPort(), etc.
  56. cmDcRC_t cmDevCfgDeleteCfg( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar_t* dcLabelStr );
  57. // Create a map record to associate a app/dev id with a cfg. record.
  58. // Note that multiple app/dev id's may be assoc'd with the same cfg. record.
  59. cmDcRC_t cmDevCfgCreateMap( cmDevCfgH_t h, cmTypeDcmId_t typeId, const cmChar_t* dcLabelStr, unsigned usrAppId, unsigned usrDevId );
  60. // Delete a map record created by cmDevCfgCreateMap().
  61. cmDcRC_t cmDevCfgDeleteMap( cmDevCfgH_t h, cmTypeDcmId_t typeId, unsigned usrAppId, unsigned usrDevId );
  62. // Create a MIDI cfg. record.
  63. cmDcRC_t cmDevCfgNameMidiPort(
  64. cmDevCfgH_t h,
  65. const cmChar_t* dcLabelStr,
  66. const cmChar_t* devNameStr,
  67. const cmChar_t* portNameStr,
  68. bool inputFl );
  69. cmDcRC_t cmDevCfgMidiDevIdx( cmDevCfgH_t h, unsigned usrAppId, unsigned usrDevId, unsigned* midiDevIdxRef, unsigned* midiPortIdxRef );
  70. cmDcRC_t cmDevCfgNameAudioPort(
  71. cmDevCfgH_t h,
  72. const cmChar_t* dcLabelStr,
  73. const cmChar_t* inDevNameStr,
  74. const cmChar_t* outDevNameStr,
  75. bool syncInputFl,
  76. unsigned msgQueueByteCnt,
  77. unsigned devFramesPerCycle,
  78. unsigned dspFramesPerCycle,
  79. unsigned audioBufCnt,
  80. double srate );
  81. const struct cmAudioSysArgs_str* cmDevCfgAudioSysArgs( cmDevCfgH_t h, unsigned usrAppId, unsigned usrDevId );
  82. cmDcRC_t cmDevCfgNetPort(
  83. cmDevCfgH_t h,
  84. const cmChar_t* dcLabelStr,
  85. const cmChar_t* sockAddr,
  86. unsigned portNumber );
  87. unsigned cmDevCfgNetNodeId( cmDevCfgH_t h, unsigned usrAppId, unsigned usrDevId );
  88. // Preset Management Functions:
  89. // Store and recall groups cfg records.
  90. unsigned cmDevCfgPresetCount( cmDevCfgH_t h );
  91. const cmChar_t* cmDevCfgPresetLabel( cmDevCfgH_t h, unsigned presetIdx );
  92. cmDcRC_t cmDevCfgStore( cmDevCfgH_t h, const cmChar_t* presetLabelStr );
  93. cmDcRC_t cmDevCfgRecall( cmDevCfgH_t h, const cmChar_t* presetLabelStr );
  94. cmDcRC_t cmDevCfgDelete( cmDevCfgH_t h, const cmChar_t* presetLabelStr );
  95. cmDcRC_t cmDevCfgWrite( cmDevCfgH_t h );
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif