Преглед изворни кода

cmDspPgm.c : Added _cmDspSysPgm_RtRecord() to record in real-time to a file.

master
kevin пре 8 година
родитељ
комит
1091f308c6
1 измењених фајлова са 26 додато и 0 уклоњено
  1. 26
    0
      dsp/cmDspPgm.c

+ 26
- 0
dsp/cmDspPgm.c Прегледај датотеку

627
 
627
 
628
 //------------------------------------------------------------------------------
628
 //------------------------------------------------------------------------------
629
 //)
629
 //)
630
+//( { label:cmDspPgm_FtRecord file_desc:"Record streaming audio input to an audio file." kw:[spgm] }
631
+cmDspRC_t _cmDspSysPgm_RtRecord(cmDspSysH_t h, void** userPtrPtr)
632
+{
633
+  cmDspInst_t* ai0   = cmDspSysAllocInst( h, "AudioIn", NULL,  1, 0 );
634
+  cmDspInst_t* ai1   = cmDspSysAllocInst( h, "AudioIn", NULL,  1, 1 );  
635
+  cmDspInst_t* afp   = cmDspSysAllocInst( h, "AudioFileOut", NULL,  2,"/Users/kevin/temp/test.aif",2);
636
+  
637
+  // AudioFileOut needs an open message to create the output file
638
+  cmDspInst_t* btn   = cmDspSysAllocInst( h, "Button",      "open",  2, kButtonDuiId, 1.0 );
639
+  cmDspSysAssignInstAttrSymbolStr(h, btn, "_reset" );
640
+  cmDspInst_t* pts = cmDspSysAllocInst(h,"PortToSym", NULL, 1, "open" );
641
+
642
+  
643
+  cmDspSysConnectAudio(h,ai0, "out", afp, "in0");
644
+  cmDspSysConnectAudio(h,ai1, "out", afp, "in1");
645
+
646
+  cmDspSysInstallCb( h, btn, "sym",  pts, "open", NULL );
647
+  cmDspSysInstallCb( h, pts, "open", afp, "sel",  NULL );
648
+
649
+  return kOkDspRC;
650
+}
651
+
652
+
653
+//------------------------------------------------------------------------------
654
+//)
630
 //( { label:cmDspPgm_PitchShift file_desc:"Pitch-shifter example program." kw:[spgm] }
655
 //( { label:cmDspPgm_PitchShift file_desc:"Pitch-shifter example program." kw:[spgm] }
631
 cmDspRC_t _cmDspSysPgm_PitchShiftFile( cmDspSysH_t h, void** userPtrPtr )
656
 cmDspRC_t _cmDspSysPgm_PitchShiftFile( cmDspSysH_t h, void** userPtrPtr )
632
 {
657
 {
3144
   { "sine",        _cmDspSysPgm_PlaySine,       NULL, NULL },
3169
   { "sine",        _cmDspSysPgm_PlaySine,       NULL, NULL },
3145
   { "file",        _cmDspSysPgm_PlayFile,       NULL, NULL },
3170
   { "file",        _cmDspSysPgm_PlayFile,       NULL, NULL },
3146
   { "gate_detect", _cmDspSysPgm_GateDetect,     NULL, NULL },
3171
   { "gate_detect", _cmDspSysPgm_GateDetect,     NULL, NULL },
3172
+  { "rt_record",   _cmDspSysPgm_RtRecord,       NULL, NULL },
3147
   { "record",      _cmDspSysPgm_Record,         NULL, NULL },
3173
   { "record",      _cmDspSysPgm_Record,         NULL, NULL },
3148
   { "pitch_shift", _cmDspSysPgm_PitchShiftFile, NULL, NULL },
3174
   { "pitch_shift", _cmDspSysPgm_PitchShiftFile, NULL, NULL },
3149
   { "loop_recd",   _cmDspSysPgm_LoopRecd,       NULL, NULL },
3175
   { "loop_recd",   _cmDspSysPgm_LoopRecd,       NULL, NULL },

Loading…
Откажи
Сачувај