HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AU_Input.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: AU_Input.h ( AU Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __AU_Input__
12 #define __AU_Input__
13 
14 #include "AU_API.h"
15 #include <UT/UT_AudioInput.h>
16 
17 #define AU_MAX_VOL_CHANNELS 4
18 
19 
20 #if defined(WIN32)
21  #include "AU_NTSystem.h"
22  class AU_API AU_Input : public UT_AudioInput, public AU_NTSystem
23 #elif defined(MBSD)
24  class AU_MBSDUtilAudioInfo;
25 
26  class AU_API AU_Input : public UT_AudioInput
27 #elif defined(LINUX)
28 
29  class AU_API AU_Input : public UT_AudioInput
30 #else
31  #error Unsupported platform
32 #endif
33 {
34 public:
35 
36  AU_Input(int channels, int rate);
37  virtual ~AU_Input();
38 
39  virtual int open(float queuesize);
40  virtual void close();
41 
42  virtual int hasInput();
43  virtual short * getInput(int size);
44 
45  virtual int getGlobalRate();
46 
47  virtual int setSource(int source);
48  virtual int getSource();
49 
50  virtual int setMicrophoneMode(int stereo);
51  virtual int getMicrophoneMode();
52  virtual int getChannelMode();
53 
54  virtual int setVolume(int speaker, float vol);
55  virtual float getVolume(int speaker);
56 
57  virtual UT_AudioInput * newAudioInputDevice(int channels, int rate);
58 
59 private:
60 #ifdef WIN32
61  // Creates a new wave header with its data block at pos in myQueue.
62  void appendWaveHeader(int pos);
63  // Apply volume adjustments, and copy 2 channels to 4 if required
64  void applyVolume(char *data, int bytesPerChannel);
65 
66  int myPort;
67 
68  // Specifies the input source.
69  int mySource;
70  // The size of each wave packet (in bytes).
71  int myBlockSize;
72  // The number of bytes copied from the last incomplete block.
73  int myBlockOffset;
74  // NT doesn't allow setting of input volume, so we fake it.
75  float myVolumes[4];
76 
77 #elif defined(MBSD)
78  // adjust the volume
79  void applyVolume(char *data, int data_size );
80 
81  AU_MBSDUtilAudioInfo * myInfo; // audio info (rate, buffers, etc).
82  int myRate; // sample rate
83  int myChannels; // number of channels
84  int mySource; // specifies the input source
85  float myVolumes[ AU_MAX_VOL_CHANNELS ]; // volumes per channel
86 
87 #elif defined(LINUX)
88  void adjustRate(int read);
89 
90  int myRate;
91  int myIsOpen;
92 
93 #else
94  #error Unsupported platform
95 #endif
96 };
97 
98 #endif
virtual float getVolume(int speaker)
virtual ~AU_Input()
virtual int setSource(int source)
virtual int setMicrophoneMode(int stereo)
void read(T &in, bool &v)
Definition: ImfXdr.h:611
GLsizeiptr size
Definition: glcorearb.h:663
virtual int hasInput()
virtual int getMicrophoneMode()
virtual int getSource()
virtual int getChannelMode()
virtual int setVolume(int speaker, float vol)
#define AU_API
Definition: AU_API.h:10
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
virtual UT_AudioInput * newAudioInputDevice(int channels, int rate)
GLboolean * data
Definition: glcorearb.h:130
virtual short * getInput(int size)
virtual void close()
#define AU_MAX_VOL_CHANNELS
Definition: AU_Input.h:17
virtual int getGlobalRate()
virtual int open(float queuesize)