| 13 | class NeuralNoteAudioProcessor; |
| 14 | |
| 15 | class Player : public ValueTree::Listener |
| 16 | { |
| 17 | public: |
| 18 | explicit Player(NeuralNoteAudioProcessor* inProcessor); |
| 19 | |
| 20 | ~Player() override; |
| 21 | |
| 22 | void prepareToPlay(double inSampleRate, int inSamplesPerBlock); |
| 23 | |
| 24 | void processBlock(AudioBuffer<float>& inAudioBuffer, MidiBuffer& outMidiBuffer); |
| 25 | |
| 26 | bool isPlaying() const; |
| 27 | |
| 28 | void setPlayingState(bool inIsPlaying); |
| 29 | |
| 30 | void reset(); |
| 31 | |
| 32 | /** |
| 33 | * Sets the new playhead position (in seconds). |
| 34 | * Nothing is performed if inNewPosition is out of bounds (less than 0 or larger than audio length available) |
| 35 | * @param inNewPosition New playhead position in seconds |
| 36 | */ |
| 37 | void setPlayheadPositionSeconds(double inNewPosition); |
| 38 | |
| 39 | double getPlayheadPositionSeconds() const; |
| 40 | |
| 41 | SynthController* getSynthController() const; |
| 42 | |
| 43 | void saveStateToValueTree(); |
| 44 | |
| 45 | static constexpr int NUM_VOICES_SYNTH = 16; |
| 46 | |
| 47 | private: |
| 48 | void valueTreePropertyChanged(ValueTree& treeWhosePropertyHasChanged, const Identifier& property) override; |
| 49 | |
| 50 | void _setGains(float inGainAudioSourceDB, float inGainSynthDB); |
| 51 | |
| 52 | void _clearActiveNotesMidiOut(MidiBuffer& outMidiBuffer); |
| 53 | |
| 54 | std::atomic<bool> mIsPlaying = false; |
| 55 | bool mWasPlaying = false; |
| 56 | NeuralNoteAudioProcessor* mProcessor; |
| 57 | |
| 58 | std::unique_ptr<SynthController> mSynthController; |
| 59 | std::unique_ptr<MPESynthesiser> mSynth; |
| 60 | |
| 61 | AudioBuffer<float> mInternalBuffer; |
| 62 | |
| 63 | double mPlayheadTime = 0; |
| 64 | double mSampleRate = 44100; |
| 65 | |
| 66 | float mGainSourceAudio = 0; |
| 67 | float mGainSynth = 0; |
| 68 | |
| 69 | bool mShouldOutputMidi = false; |
| 70 | bool mWasOutputtingMidi = false; |
| 71 | |
| 72 | std::array<int, 128> mActiveNotesMidiOut {}; |
nothing calls this directly
no outgoing calls
no test coverage detected