1 /* 2 SMF GUI Player test using the MIDI Sequencer C++ library 3 Copyright (C) 2006-2021, Pedro Lopez-Cabanillas <plcl@users.sf.net> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef INCLUDED_PLAYER_H 20 #define INCLUDED_PLAYER_H 21 22 #include <drumstick/playthread.h> 23 #include "song.h" 24 25 class Player : public drumstick::ALSA::SequencerOutputThread 26 { 27 Q_OBJECT 28 29 public: 30 Player(drumstick::ALSA::MidiClient *seq, int portId); 31 virtual ~Player(); 32 virtual bool hasNext() override; 33 virtual drumstick::ALSA::SequencerEvent* nextEvent() override; 34 virtual unsigned int getInitialPosition() override; 35 virtual unsigned int getEchoResolution() override; 36 37 unsigned int getPitchShift(); 38 unsigned int getVolumeFactor(); 39 void setSong(Song* s); 40 void resetPosition(); 41 void setPosition(unsigned int pos); 42 void setPitchShift(unsigned int pitch); 43 void setVolumeFactor(unsigned int vol); 44 void sendController(int chan, int control, int value); 45 void allNotesOff(); 46 void sendVolumeEvents(); 47 48 private: 49 Song* m_song; 50 SongIterator* m_songIterator; 51 drumstick::ALSA::SequencerEvent* m_lastEvent; 52 unsigned int m_songPosition; 53 unsigned int m_echoResolution; 54 unsigned int m_pitchShift; 55 unsigned int m_volumeFactor; 56 int m_volume[MIDI_CHANNELS]; 57 }; 58 59 #endif /*INCLUDED_PLAYER_H*/ 60