hydrogen 1.2.3
MidiCommon.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23#ifndef H2_MIDI_COMMON_H
24#define H2_MIDI_COMMON_H
25
26#include <core/config.h>
27#include <core/Object.h>
28#include <string>
29#include <vector>
30
31#include <QString>
32
33namespace H2Core
34{
35
38{
39public:
62 static QString TypeToQString( MidiMessageType type );
63
66 enum class Event {
67 Null,
68 Note,
69 CC,
70 PC,
71 MmcStop,
72 MmcPlay,
80 };
81 static QString EventToQString( Event event );
82 static Event QStringToEvent( const QString& sEvent );
85 static QStringList getEventList();
86
91 std::vector<unsigned char> m_sysexData;
92
94 : m_type( UNKNOWN )
95 , m_nData1( -1 )
96 , m_nData2( -1 )
97 , m_nChannel( -1 ) {}
98
100 void clear();
101
108 void setType( int nStatusByte );
109
118 QString toQString( const QString& sPrefix = "", bool bShort = true ) const;
119};
120};
121
122#endif
123
Basic building block for the communication between the core of Hydrogen and its GUI.
Definition EventQueue.h:186
MidiMessageType m_type
Definition MidiCommon.h:87
QString toQString(const QString &sPrefix="", bool bShort=true) const
Formatted string version for debugging purposes.
static QStringList getEventList()
Retrieve the string representation for all available Event.
Event
Subset of incoming MIDI events that will be handled by Hydrogen.
Definition MidiCommon.h:66
void setType(int nStatusByte)
Derives and set m_type (and if applicable m_nChannel) using the statusByte of an incoming MIDI messag...
static QString TypeToQString(MidiMessageType type)
MidiMessageType
All possible types of incoming MIDI messages.
Definition MidiCommon.h:41
std::vector< unsigned char > m_sysexData
Definition MidiCommon.h:91
static QString EventToQString(Event event)
void clear()
Reset message.
static Event QStringToEvent(const QString &sEvent)