Mercurial > hg > svcore
annotate data/midi/MIDIInput.h @ 1359:1c9bbbb6116a 3.0-integration
Use W64 instead of WAV for decoded files; use Ogg reader in preference to WAV one for Ogg files (WAV reader works, via libsndfile, but doesn't load metadata); fix Ogg reader to use QFile open instead of non-Win32-compatible API; add more encoder tests, audio writer test, midi reader test
author | Chris Cannam |
---|---|
date | Tue, 10 Jan 2017 10:58:25 +0000 |
parents | 59e7fe1b1003 |
children | ad5f892c0c4d |
rev | line source |
---|---|
Chris@559 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@559 | 2 |
Chris@559 | 3 /* |
Chris@559 | 4 Sonic Visualiser |
Chris@559 | 5 An audio file viewer and annotation editor. |
Chris@559 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@559 | 7 This file copyright 2006-2009 Chris Cannam and QMUL. |
Chris@559 | 8 |
Chris@559 | 9 This program is free software; you can redistribute it and/or |
Chris@559 | 10 modify it under the terms of the GNU General Public License as |
Chris@559 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@559 | 12 License, or (at your option) any later version. See the file |
Chris@559 | 13 COPYING included with this distribution for more information. |
Chris@559 | 14 */ |
Chris@559 | 15 |
Chris@559 | 16 #ifndef _MIDI_INPUT_H_ |
Chris@559 | 17 #define _MIDI_INPUT_H_ |
Chris@559 | 18 |
Chris@559 | 19 #include <QObject> |
Chris@559 | 20 #include "MIDIEvent.h" |
Chris@559 | 21 |
Chris@560 | 22 #include <vector> |
Chris@560 | 23 #include "base/RingBuffer.h" |
Chris@567 | 24 #include "base/FrameTimer.h" |
Chris@560 | 25 |
Chris@561 | 26 class RtMidiIn; |
Chris@559 | 27 |
Chris@559 | 28 class MIDIInput : public QObject |
Chris@559 | 29 { |
Chris@559 | 30 Q_OBJECT |
Chris@559 | 31 |
Chris@559 | 32 public: |
Chris@567 | 33 MIDIInput(QString name, FrameTimer *timer); |
Chris@559 | 34 virtual ~MIDIInput(); |
Chris@559 | 35 |
Chris@561 | 36 bool isOK() const { return m_rtmidi != 0; } |
Chris@559 | 37 |
Chris@559 | 38 bool isEmpty() const { return getEventsAvailable() == 0; } |
Chris@929 | 39 int getEventsAvailable() const { return m_buffer.getReadSpace(); } |
Chris@559 | 40 MIDIEvent readEvent(); |
Chris@559 | 41 |
Chris@559 | 42 signals: |
Chris@559 | 43 void eventsAvailable(); |
Chris@559 | 44 |
Chris@559 | 45 protected: |
Chris@561 | 46 RtMidiIn *m_rtmidi; |
Chris@567 | 47 FrameTimer *m_frameTimer; |
Chris@559 | 48 |
Chris@561 | 49 static void staticCallback(double, std::vector<unsigned char> *, void *); |
Chris@559 | 50 void callback(double, std::vector<unsigned char> *); |
Chris@559 | 51 |
Chris@559 | 52 void postEvent(MIDIEvent); |
Chris@559 | 53 RingBuffer<MIDIEvent *> m_buffer; |
Chris@559 | 54 }; |
Chris@559 | 55 |
Chris@559 | 56 #endif |
Chris@559 | 57 |