|
Krotos Modules 3
|
The processing power of the KwidgetRecorder that performs the recording of the plugins output and writes it to a temp File in a temp directory. More...
#include <KwidgetProcessor_Recorder.h>
Public Types | |
| using | Parameters = Kwidget_Recorder::Parameters |
Public Member Functions | |
| KwidgetProcessor_Recorder (Kwidget &owner) | |
| ~KwidgetProcessor_Recorder () | |
| void | prepare (double sampleRate, int samplesPerBlock) override |
| void | process (AudioBuffer< float > &buffer) override |
| void | noteOn (int midiNoteNumber, float velocity, int) override |
| void | noteOff (float velocity) override |
| void | stopRecording () |
Public Member Functions inherited from krotos::KwidgetProcessor | |
| KwidgetProcessor (Kwidget &owner) | |
| ~KwidgetProcessor () override=default | |
| void | prepareToPlay (double, int) override final |
| void | processBlock (AudioBuffer< float > &buffer, MidiBuffer &) override final |
| virtual bool | isActive () |
| virtual void | noteCleared () |
| std::shared_ptr< KAttachment > | getAttachment (const String ¶mID) |
| int | getNumModulators () const |
| Modulator * | getModulator (int index) |
| const String & | getKwidgetType () const |
| const String & | getKwidgetID () const |
| void | updateAttachments () |
Private Member Functions | |
| bool | bufferIsSilent (AudioSampleBuffer &inputBuffer) |
| void | stop () |
| void | startRecording () |
| void | resetWriter () |
| void | run () override |
| void | updateReleaseTime () |
| Update the cached release time from the internal settings file. | |
Private Attributes | |
| volatile std::atomic< bool > | m_recording {false} |
| volatile std::atomic< bool > | m_stopRecordingRequest |
| volatile std::atomic< int > | m_inactiveFramesBeforeStop {0} |
| int | m_lastSamplesPerBlock {0} |
| int | m_postRollSamples {0} |
| int | m_tailFramesCounter {0} |
| bool | m_recordingPending {false} |
| File | m_writingFile |
| String | m_latestFileName |
| double | m_sampleRate {0.0} |
| TimeSliceThread | m_backgroundThread {getOwner().getKwidgetID() + "thread"} |
| std::unique_ptr< AudioFormatWriter::ThreadedWriter > | m_threadedWriter |
| CriticalSection | m_writerLock |
| std::atomic< AudioFormatWriter::ThreadedWriter * > | m_activeWriter {nullptr} |
| const int | NUM_BUFFER_SAMPLES {32768} |
| const int | NUM_BUFFER_CHANNELS {2} |
| Uuid | m_uniqueId |
| File | m_tempDir |
| const float | minus_infinity_dB = -100.0f |
| Kwidget_Recorder * | m_kwidgetRecorder |
Additional Inherited Members | |
Protected Member Functions inherited from krotos::KwidgetProcessor | |
| void | nextBlock (int numSamples) |
| void | nextSample () |
| void | addModulator (bool useAudioRate) |
| void | addParameterAttachments (std::vector< AttachmentInfo >) |
| void | addParameterCallback (const String ¶mID, std::function< void(float)> callback) |
| Kwidget & | getOwner () const |
The processing power of the KwidgetRecorder that performs the recording of the plugins output and writes it to a temp File in a temp directory.
This class is designed to perform the recording in a multithreaded way. It uses a JUCE::ThreadWriter object that provides a FIFO for an AudioFormatWriter, allowing you to push incoming data into a buffer which will be flushed to disk by a background thread.
It is written as a passive module responding to midi Messages from outside, namely note on and note off, global AutoPlay changes and Timers killing the recording process.
| krotos::KwidgetProcessor_Recorder::KwidgetProcessor_Recorder | ( | Kwidget & | owner | ) |
| krotos::KwidgetProcessor_Recorder::~KwidgetProcessor_Recorder | ( | ) |
|
private |
Returns whether the contents of the supplied buffer is silence - TODO: consider placing this into the AudioBuffer class
| inputBuffer | A reference to the AudioSampleBuffer which you want to test |
|
overridevirtual |
Override this method to process a note off event, if necessary.
| velocity | The relative velocity of the note event (between 0 and 1). |
Reimplemented from krotos::KwidgetProcessor.
|
overridevirtual |
Override this method to process a note on event, if necessary.
| midiNoteNumber | The integer value of the MIDI note. |
velocity The relative velocity of the note event (between 0 and 1). voiceIndex Optionally pass in a voice index, used ultimately to identify the voice associated with a playing note Defaults to -1 if unused
Reimplemented from krotos::KwidgetProcessor.
|
overridevirtual |
Override this method to inform your processor of the sample rate and maximum block size.
Implements krotos::KwidgetProcessor.
|
overridevirtual |
Override this method to process a buffer of audio.
Implements krotos::KwidgetProcessor.
|
private |
Clear pointer to m_activeWriter and reset threadedWriter.
|
overrideprivate |
|
private |
|
private |
Stop audio recording, and copy the writing file over to the temp file.
| void krotos::KwidgetProcessor_Recorder::stopRecording | ( | ) |
Start the thread which will stop the recording
|
private |
Update the cached release time from the internal settings file.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |