| 592 | struct ex_microphone_reverb : public labsound_example |
| 593 | { |
| 594 | virtual void play(int argc, char ** argv) override |
| 595 | { |
| 596 | const auto defaultAudioDeviceConfigurations = GetDefaultAudioDeviceConfiguration(true); |
| 597 | context = lab::MakeRealtimeAudioContext(defaultAudioDeviceConfigurations.second, defaultAudioDeviceConfigurations.first); |
| 598 | lab::AudioContext& ac = *context.get(); |
| 599 | |
| 600 | { |
| 601 | std::shared_ptr<AudioBus> impulseResponseClip = |
| 602 | MakeBusFromSampleFile("impulse/cardiod-rear-levelled.wav", argc, argv); |
| 603 | std::shared_ptr<AudioHardwareInputNode> input; |
| 604 | std::shared_ptr<ConvolverNode> convolve; |
| 605 | std::shared_ptr<GainNode> wetGain; |
| 606 | std::shared_ptr<RecorderNode> recorder; |
| 607 | |
| 608 | { |
| 609 | ContextRenderLock r(context.get(), "ex_microphone_reverb"); |
| 610 | |
| 611 | input = lab::MakeAudioHardwareInputNode(r); |
| 612 | |
| 613 | recorder.reset(new RecorderNode(ac, defaultAudioDeviceConfigurations.second)); |
| 614 | context->addAutomaticPullNode(recorder); |
| 615 | |
| 616 | convolve.reset(new ConvolverNode(ac)); |
| 617 | convolve->setImpulse(impulseResponseClip); |
| 618 | |
| 619 | wetGain.reset(new GainNode(ac)); |
| 620 | wetGain->gain()->setValue(0.6f); |
| 621 | |
| 622 | context->connect(convolve, input, 0, 0); |
| 623 | context->connect(wetGain, convolve, 0, 0); |
| 624 | context->connect(context->device(), wetGain, 0, 0); |
| 625 | context->connect(recorder, wetGain, 0, 0); |
| 626 | } |
| 627 | |
| 628 | _nodes.push_back(input); |
| 629 | _nodes.push_back(convolve); |
| 630 | _nodes.push_back(wetGain); |
| 631 | |
| 632 | recorder->startRecording(); |
| 633 | |
| 634 | Wait(10000); |
| 635 | |
| 636 | recorder->stopRecording(); |
| 637 | context->removeAutomaticPullNode(recorder); |
| 638 | recorder->writeRecordingToWav("ex_microphone_reverb.wav", true); |
| 639 | |
| 640 | context.reset(); |
| 641 | } |
| 642 | } |
| 643 | }; |
| 644 | |
| 645 | ////////////////////////////// |
nothing calls this directly
no test coverage detected