Debian Codegraph @

plugin/plugingizmo/midievent.h

raw
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /***************************************************************************
3 * midievent.h
4 *
5 * Sun Feb 7 15:09:01 CET 2016
6 * Copyright 2016 Bent Bisballe Nyeng
7 * [email protected]
8 ****************************************************************************/
9
10 /*
11 * This file is part of PluginGizmo.
12 *
13 * PluginGizmo is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PluginGizmo is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with PluginGizmo; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 */
27 #pragma once
28
29 #include <stdint.h>
30 #include <stdio.h>
31
32 #include <vector>
33
34 enum class MidiEventType
35 {
36 Unknown,
37 NoteOn,
38 NoteOff,
39 Aftertouch,
40 };
41
42 class MidiEvent
43 {
44 public:
45 MidiEvent() = default;
46 MidiEvent(int64_t time, const char* data, std::size_t size);
47
48 int64_t getTime() const;
49 const char* getData() const;
50 std::size_t getSize() const;
51
52 MidiEventType type{MidiEventType::Unknown};
53 int key{0};
54 int velocity{0};
55
56 private:
57 int64_t time;
58 std::vector<char> data;
59 };