Browse Source

cmDspKr.c : Added comments to _cmDspAmSync.

master
kevin 10 years ago
parent
commit
19224be46a
1 changed files with 19 additions and 6 deletions
  1. 19
    6
      dsp/cmDspKr.c

+ 19
- 6
dsp/cmDspKr.c View File

@@ -1940,13 +1940,13 @@ cmDspClass_t _cmAmSyncDC;
1940 1940
 
1941 1941
 typedef struct cmDspAmSyncEntry_str
1942 1942
 {
1943
-  const cmChar_t* afn;    
1944
-  const cmChar_t* mfn;     
1943
+  const cmChar_t* afn;  // audio file name  
1944
+  const cmChar_t* mfn;  // midi file name   
1945 1945
   unsigned        asmp; // Audio sample index to sync to MIDI event
1946 1946
   unsigned        mid;  // MIDI event unique id (cmMidiTrackMsg_t.uid)
1947
-  int             afi;
1947
+  int             afi;  // 
1948 1948
   int             mfi;
1949
-  unsigned        state;
1949
+  unsigned        state; // as incoming msg match this record the state is updated with kXXXAmFl flags 
1950 1950
 } cmDspAmSyncEntry_t;
1951 1951
 
1952 1952
 typedef struct
@@ -2057,7 +2057,15 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
2057 2057
 
2058 2058
           int dframes = r->mfi-r->afi; 
2059 2059
           cmRptPrintf(ctx->rpt,"0x%x : %s %i %i - %s %i  %i : frm:%i smp:%i sec:%f\n",
2060
-            r->state,r->afn,r->asmp,r->afi,r->mfn,r->mid,r->mfi,dframes,dframes*fpc,dframes*fpc/srate);
2060
+            r->state,
2061
+            r->afn,
2062
+            r->asmp,
2063
+            r->afi,
2064
+            r->mfn,
2065
+            r->mid,
2066
+            r->mfi,
2067
+            dframes,
2068
+            dframes*fpc,dframes*fpc/srate);
2061 2069
 
2062 2070
           r->afi = cmInvalidIdx;
2063 2071
           r->mfi = cmInvalidIdx;
@@ -2071,7 +2079,9 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
2071 2079
 
2072 2080
     case kAFnAmId:
2073 2081
       {
2082
+        // an audio file name just arrived - set p->acur to point to it
2074 2083
         const cmChar_t* fn = cmDspStrcz(inst, kAFnAmId );
2084
+        
2075 2085
         for(i=0; i<p->arrayCnt; ++i)
2076 2086
           if( strcmp(fn,p->array[i].afn) == 0 )
2077 2087
           {
@@ -2083,6 +2093,7 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
2083 2093
 
2084 2094
     case kMFnAmId:
2085 2095
       {
2096
+        // an midi file name just arrived - set p->mcur to point to it
2086 2097
         const cmChar_t* fn = cmDspStrcz(inst, kMFnAmId );
2087 2098
         for(i=0; i<p->arrayCnt; ++i)
2088 2099
           if( strcmp(fn,p->array[i].mfn) == 0 )
@@ -2095,8 +2106,10 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
2095 2106
 
2096 2107
     case kASmpAmId:
2097 2108
       {
2109
+        // a audio file sample index has just arrived
2098 2110
         int v = cmDspInt(inst,kASmpAmId); 
2099
-
2111
+        
2112
+        // if a valid audio file has been set
2100 2113
         if( p->acur != NULL )
2101 2114
           for(i=0; i<p->arrayCnt; ++i)
2102 2115
           {

Loading…
Cancel
Save