/* This file is part of Machina. * Copyright 2007-2011 David Robillard * * Machina is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Machina is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Machina. If not, see . */ #ifndef MACHINA_DRIVER_HPP #define MACHINA_DRIVER_HPP #include #include "raul/RingBuffer.hpp" #include "machina/types.hpp" #include "MIDISink.hpp" namespace machina { class Machine; class Driver : public MIDISink { public: Driver(Raul::Forge& forge, SPtr machine) : _forge(forge) , _machine(machine) , _play_state(PlayState::STOPPED) {} enum class PlayState { STOPPED, PLAYING, RECORDING }; virtual ~Driver() {} SPtr machine() { return _machine; } virtual void set_machine(SPtr machine) { _machine = machine; } SPtr update_sink() { return _updates; } void set_update_sink(SPtr b) { _updates = b; } virtual void set_bpm(double bpm) = 0; virtual void set_quantization(double q) = 0; virtual void set_play_state(PlayState state) = 0; virtual bool is_activated() const { return false; } virtual void activate() {} virtual void deactivate() {} PlayState play_state() const { return _play_state.load(); } protected: Raul::Forge& _forge; SPtr _machine; SPtr _updates; std::atomic _play_state; }; } // namespace machina #endif // MACHINA_JACKDRIVER_HPP