libcm is a C development framework with an emphasis on audio signal processing applications.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

cmDspPgmKr.c 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #include "cmPrefix.h"
  2. #include "cmGlobal.h"
  3. #include "cmFloatTypes.h"
  4. #include "cmRpt.h"
  5. #include "cmErr.h"
  6. #include "cmCtx.h"
  7. #include "cmMem.h"
  8. #include "cmMallocDebug.h"
  9. #include "cmLinkedHeap.h"
  10. #include "cmText.h"
  11. #include "cmFileSys.h"
  12. #include "cmSymTbl.h"
  13. #include "cmJson.h"
  14. #include "cmPrefs.h"
  15. #include "cmDspValue.h"
  16. #include "cmMsgProtocol.h"
  17. #include "cmThread.h"
  18. #include "cmUdpPort.h"
  19. #include "cmUdpNet.h"
  20. #include "cmAudioSys.h"
  21. #include "cmProcObj.h"
  22. #include "cmDspCtx.h"
  23. #include "cmDspClass.h"
  24. #include "cmDspSys.h"
  25. #include "cmDspPgm.h"
  26. #include "cmAudioFile.h"
  27. #include "cmProcObj.h"
  28. #include "cmProc.h"
  29. #include "cmProc3.h"
  30. #include "cmVectOpsTemplateMain.h"
  31. #include "cmVectOps.h"
  32. cmDspRC_t _cmDspSysPgm_TimeLine(cmDspSysH_t h, void** userPtrPtr )
  33. {
  34. cmDspRC_t rc = kOkDspRC;
  35. const cmChar_t* tlFn = "/home/kevin/src/cmgv/src/gv/data/tl7.js";
  36. const cmChar_t* audPath = "/home/kevin/media/audio/20110723-Kriesberg/Audio Files";
  37. const cmChar_t* scFn = "/home/kevin/src/cmgv/src/gv/data/mod2b.txt";
  38. unsigned wtLoopCnt = 1; // play once (do not loop)
  39. unsigned wtInitMode = 0; // initial wt mode is 'silence'
  40. unsigned wtSmpCnt = floor(cmDspSysSampleRate(h)); // wt length == srate
  41. cmDspInst_t* tlp = cmDspSysAllocInst(h,"TimeLine", "tl", 2, tlFn, audPath );
  42. cmDspInst_t* scp = cmDspSysAllocInst(h,"Score", "sc", 1, scFn );
  43. cmDspInst_t* php = cmDspSysAllocInst(h,"Phasor", NULL, 0 );
  44. cmDspInst_t* wtp = cmDspSysAllocInst(h,"WaveTable", NULL, 4, wtSmpCnt, wtInitMode, NULL, wtLoopCnt );
  45. cmDspInst_t* pts = cmDspSysAllocInst(h,"PortToSym", NULL, 2, "on", "off" );
  46. cmDspInst_t* mfp = cmDspSysAllocInst(h,"MidiFilePlay",NULL, 0 );
  47. cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 1, scFn );
  48. cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut", NULL, 1, 0 );
  49. cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut", NULL, 1, 1 );
  50. cmDspSysNewPage(h,"Controls");
  51. cmDspInst_t* onb = cmDspSysAllocInst(h,"Button", "start", 2, kButtonDuiId, 1.0 );
  52. cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop", 2, kButtonDuiId, 1.0 );
  53. cmDspInst_t* prp = cmDspSysAllocInst(h,"Printer", NULL, 1, ">" );
  54. if((rc = cmDspSysLastRC(h)) != kOkDspRC )
  55. return rc;
  56. // phasor->wt->aout
  57. cmDspSysConnectAudio(h, php, "out", wtp, "phs" ); // phs -> wt
  58. cmDspSysConnectAudio(h, wtp, "out", ao0p, "in" ); // wt -> aout0
  59. cmDspSysConnectAudio(h, wtp, "out", ao1p, "in" ); // wt -> aout1
  60. cmDspSysInstallCb( h, wtp, "fidx",tlp, "curs", NULL);
  61. //cmDspSysInstallCb( h, wtp, "fidx",prp, "in", NULL );
  62. // start connections
  63. cmDspSysInstallCb(h, onb, "sym", tlp, "reset", NULL );
  64. cmDspSysInstallCb(h, onb, "sym", scp, "send", NULL );
  65. cmDspSysInstallCb(h, onb, "sym", mfp, "sel", NULL );
  66. cmDspSysInstallCb(h, onb, "sym", pts, "on", NULL );
  67. cmDspSysInstallCb(h, pts, "on", wtp, "cmd", NULL );
  68. // stop connections
  69. cmDspSysInstallCb(h, wtp, "done",offb,"in", NULL ); // 'done' from WT simulates pressing Stop btn.
  70. cmDspSysInstallCb(h, tlp, "mfn", pts, "off", NULL ); // Prevents WT start on new audio file from TL.
  71. cmDspSysInstallCb(h, offb, "sym", mfp, "sel", NULL );
  72. cmDspSysInstallCb(h, offb, "sym", pts, "off", NULL );
  73. cmDspSysInstallCb(h, pts, "off", wtp, "cmd", NULL );
  74. // time-line to wave-table selection
  75. cmDspSysInstallCb(h, tlp, "absi", wtp, "beg", NULL );
  76. cmDspSysInstallCb(h, tlp, "aesi", wtp, "end", NULL );
  77. cmDspSysInstallCb(h, tlp, "afn", wtp, "fn", NULL );
  78. // time-line to MIDI file player selection
  79. cmDspSysInstallCb(h, tlp, "mbsi", mfp, "bsi", NULL );
  80. cmDspSysInstallCb(h, tlp, "mesi", mfp, "esi", NULL );
  81. cmDspSysInstallCb(h, tlp, "mfn", mfp, "fn", NULL );
  82. // score to score follower
  83. cmDspSysInstallCb(h, scp, "sel", sfp, "index", NULL );
  84. // MIDI file player to score-follower
  85. cmDspSysInstallCb(h, mfp, "status", sfp, "status", NULL );
  86. cmDspSysInstallCb(h, mfp, "d0", sfp, "d0", NULL );
  87. cmDspSysInstallCb(h, mfp, "d1", sfp, "d1", NULL );
  88. // Printer connections
  89. cmDspSysInstallCb(h, tlp, "afn", prp, "in", NULL );
  90. cmDspSysInstallCb(h, tlp, "mfn", prp, "in", NULL );
  91. cmDspSysInstallCb(h, tlp, "sel", prp, "in", NULL );
  92. //cmDspSysInstallCb(h, sfp, "out", prp, "in", NULL );
  93. return rc;
  94. }