liveMedia/include/AudioInputDevice.hh

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // Copyright (c) 1996-2012 Live Networks, Inc.  All rights reserved.
00017 // Generic audio input device (such as a microphone, or an input sound card)
00018 // C++ header
00019 
00020 #ifndef _AUDIO_INPUT_DEVICE_HH
00021 #define _AUDIO_INPUT_DEVICE_HH
00022 
00023 #ifndef _FRAMED_SOURCE_HH
00024 #include "FramedSource.hh"
00025 #endif
00026 
00027 class AudioPortNames {
00028 public:
00029   AudioPortNames();
00030   virtual ~AudioPortNames();
00031 
00032   unsigned numPorts;
00033   char** portName;
00034 };
00035 
00036 class AudioInputDevice: public FramedSource {
00037 public:
00038   unsigned char bitsPerSample() const { return fBitsPerSample; }
00039   unsigned char numChannels() const { return fNumChannels; }
00040   unsigned samplingFrequency() const { return fSamplingFrequency; }
00041 
00042   virtual Boolean setInputPort(int portIndex) = 0;
00043   virtual double getAverageLevel() const = 0;
00044 
00045   static AudioInputDevice*
00046   createNew(UsageEnvironment& env, int inputPortNumber,
00047             unsigned char bitsPerSample, unsigned char numChannels,
00048             unsigned samplingFrequency, unsigned granularityInMS = 20);
00049   static AudioPortNames* getPortNames();
00050 
00051   static char** allowedDeviceNames;
00052   // If this is set to non-NULL, then it's a NULL-terminated array of strings
00053   // of device names that we are allowed to access.
00054 
00055 protected:
00056   AudioInputDevice(UsageEnvironment& env,
00057                    unsigned char bitsPerSample,
00058                    unsigned char numChannels,
00059                    unsigned samplingFrequency,
00060                    unsigned granularityInMS);
00061         // we're an abstract base class
00062 
00063   virtual ~AudioInputDevice();
00064 
00065 protected:
00066   unsigned char fBitsPerSample, fNumChannels;
00067   unsigned fSamplingFrequency;
00068   unsigned fGranularityInMS;
00069 };
00070 
00071 #endif

Generated on Thu May 17 07:11:45 2012 for live by  doxygen 1.5.2