1 |
senkov |
170 |
/*************************************************************************** |
2 |
|
|
* * |
3 |
|
|
* LinuxSampler - modular, streaming capable sampler * |
4 |
|
|
* * |
5 |
|
|
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
schoenebeck |
880 |
* Copyright (C) 2005, 2006 Christian Schoenebeck * |
7 |
senkov |
170 |
* * |
8 |
|
|
* This program is free software; you can redistribute it and/or modify * |
9 |
|
|
* it under the terms of the GNU General Public License as published by * |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or * |
11 |
|
|
* (at your option) any later version. * |
12 |
|
|
* * |
13 |
|
|
* This program is distributed in the hope that it will be useful, * |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
16 |
|
|
* GNU General Public License for more details. * |
17 |
|
|
* * |
18 |
|
|
* You should have received a copy of the GNU General Public License * |
19 |
|
|
* along with this program; if not, write to the Free Software * |
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * |
21 |
|
|
* MA 02111-1307 USA * |
22 |
|
|
***************************************************************************/ |
23 |
|
|
|
24 |
|
|
#ifndef __LSCPEVENT_H_ |
25 |
|
|
#define __LSCPEVENT_H_ |
26 |
|
|
#include <iostream> |
27 |
|
|
#include <sstream> |
28 |
|
|
#include <string> |
29 |
|
|
#include <list> |
30 |
|
|
#include "../Sampler.h" |
31 |
|
|
#include "../common/global.h" |
32 |
schoenebeck |
880 |
#include "../common/Exception.h" |
33 |
senkov |
170 |
|
34 |
|
|
using namespace LinuxSampler; |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* Helper class for producing result sets |
39 |
|
|
*/ |
40 |
|
|
class LSCPEvent { |
41 |
|
|
public: |
42 |
|
|
/** |
43 |
|
|
* Event types |
44 |
|
|
**/ |
45 |
|
|
enum event_t { |
46 |
iliev |
981 |
event_audio_device_count, |
47 |
|
|
event_audio_device_info, |
48 |
|
|
event_midi_device_count, |
49 |
|
|
event_midi_device_info, |
50 |
schoenebeck |
556 |
event_channel_count, |
51 |
senkov |
170 |
event_voice_count, |
52 |
|
|
event_stream_count, |
53 |
|
|
event_buffer_fill, |
54 |
schoenebeck |
556 |
event_channel_info, |
55 |
iliev |
981 |
event_midi_instr_map_count, |
56 |
|
|
event_midi_instr_map_info, |
57 |
|
|
event_midi_instr_count, |
58 |
|
|
event_midi_instr_info, |
59 |
iliev |
778 |
event_misc, |
60 |
iliev |
981 |
event_total_voice_count |
61 |
senkov |
170 |
}; |
62 |
|
|
|
63 |
|
|
/* This constructor will do type lookup based on name |
64 |
|
|
**/ |
65 |
schoenebeck |
880 |
LSCPEvent(String eventName) throw (Exception); |
66 |
senkov |
170 |
|
67 |
|
|
/* These constructors are used to create event and fill it with data for sending |
68 |
|
|
* These will be used by the thread that wants to send an event to all clients |
69 |
|
|
* that are subscribed to it |
70 |
|
|
**/ |
71 |
|
|
LSCPEvent(event_t eventType, int uiData); |
72 |
|
|
LSCPEvent(event_t eventType, String sData); |
73 |
|
|
LSCPEvent(event_t eventType, int uiData1, int uiData2); |
74 |
|
|
LSCPEvent(event_t eventType, String sData, int uiData); |
75 |
|
|
LSCPEvent(event_t eventType, int uiData, String sData); |
76 |
iliev |
981 |
LSCPEvent(event_t eventType, int uiData1, int uiData2, int uiData3); |
77 |
senkov |
170 |
String Produce( void ); |
78 |
|
|
|
79 |
|
|
/* Returns event type */ |
80 |
|
|
event_t GetType( void ) { return type; } |
81 |
|
|
|
82 |
|
|
/* These methods are used to registed and unregister an event */ |
83 |
|
|
static void RegisterEvent(event_t eventType, String EventName); |
84 |
|
|
static void UnregisterEvent(event_t eventType); |
85 |
|
|
|
86 |
|
|
/* This method returns a name for events of a given type */ |
87 |
|
|
static String Name(event_t eventType); |
88 |
|
|
|
89 |
|
|
/* This method returs a list of all event types registered */ |
90 |
|
|
static std::list<event_t> List( void ); |
91 |
|
|
|
92 |
|
|
private: |
93 |
|
|
String storage; |
94 |
|
|
event_t type; |
95 |
|
|
|
96 |
|
|
static std::map<event_t, String> EventNames; |
97 |
|
|
}; |
98 |
|
|
|
99 |
|
|
#endif // __LSCPEVENT_H_ |