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