MCPcopy Create free account
hub / github.com/DamRsn/NeuralNote / SourceAudioManager

Class SourceAudioManager

NeuralNote/Source/SourceAudioManager.h:15–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13class NeuralNoteAudioProcessor;
14
15class SourceAudioManager : public ValueTree::Listener
16{
17public:
18 explicit SourceAudioManager(NeuralNoteAudioProcessor* inProcessor);
19
20 ~SourceAudioManager() override;
21
22 /**
23 * PrepareToPlay
24 * @param inSampleRate Audio sample rate
25 * @param inSamplesPerBlock Number of samples per block
26 */
27 void prepareToPlay(double inSampleRate, int inSamplesPerBlock);
28
29 /**
30 * Function to call in NeuralNote audio processor. Will handle recording if needed.
31 * @param inBuffer Input audio buffer
32 */
33 void processBlock(const AudioBuffer<float>& inBuffer);
34
35 /**
36 * Function to call when start record button is clicked.
37 * Will prepare everything needed to record and the recording will start in the next processBlock
38 */
39 void startRecording();
40
41 /**
42 * Function to call when stop record button is clicked.
43 * Will stop properly the recording and then launch the transcription.
44 */
45 void stopRecording();
46
47 /**
48 * Function to call when a file is dropped on the audio region to load it.
49 * @param inFile Audio file to load
50 * @return Whether audio file load was successful
51 */
52 bool onFileDrop(const File& inFile);
53
54 /**
55 * Stop recording if needed and then reset/clear everything owned by this class.
56 */
57 void clear();
58
59 /**
60 * To call only when the recording/file loading is fully completed, otherwise you'll get and empty buffer.
61 * @return A reference to the downsampled source audio.
62 */
63 AudioBuffer<float>& getDownsampledSourceAudioForTranscription();
64
65 /**
66 * Get source audio at current processor sample rate.
67 * @return Reference to source audio buffer (recorded or loaded from file).
68 */
69 AudioBuffer<float>& getSourceAudioForPlayback();
70
71 /**
72 * Return a string containing the filename of the dropped audio file.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected