-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSNFX.cpp
58 lines (47 loc) · 1.11 KB
/
SNFX.cpp
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
#include "SNFX.h"
#include "ui_SNFX.h"
#include "envelope.h"
#include <QMdiSubWindow>
#include "patterneditorview.h"
#include <QSpinBox>
#include <QSizePolicy>
#include <QHBoxLayout>
SNFX::SNFX(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::SNFX)
{
ui->setupUi(this);
AEngine = new CAudioEngine();
Envelope *e = new Envelope(this);
ui->mdiArea->addSubWindow(e);
CPatternEditorView *peView = new CPatternEditorView(this);
peView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QMdiSubWindow *mywnd = ui->mdiArea->addSubWindow(peView);
QSpinBox *spinBPM = new QSpinBox(this);
spinBPM->setRange(1, 500);
spinBPM->setValue(120);
ui->toolBar->addWidget(spinBPM);
}
SNFX::~SNFX()
{
delete AEngine;
delete ui;
}
void SNFX::playNote(QString note, int octave, int channel)
{
channel = 2; // remove
AEngine->setNote(channel, note, octave);
AEngine->noteOn();
}
void SNFX::stopNote()
{
AEngine->noteOff();
}
void SNFX::on_actionPlay_triggered()
{
AEngine->playSong();
}
void SNFX::on_actionStop_triggered()
{
AEngine->stopSong();
}