|
@@ -1929,7 +1929,7 @@ cmDspInst_t* _cmDspAmSyncAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigne
|
1929
|
1929
|
{
|
1930
|
1930
|
cmDspVarArg_t args[] =
|
1931
|
1931
|
{
|
1932
|
|
- { "sel", kSelAmId, 0, 0, kInDsvFl | kTypeDsvMask, "Any message to print" },
|
|
1932
|
+ { "sel", kSelAmId, 0, 0, kInDsvFl | kTypeDsvMask, "Print and reset" },
|
1933
|
1933
|
{ "afn", kAFnAmId, 0, 0, kInDsvFl | kStrzDsvFl, "Audio File name"},
|
1934
|
1934
|
{ "asmp", kASmpAmId, 0, 0, kInDsvFl | kIntDsvFl, "Audio sample index"},
|
1935
|
1935
|
{ "mfn", kMFnAmId, 0, 0, kInDsvFl | kStrzDsvFl, "MIDI File name"},
|
|
@@ -2020,12 +2020,19 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
2020
|
2020
|
|
2021
|
2021
|
for(i=0; i<p->arrayCnt; ++i)
|
2022
|
2022
|
{
|
2023
|
|
- const cmDspAmSyncEntry_t* r = p->array + i;
|
|
2023
|
+ cmDspAmSyncEntry_t* r = p->array + i;
|
2024
|
2024
|
|
2025
|
2025
|
int dframes = r->mfi-r->afi;
|
2026
|
2026
|
cmRptPrintf(ctx->rpt,"0x%x : %s %i %i - %s %i %i : frm:%i smp:%i sec:%f\n",
|
2027
|
2027
|
r->state,r->afn,r->asmp,r->afi,r->mfn,r->mid,r->mfi,dframes,dframes*fpc,dframes*fpc/srate);
|
|
2028
|
+
|
|
2029
|
+ r->afi = cmInvalidIdx;
|
|
2030
|
+ r->mfi = cmInvalidIdx;
|
|
2031
|
+ r->state = 0;
|
|
2032
|
+
|
2028
|
2033
|
}
|
|
2034
|
+ p->acur = NULL;
|
|
2035
|
+ p->mcur = NULL;
|
2029
|
2036
|
}
|
2030
|
2037
|
break;
|
2031
|
2038
|
|
|
@@ -2035,9 +2042,8 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
2035
|
2042
|
for(i=0; i<p->arrayCnt; ++i)
|
2036
|
2043
|
if( strcmp(fn,p->array[i].afn) == 0 )
|
2037
|
2044
|
{
|
2038
|
|
- p->acur = p->array + i;
|
2039
|
2045
|
p->array[i].state = cmSetFlag(p->array[i].state,kAfnAmFl);
|
2040
|
|
- break;
|
|
2046
|
+ p->acur = p->array + i;
|
2041
|
2047
|
}
|
2042
|
2048
|
}
|
2043
|
2049
|
break;
|
|
@@ -2048,32 +2054,45 @@ cmDspRC_t _cmDspAmSyncRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
2048
|
2054
|
for(i=0; i<p->arrayCnt; ++i)
|
2049
|
2055
|
if( strcmp(fn,p->array[i].mfn) == 0 )
|
2050
|
2056
|
{
|
2051
|
|
- p->mcur = p->array + i;
|
2052
|
2057
|
p->array[i].state = cmSetFlag(p->array[i].state,kMfnAmFl);
|
2053
|
|
- break;
|
|
2058
|
+ p->mcur = p->array + i;
|
2054
|
2059
|
}
|
2055
|
2060
|
}
|
2056
|
2061
|
break;
|
2057
|
2062
|
|
2058
|
2063
|
case kASmpAmId:
|
2059
|
2064
|
{
|
2060
|
|
- int v = cmDspInt(inst,kASmpAmId);
|
2061
|
|
- if( p->acur != NULL && p->acur->asmp <= v )
|
2062
|
|
- {
|
2063
|
|
- p->acur->afi = ctx->cycleCnt;
|
2064
|
|
- p->acur->state = cmSetFlag(p->acur->state,kAsmpAmFl);
|
2065
|
|
- }
|
|
2065
|
+ int v = cmDspInt(inst,kASmpAmId);
|
|
2066
|
+
|
|
2067
|
+ if( p->acur != NULL )
|
|
2068
|
+ for(i=0; i<p->arrayCnt; ++i)
|
|
2069
|
+ {
|
|
2070
|
+ cmDspAmSyncEntry_t* r = p->array + i;
|
|
2071
|
+ if( cmIsNotFlag(r->state,kAsmpAmFl) && r->asmp <= v && strcmp(p->acur->afn,r->afn)==0 )
|
|
2072
|
+ {
|
|
2073
|
+ r->afi = ctx->cycleCnt;
|
|
2074
|
+ r->state = cmSetFlag(r->state,kAsmpAmFl);
|
|
2075
|
+ break;
|
|
2076
|
+ }
|
|
2077
|
+ }
|
2066
|
2078
|
}
|
2067
|
2079
|
break;
|
2068
|
2080
|
|
2069
|
2081
|
case kMIdAmId:
|
2070
|
2082
|
{
|
2071
|
2083
|
int v = cmDspInt(inst,kMIdAmId);
|
2072
|
|
- if( p->mcur != NULL && p->mcur->mid == v )
|
2073
|
|
- {
|
2074
|
|
- p->mcur->mfi = ctx->cycleCnt;
|
2075
|
|
- p->mcur->state = cmSetFlag(p->mcur->state,kMidAmFl);
|
2076
|
|
- }
|
|
2084
|
+ if( p->mcur != NULL )
|
|
2085
|
+ for(i=0; i<p->arrayCnt; ++i)
|
|
2086
|
+ {
|
|
2087
|
+ cmDspAmSyncEntry_t* r = p->array + i;
|
|
2088
|
+ if( cmIsNotFlag(r->state,kMidAmFl) && r->mid == v && strcmp(p->mcur->mfn,r->mfn)==0 )
|
|
2089
|
+ {
|
|
2090
|
+ r->mfi = ctx->cycleCnt;
|
|
2091
|
+ r->state = cmSetFlag(r->state,kMidAmFl);
|
|
2092
|
+ break;
|
|
2093
|
+ }
|
|
2094
|
+ }
|
|
2095
|
+
|
2077
|
2096
|
}
|
2078
|
2097
|
break;
|
2079
|
2098
|
|