@@ -177,6 +177,24 @@ const juce::MidiFile SourceManager::makeMIDIFile(uint64_t ref) const {
177
177
return {};
178
178
}
179
179
180
+ void SourceManager::writeAudio (uint64_t ref,
181
+ AudioWriteType type, const juce::AudioSampleBuffer& buffer,
182
+ double startTime, double length, double sampleRate) {
183
+ juce::ScopedWriteLock locker (audioLock::getSourceLock ());
184
+ if (auto ptr = this ->getSource (ref, SourceType::Audio)) {
185
+ ptr->writeAudio (type, buffer, startTime, length, sampleRate);
186
+ }
187
+ }
188
+
189
+ void SourceManager::writeMIDI (uint64_t ref,
190
+ MIDIWriteType type, const juce::MidiMessageSequence& sequence,
191
+ double startTime, double length) {
192
+ juce::ScopedWriteLock locker (audioLock::getSourceLock ());
193
+ if (auto ptr = this ->getSource (ref, SourceType::Audio)) {
194
+ ptr->writeMIDI (type, sequence, startTime, length);
195
+ }
196
+ }
197
+
180
198
void SourceManager::prepareAudioPlay (uint64_t ref) {
181
199
juce::ScopedWriteLock locker (audioLock::getSourceLock ());
182
200
if (auto ptr = this ->getSource (ref, SourceType::Audio)) {
@@ -238,90 +256,103 @@ void SourceManager::readMIDIData(uint64_t ref, juce::MidiBuffer& buffer, double
238
256
}
239
257
240
258
int SourceManager::getMIDINoteNum (uint64_t ref, int track) const {
259
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
241
260
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
242
261
return ptr->getMIDINoteNum (track);
243
262
}
244
263
return 0 ;
245
264
}
246
265
247
266
int SourceManager::getMIDIPitchWheelNum (uint64_t ref, int track) const {
267
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
248
268
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
249
269
return ptr->getMIDIPitchWheelNum (track);
250
270
}
251
271
return 0 ;
252
272
}
253
273
254
274
int SourceManager::getMIDIAfterTouchNum (uint64_t ref, int track) const {
275
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
255
276
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
256
277
return ptr->getMIDIAfterTouchNum (track);
257
278
}
258
279
return 0 ;
259
280
}
260
281
261
282
int SourceManager::getMIDIChannelPressureNum (uint64_t ref, int track) const {
283
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
262
284
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
263
285
return ptr->getMIDIChannelPressureNum (track);
264
286
}
265
287
return 0 ;
266
288
}
267
289
268
290
const std::set<uint8_t > SourceManager::getMIDIControllerNumbers (uint64_t ref, int track) const {
291
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
269
292
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
270
293
return ptr->getMIDIControllerNumbers (track);
271
294
}
272
295
return {};
273
296
}
274
297
275
298
int SourceManager::getMIDIControllerNum (uint64_t ref, int track, uint8_t number) const {
299
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
276
300
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
277
301
return ptr->getMIDIControllerNum (track, number);
278
302
}
279
303
return 0 ;
280
304
}
281
305
282
306
int SourceManager::getMIDIMiscNum (uint64_t ref, int track) const {
307
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
283
308
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
284
309
return ptr->getMIDIMiscNum (track);
285
310
}
286
311
return 0 ;
287
312
}
288
313
289
314
const SourceMIDITemp::Note SourceManager::getMIDINote (uint64_t ref, int track, int index) const {
315
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
290
316
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
291
317
return ptr->getMIDINote (track, index);
292
318
}
293
319
return {};
294
320
}
295
321
296
322
const SourceMIDITemp::IntParam SourceManager::getMIDIPitchWheel (uint64_t ref, int track, int index) const {
323
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
297
324
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
298
325
return ptr->getMIDIPitchWheel (track, index);
299
326
}
300
327
return {};
301
328
}
302
329
303
330
const SourceMIDITemp::AfterTouch SourceManager::getMIDIAfterTouch (uint64_t ref, int track, int index) const {
331
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
304
332
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
305
333
return ptr->getMIDIAfterTouch (track, index);
306
334
}
307
335
return {};
308
336
}
309
337
310
338
const SourceMIDITemp::IntParam SourceManager::getMIDIChannelPressure (uint64_t ref, int track, int index) const {
339
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
311
340
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
312
341
return ptr->getMIDIChannelPressure (track, index);
313
342
}
314
343
return {};
315
344
}
316
345
317
346
const SourceMIDITemp::Controller SourceManager::getMIDIController (uint64_t ref, int track, uint8_t number, int index) const {
347
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
318
348
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
319
349
return ptr->getMIDIController (track, number, index);
320
350
}
321
351
return {};
322
352
}
323
353
324
354
const SourceMIDITemp::Misc SourceManager::getMIDIMisc (uint64_t ref, int track, int index) const {
355
+ juce::ScopedReadLock locker (audioLock::getSourceLock ());
325
356
if (auto ptr = this ->getSourceFast (ref, SourceType::MIDI)) {
326
357
return ptr->getMIDIMisc (track, index);
327
358
}
0 commit comments