ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
media.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EXTERN_C   extern
 
#define ENUM_C(name)   typedef enum
 
#define ENUM_END_C(name)   name
 

Enumerations

enum  muteState { UNKNOWN = -1, UNMUTED, MUTED }
 

Functions

muteState getMuteState ()
 

Macro Definition Documentation

#define ENUM_C (   name)    typedef enum

Definition at line 13 of file media.h.

#define ENUM_END_C (   name)    name

Definition at line 14 of file media.h.

#define EXTERN_C   extern

Definition at line 12 of file media.h.

Enumeration Type Documentation

enum muteState
Enumerator
UNKNOWN 
UNMUTED 
MUTED 

Definition at line 19 of file media.h.

19  {
20  UNKNOWN = -1,
21  UNMUTED,
22  MUTED
Definition: media.h:20
muteState
Definition: media.h:19
Definition: media.h:21
Definition: media.h:22
#define ENUM_END_C(name)
Definition: media.h:14

Function Documentation

muteState getMuteState ( )

Definition at line 102 of file media_linux.cpp.

References lastKnown, MUTED, UNKNOWN, and UNMUTED.

Referenced by KbPerf::applyIndicators().

102  {
103 #ifdef USE_LIBPULSE
104  static pa_threaded_mainloop* mainLoop = nullptr;
105 
106  QMutexLocker locker(&mutex);
107 
108  //Setup main loop thread used for communicating with Pulse Audio. All
109  //communication is done asynchronously.
110  if(mainLoop == nullptr){
111  mainLoop = pa_threaded_mainloop_new();
112  if(mainLoop == nullptr)
113  return lastKnown;
114 
115  if(pa_threaded_mainloop_start(mainLoop) != 0){
116  pa_threaded_mainloop_free(mainLoop);
117  mainLoop = nullptr;
118  return lastKnown;
119  }
120  }
121 
122  //Connect to the local Pulse Audio server. It's usually running but a
123  //reconnect is attempted periodically whenever the connection fails or is
124  //terminated.
125  if(paContext == nullptr && QDateTime::currentMSecsSinceEpoch() >= reconnectTime){
126  pa_threaded_mainloop_lock(mainLoop);
127  {
128  pa_mainloop_api* api = pa_threaded_mainloop_get_api(mainLoop);
129  Q_ASSERT(api != nullptr);
130 
131  paContext = pa_context_new(api, "QPulse");
132  Q_ASSERT(paContext != nullptr);
133  pa_context_set_state_callback(paContext, &ContextStateCallback, nullptr);
134  pa_context_connect(paContext, nullptr, PA_CONTEXT_NOFAIL, nullptr);
135  }
136  pa_threaded_mainloop_unlock(mainLoop);
137  }
138 #endif
139 
140  return lastKnown;
141 }
static muteState lastKnown
Definition: media_linux.cpp:13

+ Here is the caller graph for this function: