n2xdevice.h (1202B)
1 #pragma once 2 3 #include "n2xhardware.h" 4 #include "n2xstate.h" 5 6 #include "wLib/wDevice.h" 7 8 namespace n2x 9 { 10 class Hardware; 11 12 class Device : public synthLib::Device 13 { 14 public: 15 Device(const synthLib::DeviceCreateParams& _params); 16 17 float getSamplerate() const override; 18 bool isValid() const override; 19 bool getState(std::vector<uint8_t>& _state, synthLib::StateType _type) override; 20 bool setState(const std::vector<uint8_t>& _state, synthLib::StateType _type) override; 21 uint32_t getChannelCountIn() override; 22 uint32_t getChannelCountOut() override; 23 bool setDspClockPercent(uint32_t _percent) override; 24 uint32_t getDspClockPercent() const override; 25 uint64_t getDspClockHz() const override; 26 27 protected: 28 void readMidiOut(std::vector<synthLib::SMidiEvent>& _midiOut) override; 29 void processAudio(const synthLib::TAudioInputs& _inputs, const synthLib::TAudioOutputs& _outputs, size_t _samples) override; 30 bool sendMidi(const synthLib::SMidiEvent& _ev, std::vector<synthLib::SMidiEvent>& _response) override; 31 32 private: 33 Hardware m_hardware; 34 State m_state; 35 std::vector<uint8_t> m_midiOutBuffer; 36 synthLib::MidiBufferParser m_midiParser; 37 uint32_t m_numSamplesProcessed = 0; 38 }; 39 }