hydrogen 1.2.6
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-2025 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
81 static QString EventToQString( Event event );
82 static Event QStringToEvent( const QString& sEvent );
85 static QStringList getEventList();
86
91 static constexpr int instrumentOffset = 36;
92
97 std::vector<unsigned char> m_sysexData;
98
100 : m_type( UNKNOWN )
101 , m_nData1( -1 )
102 , m_nData2( -1 )
103 , m_nChannel( -1 ) {}
104
106 void clear();
107
114 void setType( int nStatusByte );
115
124 QString toQString( const QString& sPrefix = "", bool bShort = true ) const;
125};
126};
127
128#endif
129
Basic building block for the communication between the core of Hydrogen and its GUI.
Definition EventQueue.h:186
MidiMessageType m_type
Definition MidiCommon.h:93
static constexpr int instrumentOffset
When recording notes using MIDI NOTE_ON events this offset will be applied to the provided pitch in o...
Definition MidiCommon.h:91
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:97
static QString EventToQString(Event event)
void clear()
Reset message.
static Event QStringToEvent(const QString &sEvent)