forked from osoumen/C700
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicVoiceManager.h
More file actions
61 lines (54 loc) · 1.65 KB
/
DynamicVoiceManager.h
File metadata and controls
61 lines (54 loc) · 1.65 KB
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
//
// DynamicVoiceManager.h
// C700
//
// Created by osoumen on 2014/11/30.
//
//
#ifndef __C700__DynamicVoiceManager__
#define __C700__DynamicVoiceManager__
#include <iostream>
#include <list>
class DynamicVoiceManager
{
public:
enum VoiceAllocMode {
ALLOC_MODE_OLDEST = 0,
ALLOC_MODE_SAMECH
};
DynamicVoiceManager();
~DynamicVoiceManager();
void Initialize(int voiceLimit);
void Reset();
void ChangeVoiceLimit(int voiceLimit);
void SetVoiceAllocMode(VoiceAllocMode mode);
int GetVoiceLimit() { return mVoiceLimit; }
int AllocVoice(int prio, int ch, int uniqueID, bool monoMode,
int *releasedCh, bool *isLegato);
int ReleaseVoice(int relPrio, int ch, int uniqueID, int *relVo);
bool IsPlayingVoice(int v);
void SetChLimit(int ch, int value);
int GetChLimit(int ch);
int GetNoteOns(int ch);
int GetVoiceMidiCh(int vo) { return mVoCh[vo]; }
int GetVoiceUniqueID(int vo) { return mVoUniqueID[vo]; }
void SetKeyOn(int vo);
bool IsKeyOn(int vo);
private:
static const int MAX_VOICE = 16;
std::list<int> mPlayVo; //ノートオン状態のボイス
std::list<int> mWaitVo; //ノートオフ状態のボイス
int mVoCh[MAX_VOICE];
int mVoPrio[MAX_VOICE];
int mVoUniqueID[MAX_VOICE];
bool mVoKeyOn[MAX_VOICE];
int mVoiceLimit;
int mChNoteOns[16];
int mChLimit[16];
VoiceAllocMode mAllocMode;
void pushWaitVo(int vo);
int findFreeVoice();
int stealVoice(int ch);
int findVoice(int ch=-1);
};
#endif /* defined(__C700__DynamicVoiceManager__) */