live
AudioInputDevice.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved.
17 // Generic audio input device (such as a microphone, or an input sound card)
18 // C++ header
19 
20 #ifndef _AUDIO_INPUT_DEVICE_HH
21 #define _AUDIO_INPUT_DEVICE_HH
22 
23 #ifndef _FRAMED_SOURCE_HH
24 #include "FramedSource.hh"
25 #endif
26 
28 public:
30  virtual ~AudioPortNames();
31 
32  unsigned numPorts;
33  char** portName;
34 };
35 
37 public:
38  unsigned char bitsPerSample() const { return fBitsPerSample; }
39  unsigned char numChannels() const { return fNumChannels; }
40  unsigned samplingFrequency() const { return fSamplingFrequency; }
41 
42  virtual Boolean setInputPort(int portIndex) = 0;
43  virtual double getAverageLevel() const = 0;
44 
45  static AudioInputDevice*
46  createNew(UsageEnvironment& env, int inputPortNumber,
47  unsigned char bitsPerSample, unsigned char numChannels,
48  unsigned samplingFrequency, unsigned granularityInMS = 20);
50 
51  static char** allowedDeviceNames;
52  // If this is set to non-NULL, then it's a NULL-terminated array of strings
53  // of device names that we are allowed to access.
54 
55 protected:
57  unsigned char bitsPerSample,
58  unsigned char numChannels,
59  unsigned samplingFrequency,
60  unsigned granularityInMS);
61  // we're an abstract base class
62 
63  virtual ~AudioInputDevice();
64 
65 protected:
66  unsigned char fBitsPerSample, fNumChannels;
68  unsigned fGranularityInMS;
69 };
70 
71 #endif
unsigned char Boolean
Definition: Boolean.hh:25
virtual Boolean setInputPort(int portIndex)=0
unsigned char bitsPerSample() const
virtual ~AudioInputDevice()
unsigned samplingFrequency() const
static char ** allowedDeviceNames
static AudioInputDevice * createNew(UsageEnvironment &env, int inputPortNumber, unsigned char bitsPerSample, unsigned char numChannels, unsigned samplingFrequency, unsigned granularityInMS=20)
static AudioPortNames * getPortNames()
unsigned char numChannels() const
AudioInputDevice(UsageEnvironment &env, unsigned char bitsPerSample, unsigned char numChannels, unsigned samplingFrequency, unsigned granularityInMS)
unsigned char fNumChannels
unsigned char fBitsPerSample
virtual double getAverageLevel() const =0
unsigned fSamplingFrequency
virtual ~AudioPortNames()