xref: /haiku/headers/os/midi2/MidiRoster.h (revision 81f5654c124bf46fba0fd251f208e2d88d81e1ce)
1 
2 #ifndef _MIDI_ROSTER_H
3 #define _MIDI_ROSTER_H
4 
5 #include <Application.h>
6 #include <MidiEndpoint.h>
7 
8 enum BMidiOp
9 {
10 	B_MIDI_NO_OP,
11 	B_MIDI_REGISTERED,
12 	B_MIDI_UNREGISTERED,
13 	B_MIDI_CONNECTED,
14 	B_MIDI_DISCONNECTED,
15 	B_MIDI_CHANGED_NAME,
16 	B_MIDI_CHANGED_LATENCY,
17 	B_MIDI_CHANGED_PROPERTIES
18 };
19 
20 #define B_MIDI_EVENT 'MIDI'
21 
22 class BMidiProducer;
23 class BMidiConsumer;
24 
25 namespace BPrivate
26 {
27 	class BMidiRosterLooper;
28 	struct BMidiRosterKiller;
29 }
30 
31 class BMidiRoster
32 {
33 public:
34 
35 	static BMidiEndpoint* NextEndpoint(int32* id);
36 	static BMidiProducer* NextProducer(int32* id);
37 	static BMidiConsumer* NextConsumer(int32* id);
38 
39 	static BMidiEndpoint* FindEndpoint(int32 id, bool localOnly = false);
40 	static BMidiProducer* FindProducer(int32 id, bool localOnly = false);
41 	static BMidiConsumer* FindConsumer(int32 id, bool localOnly = false);
42 
43 	static void StartWatching(const BMessenger* msngr);
44 	static void StopWatching();
45 
46 	static status_t Register(BMidiEndpoint* endp);
47 	static status_t Unregister(BMidiEndpoint* endp);
48 
49 	static BMidiRoster* MidiRoster();
50 
51 private:
52 
53 	friend class BMidiConsumer;
54 	friend class BMidiEndpoint;
55 	friend class BMidiLocalProducer;
56 	friend class BMidiLocalConsumer;
57 	friend class BMidiProducer;
58 	friend class BPrivate::BMidiRosterLooper;
59 	friend struct BPrivate::BMidiRosterKiller;
60 
61 	BMidiRoster();
62 	virtual ~BMidiRoster();
63 
64 	virtual void _Reserved1();
65 	virtual void _Reserved2();
66 	virtual void _Reserved3();
67 	virtual void _Reserved4();
68 	virtual void _Reserved5();
69 	virtual void _Reserved6();
70 	virtual void _Reserved7();
71 	virtual void _Reserved8();
72 
73 	void CreateLocal(BMidiEndpoint*);
74 	void DeleteLocal(BMidiEndpoint*);
75 
76 	status_t SendRequest(BMessage*, BMessage*);
77 
78 	BPrivate::BMidiRosterLooper* looper;
79 	BMessenger* server;
80 
81 	uint32 _reserved[16];
82 };
83 
84 #endif // _MIDI_ROSTER_H
85