/* 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_MACHINEBUILDER_HPP #define MACHINA_MACHINEBUILDER_HPP #include #include #include "machina/types.hpp" #include "raul/TimeStamp.hpp" namespace Machina { class Machine; class Node; class MachineBuilder { public: MachineBuilder(SPtr machine, double quantization, bool step); void set_time(Raul::TimeStamp time) { _time = time; } void event(Raul::TimeStamp time_offset, size_t size, unsigned char* buf); void reset(); void resolve(); SPtr finish(); private: bool is_delay_node(SPtr node) const; void set_node_duration(SPtr node, Raul::TimeDuration d) const; void note_on(Raul::TimeStamp t, size_t ev_size, uint8_t* buf); void resolve_note(Raul::TimeStamp t, size_t ev_size, uint8_t* buf, SPtr resolved); SPtrconnect_nodes(SPtr m, SPtr tail, Raul::TimeStamp tail_end_time, SPtr head, Raul::TimeStamp head_start_time); typedef std::list > ActiveList; ActiveList _active_nodes; typedef std::list > > PolyList; PolyList _poly_nodes; double _quantization; Raul::TimeStamp _time; SPtr _machine; SPtr _initial_node; SPtr _connect_node; Raul::TimeStamp _connect_node_end_time; bool _step; }; } // namespace Machina #endif // MACHINA_MACHINEBUILDER_HPP