-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.cs
45 lines (45 loc) · 1.34 KB
/
common.cs
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
namespace Synthizer
{
public class SynthizerObject
{
internal ulong handle;
internal SynthizerObject(ulong handle)
{
this.handle = handle;
}
public void Destroy()
{
synthizer.CHECKED(synthizer.syz_handleDecRef(handle));
}
public ulong GetHandle()
{
return handle;
}
public void ConfigDeleteBehavior(bool linger, double lingerTimeout)
{
syz_DeleteBehaviorConfig cfg = new();
cfg.linger = linger ? 1 : 0;
cfg.lingerTimeout = lingerTimeout;
synthizer.syz_initDeleteBehaviorConfig(ref cfg);
synthizer.CHECKED(synthizer.syz_configDeleteBehavior(handle, ref cfg));
}
}
public class Pausable : SynthizerObject
{
public DoubleProperty CurrentTime;
public DoubleProperty SuggestedAutomationTime;
internal Pausable(ulong handle) : base(handle)
{
CurrentTime = new(this, Properties.currentTime);
SuggestedAutomationTime = new(this, Properties.SuggestedAutomationTime);
}
public void Play()
{
synthizer.CHECKED(synthizer.syz_play(GetHandle()));
}
public void Pause()
{
synthizer.CHECKED(synthizer.syz_pause(GetHandle()));
}
}
}