60{
61
63 << " to " << ( len + start ).as_long_long()
64 << std::endl;
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 int numclips =
mClips.size();
82
83
84 std::vector<sampleCount> clipStart(numclips);
85 std::vector<sampleCount> clipLength(numclips);
86 std::vector<Sequence*> tmpSequence(numclips);
87
88
89 unsigned int i = 0;
90
91 for(
const auto &tmpclip:
mClips)
92 {
93 tmpSequence[i] = tmpclip->GetSequence();
94
95
96
97
98 clipStart[i]= start - tmpclip->GetStartSample();
99
100
101
102
103
104
105 clipLength[i] = tmpclip->GetNumSamples()-clipStart[i];
106
107 std::cout << "X:" << " "
109 << " "
110 << tmpclip->GetStartSample().as_long_long()
111 << " ";
112
113 if(clipStart[i] + len < clipLength[i])
114 {
115 clipLength[i] = len + clipStart[i];
116 }
117 std::cout
118 << clipStart[i].as_long_long()
119 << " "
120 << clipLength[i].as_long_long()
121 << " "
122 << ( clipLength[i] - clipStart[i] ).as_long_long()
123 << std::endl;
124 }
125 std::cout << "-------------\n";
126
127
130 {
131 std::cout << "int\n";
132 short *dest = (short *)buffer;
133 vector<short*> shortSeq;
134
135
136 for(int i = 0; i < numclips; i++)
137
138 shortSeq.push_back((short*)tmpSequence[i]);
139
140
141 int clips;
142 double f;
143
144 for (int j = 0; j < (int)len; j++)
145 {
146
147
148 for(int i = 0; i < numclips; i++)
149 {
150 clips = 0;
151 f = 0;
152 if(j + clipStart[i] >= 0 &&
153 clipStart[i]+len < clipLength[i])
154 {
155
156
157 f += shortSeq[ i ][ j+ clipStart[i].as_long_long() ];
158 clips++;
159 }
160
161 f/= clips;
162
163
164 if (f > 32767)
165 f = 32767;
166 if (f < -32768)
167 f = -32768;
168
169
170 *dest = (short)f;
171 }
172 dest++;
173 }
174 }
175 break;
176
177
179 {
180 std::cout << "int24\n";
181 int *dest = (int *)buffer;
182 vector<int *> intSeq;
183
184
185
186 for(int i = 0; i < numclips; i++)
187
188
189 intSeq.push_back((int*)tmpSequence[i]);
190
191 int clips=0;
192 double f;
193
194 for (int j = 0; j < (int)len; j++) {
195
196
197 for(int i= 0; i < numclips; i++)
198 {
199 clips = 0;
200 f = 0;
201
202
203 if(j + clipStart[i] >= 0 && clipStart[i] + len < clipLength[i])
204 {
205
206
207 f+= intSeq[ i ][ j + clipStart[ i ].as_long_long() ];
208 clips++;
209 }
210
211 f /= clips;
212
213 if (f > 8388607)
214 f = 8388607;
215 if (f < -8388608)
216 f = -8388608;
217 *dest = (int)f;
218
219 }
220 dest ++;
221 }
222 }
223 break;
224
225
227 std::cout << "float\n";
228 float *dest = (float *)buffer;
229 vector<float*> floatSeq;
230
231 int clips = 0;
232 float f;
233
234
235 for (int j = 0; j < (int)len; j++) {
236
237
238 clips = 0;
239 f = 0;
240
241 for(int i = 0; i < numclips; i++)
242 {
243
244 cout << numclips << " " ;
245
246 cout <<f << " " ;
247
248 if(j + clipStart[i] >= 0 &&
249 clipStart[i] + j < clipLength[i])
250 {
251
252
253
254
255
256 f += floatSeq[ i ][ ( j + clipStart[ i ] ).as_long_long() ];
257 clips++;
258 }
259 cout << f << " "<< i << " "
260 << floatSeq[ i ][ j + clipStart[ i ].as_long_long() ] << "|";
261 }
262 if(clips == 0)
263 *dest = 0.0f;
264 else
265 {
266
267 f /= clips;
268 cout << f << "--";
269
270 if (f > 1.0f)
271 *dest = 1.0f;
272 else if (f < -1.0f)
273 *dest = -1.0f;
274 else
275 *dest = (float)f;
276
277 }
278 cout << *dest << endl;
279 dest++;
280 }
281 } break;
282 }
283
284
285 return true;
286}
long long as_long_long() const