-
Notifications
You must be signed in to change notification settings - Fork 7
/
wrapper.cpp
629 lines (581 loc) · 22.3 KB
/
wrapper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
#include "compiler.prepro.h"
#include "extras.h"
#include "memory.h"
#define IMJ_TRACE_EXTERN_C 0
#ifdef __cplusplus
namespace imajuscule::audio {
Midi const & getMidi() {
static Midi midi;
return midi;
}
/*
* Is equal to:
* number of calls to 'initializeAudioOutput' - number of calls to 'teardownAudioOutput'
*/
int & countUsers() {
static int n(0);
return n;
}
/*
* Protects access to countUsers() and the initialization / uninitialization of the global audio output stream
*/
std::mutex & initMutex() {
static std::mutex m;
return m;
}
bool convert(onEventResult e) {
switch(e) {
case onEventResult::OK:
return true;
default:
return false;
}
}
}
namespace imajuscule::audio::audioelement {
template<typename Env>
double* envelopeGraph(int sample_rate, typename Env::Param const & rawEnvParams, int*nElems, int*splitAt) {
std::vector<double> v;
int split;
std::tie(v, split) = envelopeGraphVec<Env>(sample_rate, rawEnvParams);
#if 0
// for debugging purposes
LG(INFO, "writing envelope as .wav file");
write_wav("/Users/Olivier/Dev/hs.hamazed", "env.wav", std::vector<std::vector<double>>{v}, 100);
#endif
if(nElems) {
*nElems = v.size();
}
if(splitAt) {
*splitAt = split;
}
auto n_bytes = v.size()*sizeof(decltype(v[0]));
auto c_arr = imj_c_malloc(n_bytes); // will be freed by haskell finalizer.
memcpy(c_arr, v.data(), n_bytes);
return static_cast<double*>(c_arr);
}
double* analyzeEnvelopeGraph(int sample_rate, EnvelopeRelease t, AHDSR p, int* nElems, int*splitAt) {
static constexpr auto A = getAtomicity<audioEnginePolicy>();
switch(t) {
case EnvelopeRelease::ReleaseAfterDecay:
return envelopeGraph<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::ReleaseAfterDecay>>(sample_rate, p, nElems, splitAt);
case EnvelopeRelease::WaitForKeyRelease:
return envelopeGraph<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::WaitForKeyRelease>>(sample_rate, p, nElems, splitAt);
default:
return {};
}
}
audio::onEventResult midiEventAHDSR(int voice, float stereo, OscillatorType osc, EnvelopeRelease t,
CConstArray<harmonicProperties_t> const & harmonics,
AHDSR p, audio::Event n, Optional<audio::MIDITimestampAndSource> maybeMts) {
static constexpr auto A = getAtomicity<audioEnginePolicy>();
switch(t) {
case EnvelopeRelease::ReleaseAfterDecay:
return midiEvent_<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::ReleaseAfterDecay>>(voice, stereo, osc, harmonics, p, n, maybeMts);
case EnvelopeRelease::WaitForKeyRelease:
return midiEvent_<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::WaitForKeyRelease>>(voice, stereo, osc, harmonics, p, n, maybeMts);
}
}
audio::onEventResult midiEventAHDSRSweep(int voice, float stereo, OscillatorType osc, EnvelopeRelease t,
CConstArray<harmonicProperties_t> const & harmonics,
AHDSR p,
audioelement::SweepSetup const & sweep,
audio::Event n, Optional<audio::MIDITimestampAndSource> maybeMts) {
static constexpr auto A = getAtomicity<audioEnginePolicy>();
switch(t) {
case EnvelopeRelease::ReleaseAfterDecay:
return midiEventSweep_<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::ReleaseAfterDecay>>(voice, stereo, osc, harmonics, p, sweep, n, maybeMts);
case EnvelopeRelease::WaitForKeyRelease:
return midiEventSweep_<AHDSREnvelope<A, AudioFloat, EnvelopeRelease::WaitForKeyRelease>>(voice, stereo, osc, harmonics, p, sweep, n, maybeMts);
}
}
} // NS imajuscule::audio::audioelement
struct Trace {
Trace(std::string const & name)
: name(name) {
std::cout << ">>> " << name << std::endl;
}
~Trace() {
std::cout << "<<< " << name << std::endl;
}
private:
std::string name;
};
harmonicProperties_t const * getUnityHarmonics() {
static harmonicProperties_t har[1]{
{0.f, 1.f}
};
return har;
}
extern "C" {
/*
* Increments the count of users, and
*
* - If we are the first user:
* initializes the audio output context,
* taking into account the latency parameters,
* - Else:
* returns the result of the first initialization,
* ignoring the latency parameters.
*
* Every successfull or unsuccessfull call to this function
* should be matched by a call to 'teardownAudioOutput'.
* .
* @param minLatencySeconds :
* The minimum portaudio latency, in seconds.
* Pass 0.f to use the smallest latency possible.
* @param portaudioMinLatencyMillis :
* If strictly positive, overrides the portaudio minimum latency by
* setting an environment variable.
*
* @returns true on success, false on error.
*/
bool initializeAudioOutput (int sampling_rate, float minLatencySeconds, int portaudioMinLatencyMillis) {
#if IMJ_TRACE_EXTERN_C
Trace trace("initializeAudioOutput");
std::cout << minLatencySeconds << " " << portaudioMinLatencyMillis << std::endl;
#endif
using namespace std;
using namespace imajuscule;
using namespace imajuscule::audio;
std::lock_guard l(initMutex());
++countUsers();
LG(INFO, "initializeAudioOutput: nUsers = %d", countUsers());
{
if( countUsers() > 1) {
// We are ** not ** the first user.
return getAudioContext().Initialized();
}
else if(countUsers() <= 0) {
LG(ERR, "initializeAudioOutput: nUsers = %d", countUsers());
Assert(0);
return getAudioContext().Initialized();
}
}
#ifndef NDEBUG
cout << "Warning : C++ sources of imj-audio were built without NDEBUG" << endl;
#endif
#ifdef IMJ_AUDIO_MASTERGLOBALLOCK
cout << "Warning : C++ sources of imj-audio were built with IMJ_AUDIO_MASTERGLOBALLOCK. " <<
"This may lead to audio glitches under contention." << endl;
#endif
if(portaudioMinLatencyMillis > 0) {
if(!overridePortaudioMinLatencyMillis(portaudioMinLatencyMillis)) {
return false;
}
}
disableDenormals();
if(!getAudioContext().doInit(minLatencySeconds,
sampling_rate,
nAudioOut,
[nanos_per_audioelement_buffer =
static_cast<uint64_t>(0.5f +
audio::nanos_per_frame<float>(sampling_rate) *
static_cast<float>(audio::audioelement::n_frames_per_buffer))]
(SAMPLE *outputBuffer,
int nFrames,
uint64_t const tNanos){
getStepper().step(outputBuffer,
nFrames,
tNanos,
nanos_per_audioelement_buffer);
})) {
return false;
}
windVoice().initializeSlow();
if(!windVoice().initialize(getStepper())) {
LG(ERR,"windVoice().initialize failed");
return false;
}
getStepper().getPost().set_post_processors({
{
[](double * buf, int const nFrames, int const blockSize) {
getReverb().post_process(buf, nFrames, blockSize);
}
},
{
[](double * buf, int const nFrames, int const blockSize) {
for (int i=0; i<nFrames; ++i) {
CArray<nAudioOut, double> a{buf + i*nAudioOut};
getLimiter().feedOneFrame(a);
}
// by now, the signal is compressed and limited...
}
}
});
// On macOS 10.13.5, this delay is necessary to be able to play sound,
// it might be a bug in portaudio where Pa_StartStream doesn't wait for the
// stream to be up and running.
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
return true;
}
/*
* Decrements the count of users, and if we are the last user,
* shutdowns audio output after having driven the audio signal to 0.
*
* Every successfull or unsuccessfull call to 'initializeAudioOutput'
* must be matched by a call to this function.
*/
void teardownAudioOutput() {
#if IMJ_TRACE_EXTERN_C
Trace trace("teardownAudioOutput");
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
std::lock_guard l(initMutex());
--countUsers();
LG(INFO, "teardownAudioOutput : nUsers = %d", countUsers());
if(countUsers() > 0) {
// We are ** not ** the last user.
return;
}
if(getAudioContext().Initialized()) {
windVoice().finalize(getStepper());
foreachOscillatorType<FinalizeSynths>();
getAudioContext().doTearDown();
}
}
void setMaxMIDIJitter(uint64_t v) {
#if IMJ_TRACE_EXTERN_C
Trace trace("setMaxMIDIJitter");
std::cout << v << std::endl;
#endif
using namespace imajuscule::audio;
maxMIDIJitter() = v;
}
bool midiNoteOnAHDSR_(int voice,
float stereo,
imajuscule::audio::audioelement::OscillatorType osc,
imajuscule::audio::audioelement::EnvelopeRelease t,
int a, int ai, int h, int d, int di, float s, int r, int ri,
harmonicProperties_t const * hars, int har_sz,
int16_t pitch, float velocity, int midiSource, uint64_t maybeMIDITime) {
#if IMJ_TRACE_EXTERN_C
Trace trace("midiNoteOnAHDSR_");
std::cout << osc << std::endl;
std::cout << t << std::endl;
std::cout << a << std::endl;
std::cout << ai << std::endl;
std::cout << h << std::endl;
std::cout << d << std::endl;
std::cout << di << std::endl;
std::cout << s << std::endl;
std::cout << r << std::endl;
std::cout << ri << std::endl;
std::cout << har_sz << std::endl;
std::cout << pitch << std::endl;
std::cout << velocity << std::endl;
std::cout << midiSource << std::endl;
std::cout << maybeMIDITime << std::endl;
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
auto p = AHDSR{a,itp::toItp(ai),h,d,itp::toItp(di),r,itp::toItp(ri),s};
auto n = mkNoteOn(NoteId{pitch},
getMidi().midi_pitch_to_freq(pitch),
velocity);
auto maybeMts = (midiSource >= 0) ?
Optional<MIDITimestampAndSource>{{maybeMIDITime, static_cast<uint64_t>(midiSource)}} :
Optional<MIDITimestampAndSource>{};
if (osc <= OscillatorType::Noise) {
har_sz = 1;
hars = getUnityHarmonics();
}
return convert(midiEventAHDSR(voice, stereo, osc, t, {hars, har_sz}, p, n, maybeMts));
}
bool midiNoteOnAHDSRSweep_(int voice,
float stereo,
imajuscule::audio::audioelement::OscillatorType osc,
imajuscule::audio::audioelement::EnvelopeRelease t,
int a, int ai, int h, int d, int di, float s, int r, int ri,
harmonicProperties_t const * hars, int har_sz,
int sweep_duration,
float sweep_freq,
imajuscule::audio::audioelement::Extremity sweep_freq_extremity,
int sweep_interp,
int16_t pitch, float velocity, int midiSource, uint64_t maybeMIDITime) {
#if IMJ_TRACE_EXTERN_C
Trace trace("midiNoteOnAHDSRSweep_");
std::cout << osc << std::endl;
std::cout << t << std::endl;
std::cout << a << std::endl;
std::cout << ai << std::endl;
std::cout << h << std::endl;
std::cout << d << std::endl;
std::cout << di << std::endl;
std::cout << s << std::endl;
std::cout << r << std::endl;
std::cout << ri << std::endl;
std::cout << har_sz << std::endl;
std::cout << sweep_duration << std::endl;
std::cout << sweep_freq << std::endl;
std::cout << sweep_freq_extremity << std::endl;
std::cout << sweep_interp << std::endl;
std::cout << pitch << std::endl;
std::cout << velocity << std::endl;
std::cout << midiSource << std::endl;
std::cout << maybeMIDITime << std::endl;
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
auto p = AHDSR{a,itp::toItp(ai),h,d,itp::toItp(di),r,itp::toItp(ri),s};
auto n = mkNoteOn(NoteId{pitch},
getMidi().midi_pitch_to_freq(pitch),
velocity);
auto maybeMts = (midiSource >= 0) ?
Optional<MIDITimestampAndSource>{{maybeMIDITime, static_cast<uint64_t>(midiSource)}} :
Optional<MIDITimestampAndSource>{};
if (osc <= OscillatorType::Noise) {
har_sz = 1;
hars = getUnityHarmonics();
}
return convert(midiEventAHDSRSweep(voice, stereo, osc, t, {hars, har_sz}, p,
SweepSetup{sweep_duration, sweep_freq, sweep_freq_extremity, itp::toItp(sweep_interp)},
n, maybeMts));
}
bool midiNoteOffAHDSR_(int voice,
imajuscule::audio::audioelement::OscillatorType osc,
imajuscule::audio::audioelement::EnvelopeRelease t,
int a, int ai, int h, int d, int di, float s, int r, int ri,
harmonicProperties_t const * hars, int har_sz,
int16_t pitch, int midiSource, uint64_t maybeMIDITime) {
#if IMJ_TRACE_EXTERN_C
Trace trace("midiNoteOffAHDSR_");
std::cout << osc << std::endl;
std::cout << t << std::endl;
std::cout << a << std::endl;
std::cout << ai << std::endl;
std::cout << h << std::endl;
std::cout << d << std::endl;
std::cout << di << std::endl;
std::cout << s << std::endl;
std::cout << r << std::endl;
std::cout << ri << std::endl;
std::cout << har_sz << std::endl;
std::cout << pitch << std::endl;
std::cout << midiSource << std::endl;
std::cout << maybeMIDITime << std::endl;
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
auto p = AHDSR{a,itp::toItp(ai),h,d,itp::toItp(di),r,itp::toItp(ri),s};
auto n = mkNoteOff(NoteId{pitch});
auto maybeMts = (midiSource >= 0) ?
Optional<MIDITimestampAndSource>{{maybeMIDITime, static_cast<uint64_t>(midiSource)}} :
Optional<MIDITimestampAndSource>{};
if (osc <= OscillatorType::Noise) {
har_sz = 1;
hars = getUnityHarmonics();
}
return convert(midiEventAHDSR(voice, 0.f, osc, t, {hars, har_sz}, p, n, maybeMts));
}
bool midiNoteOffAHDSRSweep_(int voice,
imajuscule::audio::audioelement::OscillatorType osc,
imajuscule::audio::audioelement::EnvelopeRelease t,
int a, int ai, int h, int d, int di, float s, int r, int ri,
harmonicProperties_t const * hars, int har_sz,
int sweep_duration,
float sweep_freq,
imajuscule::audio::audioelement::Extremity sweep_freq_extremity,
int sweep_interp,
int16_t pitch, int midiSource, uint64_t maybeMIDITime) {
#if IMJ_TRACE_EXTERN_C
Trace trace("midiNoteOffAHDSRSweep_");
std::cout << osc << std::endl;
std::cout << t << std::endl;
std::cout << a << std::endl;
std::cout << ai << std::endl;
std::cout << h << std::endl;
std::cout << d << std::endl;
std::cout << di << std::endl;
std::cout << s << std::endl;
std::cout << r << std::endl;
std::cout << ri << std::endl;
std::cout << har_sz << std::endl;
std::cout << sweep_duration << std::endl;
std::cout << sweep_freq << std::endl;
std::cout << sweep_freq_extremity << std::endl;
std::cout << sweep_interp << std::endl;
std::cout << pitch << std::endl;
std::cout << midiSource << std::endl;
std::cout << maybeMIDITime << std::endl;
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
auto p = AHDSR{a,itp::toItp(ai),h,d,itp::toItp(di),r,itp::toItp(ri),s};
auto n = mkNoteOff(NoteId{pitch});
auto maybeMts = (midiSource >= 0) ?
Optional<MIDITimestampAndSource>{{maybeMIDITime, static_cast<uint64_t>(midiSource)}} :
Optional<MIDITimestampAndSource>{};
if (osc <= OscillatorType::Noise) {
har_sz = 1;
hars = getUnityHarmonics();
}
return convert(midiEventAHDSRSweep(voice, 0.f, osc, t, {hars, har_sz}, p,
SweepSetup{sweep_duration, sweep_freq, sweep_freq_extremity, itp::toItp(sweep_interp)},
n, maybeMts));
}
double* analyzeAHDSREnvelope_(int sample_rate, imajuscule::audio::audioelement::EnvelopeRelease t, int a, int ai, int h, int d, int di, float s, int r, int ri, int*nElems, int*splitAt) {
#if IMJ_TRACE_EXTERN_C
Trace trace("analyzeAHDSREnvelope_");
#endif
using namespace imajuscule;
using namespace imajuscule::audio;
using namespace imajuscule::audio::audioelement;
auto p = AHDSR{a,itp::toItp(ai),h,d,itp::toItp(di),r,itp::toItp(ri),s};
return analyzeEnvelopeGraph(sample_rate, t, p, nElems, splitAt);
}
bool effectOn(int voice, int program, int16_t pitch, float velocity, float pan) {
#if IMJ_TRACE_EXTERN_C
Trace trace("effectOn");
#endif
using namespace imajuscule::audio;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
const auto voicing = Voicing(program,pitch,velocity,0.f,true,0);
std::lock_guard _(windVoiceMutex());
const NoteId note_id = windVoiceNoteIdsGen().NoteOnId(pitch);
// TODO use pan
return convert(playOneThing(getAudioContext().getSampleRate(),getMidi(),windVoice(),getStepper(),voicing, note_id));
}
bool effectOff(int voice, int16_t pitch) {
#if IMJ_TRACE_EXTERN_C
Trace trace("effectOff");
#endif
using namespace imajuscule::audio;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
std::lock_guard _(windVoiceMutex());
const NoteId note_id = windVoiceNoteIdsGen().NoteOffId(pitch);
return convert(stopPlaying(getAudioContext().getSampleRate(), windVoice(),getStepper(),note_id));
}
bool getConvolutionReverbSignature_(const char * dirPath, const char * filePath, spaceResponse_t * r) {
#if IMJ_TRACE_EXTERN_C
Trace trace("getConvolutionReverbSignature_");
#endif
using namespace imajuscule::audio;
return getConvolutionReverbSignature(dirPath, filePath, *r);
}
bool dontUseReverb_() {
#if IMJ_TRACE_EXTERN_C
Trace trace("dontUseReverb_");
#endif
using namespace imajuscule::audio;
using imajuscule::StopProcessingResult;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
if (getReverb().is_processing())
{
bool sent_fadeout = false;
std::atomic<StopProcessingResult> res;
bool go_on = true;
do {
res = StopProcessingResult::Undefined;
getStepper().enqueueOneShot(
[&res](auto & chans, uint64_t) {
res = getReverb().try_stop_processing();
});
while(res == StopProcessingResult::Undefined) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
switch(res) {
case StopProcessingResult::Undefined:
throw std::logic_error("impossible");
break;
case StopProcessingResult::StillFadingOut:
if (!sent_fadeout) {
sent_fadeout = true;
std::atomic_bool called = false;
getStepper().enqueueOneShot(
[&called,
sample_rate = getAudioContext().getSampleRate()](auto & chans, uint64_t) {
getReverb().transitionConvolutionReverbWetRatio(0.,
sample_rate);
called = true;
});
while(!called) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
break;
case StopProcessingResult::AlreadyStopped:
case StopProcessingResult::Stopped:
go_on = false;
break;
}
} while (go_on);
}
// By now, we are sure that the audio thread will not use the reverb,
// so we can deallocate it:
getReverb().dont_use();
return true;
}
bool useReverb_(const char * dirPath, const char * filePath, double wet) {
#if IMJ_TRACE_EXTERN_C
Trace trace("useReverb_");
std::cout << dirPath << " " << filePath << std::endl;
#endif
using namespace imajuscule::audio;
// stop reverb post processing
dontUseReverb_();
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
if (!useConvolutionReverb(getAudioContext().getSampleRate(),
getReverb(), dirPath, filePath)) {
return false;
}
std::atomic_bool done = false;
getStepper().enqueueOneShot(
[wet,
&done,
sample_rate = getAudioContext().getSampleRate()](auto & chans, uint64_t) {
getReverb().start_processing();
getReverb().transitionConvolutionReverbWetRatio(wet,
sample_rate);
done = true;
});
while(!done) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
return true;
}
bool setReverbWetRatio(double wet) {
#if IMJ_TRACE_EXTERN_C
Trace trace("setReverbWetRatio");
std::cout << wet << std::endl;
#endif
using namespace imajuscule::audio;
if(unlikely(!getAudioContext().Initialized())) {
return false;
}
getStepper().enqueueOneShot(
[wet,
sample_rate = getAudioContext().getSampleRate()](auto & chans, uint64_t) {
getReverb().transitionConvolutionReverbWetRatio(wet,
sample_rate);
});
return true;
}
}
#endif