To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / CollidoscopeApp / include / Messages.h @ 2:dd889fff8423

History | View | Annotate | Download (1.3 KB)

1
#pragma once
2

    
3

    
4
enum class Command {
5
    // message carrying info about one chunk of recorder audio. 
6
    WAVE_CHUNK,
7
    // message sent when a new recording starts. The gui resets the wave upon receiving it. 
8
    WAVE_START,
9

    
10
    TRIGGER_UPDATE,
11
    TRIGGER_END,
12

    
13
    NOTE_ON,
14
    NOTE_OFF,
15

    
16
    LOOP_ON,
17
    LOOP_OFF
18
};
19

    
20
/* Messages sent from the audio thread to the graphic wave. 
21
   This includes the wave chunks when the audio is recorder in the buffer and 
22
   the cursor position when the grains are reset.
23
*/
24
struct RecordWaveMsg
25
{
26
    Command cmd;
27
    std::size_t index;
28
    float arg1;
29
    float arg2;
30
};
31

    
32

    
33
inline RecordWaveMsg makeRecordWaveMsg( Command cmd, std::size_t index, float arg1, float arg2 )
34
{
35
    RecordWaveMsg msg;
36
    msg.cmd = cmd;
37
    msg.index = index;
38
    msg.arg1 = arg1;
39
    msg.arg2 = arg2;
40

    
41
    return msg;
42
}
43

    
44

    
45
struct CursorTriggerMsg
46
{
47
    Command cmd;
48
    int synthID;
49
};
50

    
51
inline CursorTriggerMsg makeCursorTriggerMsg( Command cmd, std::uint8_t synthID )
52
{
53
    CursorTriggerMsg msg;
54

    
55
    msg.cmd = cmd;
56
    msg.synthID = synthID;
57

    
58
    return msg;
59
}
60

    
61
struct NoteMsg
62
{
63
    Command cmd;
64
    int midiNote;
65
    double rate;
66
};
67

    
68
inline NoteMsg makeNoteMsg( Command cmd, int midiNote, double rate )
69
{
70
    NoteMsg msg;
71

    
72
    msg.cmd = cmd;
73
    msg.midiNote = midiNote;
74
    msg.rate = rate;
75

    
76
    return msg;
77
}