]> code.delx.au - virtualtones/blob - instrument.h
Updated README and email addresses
[virtualtones] / instrument.h
1 // instrument.h - An instrument widget
2 // Written by James Bunton <james@delx.net.au>
3 // Licensed under the GPL, see COPYING.txt for more details
4
5
6 #ifndef INSTRUMENT_H
7 #define INSTRUMENT_H
8
9 #include <qwidget.h>
10 #include <qevent.h>
11 #include <qpixmap.h>
12 #include <qpainter.h>
13 #include <qmessagebox.h>
14
15
16 #if QT_VERSION < 300
17 #define setPaletteBackgroundPixmap setBackgroundPixmap
18 #endif
19
20
21 class Instrument : public QWidget
22 {
23 Q_OBJECT
24 public:
25 Instrument(QWidget *parent);
26 ~Instrument();
27
28 bool setNoteStart(int note);
29 int getNoteStart();
30
31 public slots:
32 void setStartOctave(int octave); // Middle C is in octave 5
33 void displayHelp();
34
35 protected:
36 virtual QString generateHelp()=0;
37 void focusOutEvent(QFocusEvent *);
38 bool event(QEvent *e);
39 QString midi2string(int num);
40 bool checkSharp(int num);
41 int noteStart;
42
43 private:
44 // The base midi notes
45 QString midnotes[12];
46
47 // Make the function pure virtual
48 virtual void emitSounds()=0;
49
50 signals:
51 void playNote(int, int, int); // Note number, volume, length
52 void stopNote(int); // Note number
53 };
54
55
56
57 #endif