Audacity  2.2.0
DeviceChange.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  DeviceChange.h
6 
7  Leland Lucius
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_DEVICECHANGE_H__
12 #define __AUDACITY_DEVICECHANGE_H__
13 
14 #include "Audacity.h"
15 #include "Experimental.h"
16 
17 #if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER)
18 
19 #include "MemoryX.h"
20 
21 #if defined(__WXMSW__) || defined(__WXMAC__) || defined(HAVE_LIBUDEV_H)
22 #define HAVE_DEVICE_CHANGE
23 #endif
24 
25 #if defined(HAVE_DEVICE_CHANGE)
26 
27 #include <wx/event.h>
28 #include <wx/timer.h>
29 
30 class DeviceChangeInterface /* not final */
31 {
32 public:
33  virtual ~DeviceChangeInterface() {};
34 
35  virtual bool SetHandler(wxEvtHandler *handler) = 0;
36  virtual void Enable(bool enable = true) = 0;
37 };
38 
39 class DeviceChangeHandler : public wxEvtHandler
40 {
41 public:
42  DeviceChangeHandler();
43  virtual ~DeviceChangeHandler();
44 
45  void Enable(bool enable = true);
46 
47  virtual void DeviceChangeNotification() = 0;
48 
49 private:
50  void OnChange(wxCommandEvent & evt);
51  void OnTimer(wxTimerEvent & evt);
52 
53  std::unique_ptr<DeviceChangeInterface> mListener;
54  wxTimer mTimer;
55 
56  DECLARE_EVENT_TABLE()
57 };
58 
59 #endif
60 
61 #endif
62 
63 #endif