-
Notifications
You must be signed in to change notification settings - Fork 0
/
MidiTrack.hpp
64 lines (52 loc) · 1.57 KB
/
MidiTrack.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef INC_MIDITRACK_H
#define INC_MIDITRACK_H
#include "MidiClip.hpp"
#include "Track.hpp"
#include <cereal/types/vector.hpp>
//#include <cereal/archives/binary.hpp>
#include <cereal/archives/xml.hpp>
#include <cereal/types/polymorphic.hpp>
class MidiTrack : public Track
{
public:
// Constructor
MidiTrack (std::string name);
MidiTrack (std::string, float, std::vector<std::shared_ptr<MidiClip>>);
// Destructor
~MidiTrack ();
void addClip (std::string, int);
void addClip (std::shared_ptr<Clip> clip);
void addClip (std::shared_ptr<MidiClip> clip);
void deleteClip (unsigned int i);
inline std::shared_ptr<Clip> getClip (unsigned int i) const { return clipset_.at(i); }
inline unsigned int nClips () const { return clipset_.size(); }
void tick ();
void stopAll ();
//inline std::vector<std::shared_ptr<MidiClip>> * getClipSet () { return clipset_; }
inline RtMidiOut * getOutput () const { return output_; }
inline void setOutput (RtMidiOut * o) { output_ = o; }
template<class Archive>
void serialize(Archive & archive)
{
archive (
CEREAL_NVP(name_),
CEREAL_NVP(hue_),
CEREAL_NVP(clipset_)
);
}
template <class Archive>
static void load_and_construct( Archive & archive, cereal::construct<MidiTrack> & construct )
{
std::string name;
float hue;
std::vector<std::shared_ptr<MidiClip>> clipset;
archive( name, hue, clipset );
construct( name, hue, clipset );
}
private:
std::vector<std::shared_ptr<MidiClip>> clipset_;
RtMidiOut * output_;
};
CEREAL_REGISTER_TYPE (MidiTrack)
CEREAL_REGISTER_POLYMORPHIC_RELATION (Track, MidiTrack)
#endif