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