1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| #include <QApplication>
#include <QtGui>
#include "ui_FenBeep.h"
#include "FenBeep.h"
#include <windows.h>
#include <cstdlib>
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
#include <map>
int NOTES[12][9] =
{
{16, 33, 65, 131, 262, 523, 1046, 2093, 4186},
{17, 35, 69, 139, 277, 554, 1109, 2217, 4435},
{18, 37, 73, 147, 294, 587, 1175, 2349, 4699},
{19, 39, 78, 155, 311, 622, 1244, 2489, 4978},
{21, 41, 82, 165, 330, 659, 1328, 2637, 5274},
{22, 44, 87, 175, 349, 698, 1397, 2794, 5588},
{23, 46, 92, 185, 370, 740, 1480, 2960, 5920},
{24, 49, 98, 196, 392, 784, 1568, 3136, 6271},
{26, 52, 104, 208, 415, 831, 1661, 3322, 6645},
{27, 55, 110, 220, 440, 880, 1760, 3520, 7040},
{29, 58, 116, 233, 466, 932, 1865, 3729, 7459},
{31, 62, 123, 245, 494, 988, 1975, 3951, 7902}
};
enum
{
SILENCE = -1,
DO = 0,
DO_ = 1,
RE = 2,
RE_ = 3,
MI = 4,
FA = 5,
FA_ = 6,
SOL = 7,
SOL_ = 8,
LA = 9,
LA_ = 10,
SI = 11
};
enum
{
OCTAVE_0 = 0,
OCTAVE_1 = 1,
OCTAVE_2 = 2,
OCTAVE_3 = 3,
OCTAVE_4 = 4,
OCTAVE_5 = 5,
OCTAVE_6 = 6,
OCTAVE_7 = 7,
OCTAVE_8 = 8,
};
std::map<std::string, int> noteMap;
// Global variables
int TEMPO = 250;
int DURATION=TEMPO;
int OCTAVE = 0;
//la fonction readFile(filename) se trouvait ici auparavant.
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
noteMap["DO"] = DO;
noteMap["DO_"] = DO_;
noteMap["RE"] = RE;
noteMap["RE_"] = RE_;
noteMap["MI"] = MI;
noteMap["FA"] = FA;
noteMap["FA_"] = FA_;
noteMap["SOL"] = SOL;
noteMap["SOL_"] = SOL_;
noteMap["LA"] = LA;
noteMap["LA_"] = LA_;
noteMap["SI"] = SI;
noteMap["_"] = SILENCE;
FenBeep fenetre;
fenetre.show();
return app.exec();
} |
Partager