|
@@ -1,148 +0,0 @@
|
1
|
|
-#include "cmPrefix.h"
|
2
|
|
-#include "cmGlobal.h"
|
3
|
|
-#include "cmFloatTypes.h"
|
4
|
|
-#include "cmComplexTypes.h"
|
5
|
|
-#include "cmRpt.h"
|
6
|
|
-#include "cmErr.h"
|
7
|
|
-#include "cmCtx.h"
|
8
|
|
-#include "cmMem.h"
|
9
|
|
-#include "cmMallocDebug.h"
|
10
|
|
-#include "cmLinkedHeap.h"
|
11
|
|
-#include "cmMath.h"
|
12
|
|
-#include "cmFile.h"
|
13
|
|
-#include "cmFileSys.h"
|
14
|
|
-#include "cmSymTbl.h"
|
15
|
|
-#include "cmJson.h"
|
16
|
|
-#include "cmPrefs.h"
|
17
|
|
-#include "cmProcObj.h"
|
18
|
|
-#include "cmDspValue.h"
|
19
|
|
-#include "cmDspClass.h"
|
20
|
|
-#include "cmDspFx.h"
|
21
|
|
-#include "cmMsgProtocol.h"
|
22
|
|
-#include "cmThread.h"
|
23
|
|
-#include "cmUdpPort.h"
|
24
|
|
-#include "cmUdpNet.h"
|
25
|
|
-#include "cmAudioSys.h"
|
26
|
|
-#include "cmDspSys.h"
|
27
|
|
-
|
28
|
|
-
|
29
|
|
-//==========================================================================================================================================
|
30
|
|
-enum
|
31
|
|
-{
|
32
|
|
- kFnTlId,
|
33
|
|
- kAudOutTlId,
|
34
|
|
- kMidOutTlId,
|
35
|
|
- kEvtOutTlId
|
36
|
|
-};
|
37
|
|
-
|
38
|
|
-cmDspClass_t _cmTimeLineDC;
|
39
|
|
-
|
40
|
|
-typedef struct
|
41
|
|
-{
|
42
|
|
- cmDspInst_t inst;
|
43
|
|
- cmTlH_t tlH;
|
44
|
|
-
|
45
|
|
-} cmDspTimeLine_t;
|
46
|
|
-
|
47
|
|
-
|
48
|
|
-cmDspInst_t* _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
49
|
|
-{
|
50
|
|
- unsigned chs = 1;
|
51
|
|
-
|
52
|
|
- cmDspVarArg_t args[] =
|
53
|
|
- {
|
54
|
|
- { "fn", kFnTlId, 0, 0, kInDsvFl | kStrzDsvFl, "Time line file" },
|
55
|
|
- { "a-out", kAudOutTlId, 0, chs, kOutDsvFl | kAudioBufDsvFl, "Audio output." },
|
56
|
|
- { "m-out", kMidOutTlId, 0, 0, kOutDsvFl | k
|
57
|
|
- { NULL, 0, 0, 0, 0 }
|
58
|
|
- };
|
59
|
|
-
|
60
|
|
- // allocate the instance
|
61
|
|
- cmDspTimeLine_t* p = cmDspInstAlloc(cmDspTimeLine_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
|
62
|
|
-
|
63
|
|
- // assign default values to any of the the optional arg's which may not have been set from vl.
|
64
|
|
- cmDspSetDefaultDouble(ctx, &p->inst, kMaxTlId, 0.0, DBL_MAX);
|
65
|
|
- cmDspSetDefaultDouble(ctx, &p->inst, kMultTlId, 0.0, 1.0);
|
66
|
|
- cmDspSetDefaultDouble(ctx, &p->inst, kPhsTlId, 0.0, 0.0);
|
67
|
|
-
|
68
|
|
- return &p->inst;
|
69
|
|
-}
|
70
|
|
-
|
71
|
|
-cmDspRC_t _cmDspTimeLineReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
72
|
|
-{
|
73
|
|
- cmDspApplyAllDefaults(ctx,inst);
|
74
|
|
- cmDspZeroAudioBuf( ctx, inst, kOutTlId );
|
75
|
|
- return kOkDspRC;
|
76
|
|
-}
|
77
|
|
-
|
78
|
|
-cmDspRC_t _cmDspTimeLineExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
79
|
|
-{
|
80
|
|
- cmSample_t* bp = cmDspAudioBuf(ctx,inst,kOutTlId,0);
|
81
|
|
- const cmSample_t* ep = bp + cmDspAudioBufSmpCount(ctx,inst,kOutTlId,0);
|
82
|
|
- double mult = cmDspDouble(inst,kMultTlId);
|
83
|
|
- double max = cmDspDouble(inst,kMaxTlId);
|
84
|
|
- double phs = cmDspDouble(inst,kPhsTlId);
|
85
|
|
- double inc = mult;
|
86
|
|
-
|
87
|
|
- for(; bp<ep; ++bp)
|
88
|
|
- {
|
89
|
|
- while( phs >= max )
|
90
|
|
- phs -= max;
|
91
|
|
-
|
92
|
|
- *bp = phs;
|
93
|
|
-
|
94
|
|
- phs += inc;
|
95
|
|
-
|
96
|
|
- }
|
97
|
|
-
|
98
|
|
- cmDspSetDouble(ctx,inst,kPhsTlId,phs);
|
99
|
|
-
|
100
|
|
- return kOkDspRC;
|
101
|
|
-}
|
102
|
|
-
|
103
|
|
-cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
104
|
|
-{
|
105
|
|
- switch( evt->dstVarId )
|
106
|
|
- {
|
107
|
|
- case kMultTlId:
|
108
|
|
- case kMaxTlId:
|
109
|
|
- case kPhsTlId:
|
110
|
|
- cmDspSetEvent(ctx, inst, evt );;
|
111
|
|
- break;
|
112
|
|
-
|
113
|
|
- default:
|
114
|
|
- { assert(0); }
|
115
|
|
- }
|
116
|
|
-
|
117
|
|
- return kOkDspRC;
|
118
|
|
-}
|
119
|
|
-
|
120
|
|
-struct cmDspClass_str* cmTimeLineClassCons( cmDspCtx_t* ctx )
|
121
|
|
-{
|
122
|
|
- cmDspClassSetup(&_cmTimeLineDC,ctx,"TimeLine",
|
123
|
|
- NULL,
|
124
|
|
- _cmDspTimeLineAlloc,
|
125
|
|
- NULL,
|
126
|
|
- _cmDspTimeLineReset,
|
127
|
|
- _cmDspTimeLineExec,
|
128
|
|
- _cmDspTimeLineRecv,
|
129
|
|
- NULL,
|
130
|
|
- NULL,
|
131
|
|
- "Ramp wave signal generator.");
|
132
|
|
-
|
133
|
|
- return &_cmTimeLineDC;
|
134
|
|
-}
|
135
|
|
-
|
136
|
|
-
|
137
|
|
-
|
138
|
|
-typedef struct
|
139
|
|
-
|
140
|
|
-typedef struct cmPerfEvt_str
|
141
|
|
-{
|
142
|
|
- unsigned pitch;
|
143
|
|
- unsigned dyn;
|
144
|
|
- unsigned ioiTicks;
|
145
|
|
-} cmPerfEvt_t;
|
146
|
|
-
|
147
|
|
-
|
148
|
|
-
|