yocto_audioin.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * $Id: yocto_audioin.h 28748 2017-10-03 08:23:39Z seb $
4  *
5  * Declares yFindAudioIn(), the high-level API for AudioIn functions
6  *
7  * - - - - - - - - - License information: - - - - - - - - -
8  *
9  * Copyright (C) 2011 and beyond by Yoctopuce Sarl, Switzerland.
10  *
11  * Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
12  * non-exclusive license to use, modify, copy and integrate this
13  * file into your software for the sole purpose of interfacing
14  * with Yoctopuce products.
15  *
16  * You may reproduce and distribute copies of this file in
17  * source or object form, as long as the sole purpose of this
18  * code is to interface with Yoctopuce products. You must retain
19  * this notice in the distributed source file.
20  *
21  * You should refer to Yoctopuce General Terms and Conditions
22  * for additional information regarding your rights and
23  * obligations.
24  *
25  * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 'AS IS' WITHOUT
26  * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
27  * WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
28  * FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
29  * EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
30  * INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
31  * COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
32  * SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
33  * LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
34  * CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
35  * BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
36  * WARRANTY, OR OTHERWISE.
37  *
38  *********************************************************************/
39 
40 
41 #ifndef YOCTO_AUDIOIN_H
42 #define YOCTO_AUDIOIN_H
43 
44 #include "yocto_api.h"
45 #include <cfloat>
46 #include <cmath>
47 #include <map>
48 
49 //--- (YAudioIn return codes)
50 //--- (end of YAudioIn return codes)
51 //--- (YAudioIn definitions)
52 class YAudioIn; // forward declaration
53 
54 typedef void (*YAudioInValueCallback)(YAudioIn *func, const string& functionValue);
55 #ifndef _Y_MUTE_ENUM
56 #define _Y_MUTE_ENUM
57 typedef enum {
61 } Y_MUTE_enum;
62 #endif
63 #define Y_VOLUME_INVALID (YAPI_INVALID_UINT)
64 #define Y_VOLUMERANGE_INVALID (YAPI_INVALID_STRING)
65 #define Y_SIGNAL_INVALID (YAPI_INVALID_INT)
66 #define Y_NOSIGNALFOR_INVALID (YAPI_INVALID_INT)
67 //--- (end of YAudioIn definitions)
68 
69 //--- (YAudioIn declaration)
76 #ifdef __BORLANDC__
77 #pragma option push -w-8022
78 #endif
79 //--- (end of YAudioIn declaration)
80 protected:
81  //--- (YAudioIn attributes)
82  // Attributes (function value cache)
83  int _volume;
85  string _volumeRange;
86  int _signal;
89 
90  friend YAudioIn *yFindAudioIn(const string& func);
91  friend YAudioIn *yFirstAudioIn(void);
92 
93  // Function-specific method for parsing of JSON output and caching result
94  virtual int _parseAttr(YJSONObject* json_val);
95 
96  // Constructor is protected, use yFindAudioIn factory function to instantiate
97  YAudioIn(const string& func);
98  //--- (end of YAudioIn attributes)
99 
100 public:
101  ~YAudioIn();
102  //--- (YAudioIn accessors declaration)
103 
104  static const int VOLUME_INVALID = YAPI_INVALID_UINT;
105  static const Y_MUTE_enum MUTE_FALSE = Y_MUTE_FALSE;
106  static const Y_MUTE_enum MUTE_TRUE = Y_MUTE_TRUE;
107  static const Y_MUTE_enum MUTE_INVALID = Y_MUTE_INVALID;
108  static const string VOLUMERANGE_INVALID;
109  static const int SIGNAL_INVALID = YAPI_INVALID_INT;
110  static const int NOSIGNALFOR_INVALID = YAPI_INVALID_INT;
111 
119  int get_volume(void);
120 
121  inline int volume(void)
122  { return this->get_volume(); }
123 
133  int set_volume(int newval);
134  inline int setVolume(int newval)
135  { return this->set_volume(newval); }
136 
144  Y_MUTE_enum get_mute(void);
145 
146  inline Y_MUTE_enum mute(void)
147  { return this->get_mute(); }
148 
159  int set_mute(Y_MUTE_enum newval);
160  inline int setMute(Y_MUTE_enum newval)
161  { return this->set_mute(newval); }
162 
173  string get_volumeRange(void);
174 
175  inline string volumeRange(void)
176  { return this->get_volumeRange(); }
177 
185  int get_signal(void);
186 
187  inline int signal(void)
188  { return this->get_signal(); }
189 
197  int get_noSignalFor(void);
198 
199  inline int noSignalFor(void)
200  { return this->get_noSignalFor(); }
201 
229  static YAudioIn* FindAudioIn(string func);
230 
242  virtual int registerValueCallback(YAudioInValueCallback callback);
244 
245  virtual int _invokeValueCallback(string value);
246 
247 
248  inline static YAudioIn* Find(string func)
249  { return YAudioIn::FindAudioIn(func); }
250 
258  YAudioIn *nextAudioIn(void);
259  inline YAudioIn *next(void)
260  { return this->nextAudioIn();}
261 
271  static YAudioIn* FirstAudioIn(void);
272  inline static YAudioIn* First(void)
273  { return YAudioIn::FirstAudioIn();}
274 #ifdef __BORLANDC__
275 #pragma option pop
276 #endif
277  //--- (end of YAudioIn accessors declaration)
278 };
279 
280 //--- (YAudioIn functions declaration)
281 
309 inline YAudioIn* yFindAudioIn(const string& func)
310 { return YAudioIn::FindAudioIn(func);}
320 inline YAudioIn* yFirstAudioIn(void)
321 { return YAudioIn::FirstAudioIn();}
322 
323 //--- (end of YAudioIn functions declaration)
324 
325 #endif
YAudioIn * yFirstAudioIn(void)
int volume(void)
YAudioInValueCallback _valueCallbackAudioIn
Definition: yocto_audioin.h:88
Y_MUTE_enum
Definition: yocto_audioin.h:57
string volumeRange(void)
int setVolume(int newval)
static YAudioIn * FirstAudioIn(void)
#define YAPI_INVALID_UINT
Definition: yocto_api.h:71
Y_MUTE_enum _mute
Definition: yocto_audioin.h:84
virtual int _parseAttr(YJSONObject *json_val)
Definition: yocto_api.cpp:2367
static YAudioIn * FindAudioIn(string func)
int noSignalFor(void)
void(* YAudioInValueCallback)(YAudioIn *func, const string &functionValue)
Definition: yocto_audioin.h:54
int signal(void)
int setMute(Y_MUTE_enum newval)
static const string VOLUMERANGE_INVALID
YAudioIn * yFindAudioIn(const string &func)
virtual int registerValueCallback(YFunctionValueCallback callback)
Definition: yocto_api.cpp:2544
#define YOCTO_CLASS_EXPORT
Definition: yocto_api.h:61
string _volumeRange
Definition: yocto_audioin.h:85
YAudioIn * next(void)
#define YAPI_INVALID_INT
Definition: yocto_api.h:70
Y_MUTE_enum mute(void)
static YAudioIn * Find(string func)
static YAudioIn * First(void)
int _noSignalFor
Definition: yocto_audioin.h:87
virtual int _invokeValueCallback(string value)
Definition: yocto_api.cpp:2563


yoctopuce_altimeter
Author(s): Anja Sheppard
autogenerated on Mon Jun 10 2019 15:49:11