#ifndef TESTHOST_WAVRECORDER_H_INCLUDED #define TESTHOST_WAVRECORDER_H_INCLUDED #include /** Thin wrapper over WavAudioFormat/AudioFormatWriter. Only active once start() has been called with a destination file - a pure performance run has no reason to pay for disk I/O. */ class WavRecorder { public: WavRecorder(); ~WavRecorder(); /** Channel count comes from whatever the plugin under test actually reports (PluginHost::getNumOutputChannels()) - never assumed. */ bool start (const File &destFile, double sampleRate, int numChannels); bool isRecording() const { return writer != nullptr; } /** Writes numSamples samples from buffer's first numChannels channels. */ void write (const AudioSampleBuffer &buffer, int numSamples); /** Flushes and finalises the file. Also happens automatically on destruction. */ void stop(); private: ScopedPointer writer; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavRecorder) }; #endif // TESTHOST_WAVRECORDER_H_INCLUDED