|
@@ -627,7 +627,10 @@ extern "C" {
|
627
|
627
|
cmRC_t cmScModulatorDump( cmScModulator* p );
|
628
|
628
|
|
629
|
629
|
//=======================================================================================================================
|
630
|
|
-
|
|
630
|
+ //
|
|
631
|
+ // Record fragments of audio, store them, and play them back at a later time.
|
|
632
|
+ //
|
|
633
|
+
|
631
|
634
|
typedef struct cmRecdPlayFrag_str
|
632
|
635
|
{
|
633
|
636
|
unsigned labelSymId; // this fragments label
|
|
@@ -658,6 +661,17 @@ extern "C" {
|
658
|
661
|
} cmRecdPlay;
|
659
|
662
|
|
660
|
663
|
|
|
664
|
+ // srate - system sample rate
|
|
665
|
+ // fragCnt - total count of samples to record
|
|
666
|
+ // chCnt - count of input and output audio channels.
|
|
667
|
+ // initFragSecs - amount of memory to pre-allocate for each fragment.
|
|
668
|
+ // maxLaSecs - maximum value for curLaSecs
|
|
669
|
+ // curLaSecs - current duration of look-ahead buffer
|
|
670
|
+ //
|
|
671
|
+ // The look-ahead buffer is a circular buffer which hold the previous 'curLaSecs' seconds
|
|
672
|
+ // of incoming audio. When recording is enabled with via cmRecdPlayBeginRecord() the
|
|
673
|
+ // look ahead buffer is automatically prepended to the fragment.
|
|
674
|
+
|
661
|
675
|
cmRecdPlay* cmRecdPlayAlloc( cmCtx* c, cmRecdPlay* p, double srate, unsigned fragCnt, unsigned chCnt, double initFragSecs, double maxLaSecs, double curLaSecs );
|
662
|
676
|
cmRC_t cmRecdPlayFree( cmRecdPlay** pp );
|
663
|
677
|
cmRC_t cmRecdPlayInit( cmRecdPlay* p, double srate, unsigned flagCnt, unsigned chCnt, double initFragSecs, double maxLaSecs, double curLaSecs );
|
|
@@ -667,16 +681,49 @@ extern "C" {
|
667
|
681
|
|
668
|
682
|
cmRC_t cmRecdPlaySetLaSecs( cmRecdPlay* p, double curLaSecs );
|
669
|
683
|
|
|
684
|
+ // Deactivates all active recorders and players, zeros the look-ahead buffer and
|
|
685
|
+ // rewinds all fragment play positions. This function does not clear the audio from
|
|
686
|
+ // frabments that have already been recorded.
|
670
|
687
|
cmRC_t cmRecdPlayRewind( cmRecdPlay* p );
|
|
688
|
+
|
671
|
689
|
cmRC_t cmRecdPlayBeginRecord( cmRecdPlay* p, unsigned labelSymId );
|
672
|
690
|
cmRC_t cmRecdPlayEndRecord( cmRecdPlay* p, unsigned labelSymId );
|
673
|
691
|
cmRC_t cmRecdPlayBeginPlay( cmRecdPlay* p, unsigned labelSymId );
|
674
|
692
|
cmRC_t cmRecdPlayEndPlay( cmRecdPlay* p, unsigned labelSymId );
|
675
|
693
|
|
|
694
|
+ // Begin fading out the specified fragment at a rate deteremined by 'dbPerSec'.
|
676
|
695
|
cmRC_t cmRecdPlayBeginFade( cmRecdPlay* p, unsigned labelSymId, double fadeDbPerSec );
|
677
|
696
|
|
678
|
697
|
cmRC_t cmRecdPlayExec( cmRecdPlay* p, const cmSample_t** iChs, cmSample_t** oChs, unsigned chCnt, unsigned smpCnt );
|
679
|
698
|
|
|
699
|
+ //=======================================================================================================================
|
|
700
|
+ // Goertzel Filter
|
|
701
|
+ //
|
|
702
|
+
|
|
703
|
+ typedef struct
|
|
704
|
+ {
|
|
705
|
+ double s0;
|
|
706
|
+ double s1;
|
|
707
|
+ double s2;
|
|
708
|
+ double coeff;
|
|
709
|
+ } cmGoertzelCh;
|
|
710
|
+
|
|
711
|
+ typedef struct
|
|
712
|
+ {
|
|
713
|
+ cmObj obj;
|
|
714
|
+ cmGoertzelCh* ch;
|
|
715
|
+ unsigned chCnt;
|
|
716
|
+ double srate;
|
|
717
|
+ } cmGoertzel;
|
|
718
|
+
|
|
719
|
+ cmGoertzel* cmGoertzelAlloc( cmCtx* c, cmGoertzel* p, double srate, const double* fcHzV, unsigned chCnt );
|
|
720
|
+ cmRC_t cmGoertzelFree( cmGoertzel** pp );
|
|
721
|
+ cmRC_t cmGoertzelInit( cmGoertzel* p, double srate, const double* fcHzV, unsigned chCnt );
|
|
722
|
+ cmRC_t cmGoertzelFinal( cmGoertzel* p );
|
|
723
|
+ cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt, double* outV, unsigned chCnt );
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
680
|
727
|
#ifdef __cplusplus
|
681
|
728
|
}
|
682
|
729
|
#endif
|