-
Notifications
You must be signed in to change notification settings - Fork 1
/
fileEditor_audioGraph.cpp
66 lines (48 loc) · 1.48 KB
/
fileEditor_audioGraph.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
59
60
61
62
63
64
65
66
#include "audioGraphManager.h"
#include "audioUpdateHandler.h"
#include "audioVoiceManager.h"
#include "fileEditor_audioGraph.h"
#include "graphEdit.h"
#include "Debugging.h"
FileEditor_AudioGraph::FileEditor_AudioGraph(const char * path)
: audioGraphMgr(defaultSx, defaultSy)
{
// init audio graph
audioMutex.init();
audioVoiceMgr.init(&audioMutex, 64);
audioVoiceMgr.outputStereo = true;
audioGraphMgr.init(&audioMutex, &audioVoiceMgr);
// init audio output
audioUpdateHandler.init(&audioMutex, &audioVoiceMgr, &audioGraphMgr);
paObject.init(44100, 2, 0, 256, &audioUpdateHandler);
// create instance
instance = audioGraphMgr.createInstance(path);
audioGraphMgr.selectInstance(instance);
}
FileEditor_AudioGraph::~FileEditor_AudioGraph()
{
// free instance
audioGraphMgr.free(instance, false);
Assert(instance == nullptr);
// shut audio output
paObject.shut();
audioUpdateHandler.shut();
// shut audio graph
audioGraphMgr.shut();
audioVoiceMgr.shut();
audioMutex.shut();
}
void FileEditor_AudioGraph::tick(const int sx, const int sy, const float dt, const bool hasFocus, bool & inputIsCaptured)
{
// update real-time editing
inputIsCaptured |= audioGraphMgr.tickEditor(sx, sy, dt, inputIsCaptured);
// tick audio graph
audioGraphMgr.tickMain();
// draw ?
if (hasFocus == false && audioGraphMgr.selectedFile->graphEdit->animationIsDone)
return;
// draw
clearSurface(0, 0, 0, 0);
// update visualizers and draw editor
audioGraphMgr.drawEditor(sx, sy);
}