Unable to record audio when not debugging tracktion engine in plugin

Hello,
I’m trying to record audio into a track which is connected to the plugin input usung a WavInDevice.
When I launch reaper from VS Code, the recording works and it creates a wav file in the project directory (reaper is scanning the plugin as VST directly from the project build directory).
However, when running reaper not in through the debugger, the recording doesn’t work and does not generate any wav file. I thappens both in debug and release builds of the VST.
I’m pretty much following the EngineInPlugin example but recording audio instead of midi.

Thanks!

Update: I’m trying to control where the recorded files are save by setting edit option filePathResolver like so:

            edit.filePathResolver = [this] (const juce::String& path) -> juce::File
            {
                jassert (path.isNotEmpty());
                DBG("Looking for file with path " << path);
                juce::File p(path);
                
                const auto destDir = this->edit.getTempDirectory (true);
                jassert (destDir != juce::File());

                const auto file = destDir.getChildFile (p.getFileName());
                DBG("created a temp file with path " << file.getFullPathName());
                return file;
            };

I’m getting the following logs here when recording:
Looking for file with path /Users/jonathan/dev/SequencerPlugin/_AudioRecord_Take_2.wav
created a temp file with path /Users/jonathan/Library/SequencerPlugin/Temporary/edit_0_20a732/_AudioRecord_Take_2.wav
But still when debugging the recorded files are saved to the project folder instead of the edit temp directory. And when not debugging, the audio files are not saved at all :frowning:

Am I doing something wrong with recording here? I followed the engine in plugin example but used audio track instead of midi.

Thanks,
Jonathan

If you take a look at the expandPatterns function in tracktion_WaveInputDevice.cpp you’ll see how the recording file is determined.

Maybe you need to change the filenameMask by calling WaveInputDevice::setFilenameMask?

1 Like

Thanks!
I did this and it fixed the issue:

juce::String filePathTemplate;
filePathTemplate << edit.getTempDirectory(true).getFullPathName() << juce::File::getSeparatorChar() << "Recording_%track%_Take_%take%";

auto dev = dm.getWaveInDevice (0)
dev->setFilenameMask(filePathTemplate);