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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
MIDI Sequencer C++ library
Copyright (C) 2006-2025, Pedro Lopez-Cabanillas <plcl@users.sf.net>
This library 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.
This library 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DRUMGRID_H
#define DRUMGRID_H
#include <QMainWindow>
#include <QShortcut>
#include <QCloseEvent>
namespace Ui
{
class DrumGrid;
}
namespace drumstick {
namespace ALSA {
class MidiClient;
class MidiPort;
class MidiQueue;
class SequencerEvent;
}}
class DrumGridModel;
class DrumGrid : public QMainWindow
{
Q_OBJECT
public:
explicit DrumGrid(QWidget *parent = nullptr);
~DrumGrid();
void subscribe(const QString& portName);
void addShortcut(const QKeySequence& key, const QString& value);
void readSettings();
void writeSettings();
void closeEvent( QCloseEvent *event ) override;
void metronome_start();
void metronome_stop();
void metronome_continue();
void sendControlChange(int cc, int value);
void sendInitialControls();
void metronome_set_controls();
void metronome_set_program();
void metronome_set_tempo();
void metronome_pattern(int tick);
void metronome_echo(int tick, int ev_type);
void metronome_note(int note, int vel, int tick);
void metronome_schedule_event(drumstick::ALSA::SequencerEvent* ev, int tick);
void metronome_event_output(drumstick::ALSA::SequencerEvent* ev);
int decodeVelocity(const QString drumVel);
static const QString QSTR_WINDOW;
static const QString QSTR_GEOMETRY;
static const QString QSTR_STATE;
static const QString QSTR_MIDI;
static const QString QSTR_CONNECTION;
static const QString QSTR_TEMPO;
static const QString QSTR_PATTERN;
static const int TEMPO_MIN;
static const int TEMPO_MAX;
static const int TEMPO_DEFAULT;
static const int NOTE_DURATION;
static const int METRONOME_CHANNEL;
static const int METRONOME_VELOCITY;
static const int METRONOME_PROGRAM;
static const int METRONOME_RESOLUTION;
static const int METRONOME_VOLUME;
static const int METRONOME_PAN;
static const int VOLUME_CC;
static const int PAN_CC;
public Q_SLOTS:
void slotAbout();
void updateView();
void sequencerEvent(drumstick::ALSA::SequencerEvent *ev);
void connectMidi();
void play();
void stop();
void tempoChange(int newTempo);
void gridColumns(int columns);
void shortcutPressed(const QString& value);
void updateDisplay(int bar, int beat);
Q_SIGNALS:
void signalUpdate(int bar, int beat);
private:
Ui::DrumGrid *m_ui;
int m_clientId;
int m_portId;
int m_queueId;
unsigned long m_tick;
drumstick::ALSA::MidiClient* m_Client;
drumstick::ALSA::MidiPort* m_Port;
drumstick::ALSA::MidiQueue* m_Queue;
DrumGridModel* m_model;
QString m_subscription;
QVector<QShortcut*> m_shortcuts;
int m_bar;
int m_beat;
int m_weak_velocity;
int m_strong_velocity;
int m_program;
int m_channel;
int m_volume;
int m_pan;
int m_resolution;
int m_bpm;
int m_noteDuration;
int m_patternDuration;
bool m_autoconnect;
bool m_playing;
bool m_useNoteOff;
};
#endif // DRUMGRID_H
|