forked from Sneeds-Feed-and-Seed/sneedacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeviceChange.h
63 lines (38 loc) · 1.14 KB
/
DeviceChange.h
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
62
63
/**********************************************************************
Sneedacity: A Digital Audio Editor
DeviceChange.h
Leland Lucius
**********************************************************************/
#ifndef __SNEEDACITY_DEVICECHANGE_H__
#define __SNEEDACITY_DEVICECHANGE_H__
#if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER)
#include <memory>
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(HAVE_LIBUDEV_H)
#define HAVE_DEVICE_CHANGE
#endif
#if defined(HAVE_DEVICE_CHANGE)
#include <wx/timer.h> // member variable
class DeviceChangeInterface /* not final */
{
public:
virtual ~DeviceChangeInterface() {};
virtual bool SetHandler(wxEvtHandler *handler) = 0;
virtual void Enable(bool enable = true) = 0;
};
class DeviceChangeHandler : public wxEvtHandler
{
public:
DeviceChangeHandler();
virtual ~DeviceChangeHandler();
void Enable(bool enable = true);
virtual void DeviceChangeNotification() = 0;
private:
void OnChange(wxCommandEvent & evt);
void OnTimer(wxTimerEvent & evt);
std::unique_ptr<DeviceChangeInterface> mListener;
wxTimer mTimer;
DECLARE_EVENT_TABLE()
};
#endif
#endif
#endif