]> code.delx.au - virtualtones/blob - stringinstrument.h
Few polish fixes
[virtualtones] / stringinstrument.h
1 // stringinstrument.h - A stringed instrument simulator
2 // Written by James Bunton <james@delx.cjb.net>
3 // Licensed under the GPL, see COPYING.txt for more details
4
5
6 #ifndef STRINGINSTRUMENT_H
7 #define STRINGINSTRUMENT_H
8
9 #include <qwidget.h>
10 #include <qpixmap.h>
11 #include <qpainter.h>
12 #include <qtimer.h>
13
14 #include "instrument.h"
15
16
17
18 class StringInstrument : public Instrument
19 {
20 Q_OBJECT
21 public:
22 StringInstrument(QWidget *parent);
23 ~StringInstrument();
24
25 private slots:
26 void emitSounds();
27
28 protected:
29 QString generateHelp();
30 void paintEvent(QPaintEvent *);
31 void keyPressEvent(QKeyEvent *);
32 void keyReleaseEvent(QKeyEvent *);
33
34
35 void zeroArray(bool array[4][4]);
36 void zeroArray(bool array[4]);
37 void zeroArray(int array[4]);
38 virtual void setNotes(int array[4])=0; // Set the base string notes
39 void copyArray(int source[4], int dest[4]);
40
41 // Keys
42 bool down[4][4];
43 // down[1][3] == true, means that when the D string is bowed, G will be played
44 // First dimension is the string, second is the modifier
45 bool downFudge[4];
46 // Fudge keys. They're at the beginning of each string and do not play a note by themself
47 // downFudge[0] is '~', [1] is tab, etc.. They allow access to sharps
48
49 bool bow[4][4];
50 // bow[1][4] == true means that the D string will be bowed at the highest volume
51 // First dimension is the string to be bowed, second is the volume
52
53 int stringnote[4];
54 // Base notes for each string
55
56
57 // The volumes and notes to play for each string
58 int oldVolume[4];
59 int oldNote[4];
60 int volume[4];
61 int note[4];
62 };
63
64
65 class ViolinInstrument : public StringInstrument
66 {
67 public:
68 ViolinInstrument(QWidget *parent);
69 ~ViolinInstrument() {};
70 protected:
71 void setNotes(int array[4]);
72 };
73
74
75 class ViolaInstrument : public StringInstrument
76 {
77 public:
78 ViolaInstrument(QWidget *parent);
79 ~ViolaInstrument() {};
80 protected:
81 void setNotes(int array[4]);
82 };
83
84
85 class CelloInstrument : public StringInstrument
86 {
87 public:
88 CelloInstrument(QWidget *parent);
89 ~CelloInstrument() {};
90 protected:
91 void setNotes(int array[4]);
92 };
93
94
95 class ContrabassInstrument : public StringInstrument
96 {
97 public:
98 ContrabassInstrument(QWidget *parent);
99 ~ContrabassInstrument() {};
100 protected:
101 void setNotes(int array[4]);
102 };
103
104
105
106 #endif