HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AU_SoundManager.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_SoundManager.h ( AU Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __AU_SoundManager__
12 #define __AU_SoundManager__
13 
14 #include "AU_API.h"
15 #include "AU_Defines.h"
16 
17 class CL_Clip;
18 
20 {
21 public:
22 
24  ~AU_SoundManager();
25 
26  AU_SoundManager(const AU_SoundManager &) = delete;
27  AU_SoundManager &operator=(const AU_SoundManager &) = delete;
28 
29  //
30  // General access methods
31  //
32 
33  void setMute(int onoff);
34  int getMute() const;
35  void setMono(int onoff);
36  int getMono() const;
37  void setLeftVolume(float volume);
38  float getLeftVolume() const;
39  void setRightVolume(float volume);
40  float getRightVolume() const;
41 
42 
43  //
44  // Test clip methods
45  //
46  // The test buffer allows you to load a test sound clip and
47  // play portions of it with resumable interruptions.
48  // Very similiar to a tape deck operation.
49  //
50 
51  int loadTest(const CL_Clip *clip, int rewind);
52  int unloadTest();
53 
54  int isTestActive() const;
55  int rewindTest();
56  int forwardTest();
57  void waitTestEnd();
58 
59  int setTestDirection(int dir); // -1=rev,0=stop,1=for
60  int setTestLoop(int yesno);
61 
62  int setTestFull(int yesno); // if no use range
63  void setTestRange(float min, float max);
64 
65  //
66  // Play methods
67  //
68  // The play buffer loads and plays a single uninterruptable sound clip
69  // It is mainly intended to play single sound effect files
70  //
71 
72  int playFile(const char *filename, float l, float r);
73  int isPlaying() const;
74 
75  //
76  // Scrub methods
77  //
78  // The scrub buffer loads a sound clip which can be sampled and
79  // scrubbed.
80  //
81 
82 
83  int loadScrub(const CL_Clip *clip);
84  int unloadScrub();
85  int isScrubbing() const;
86 
87  void scrubReset();
88  void setScrubRealTime(int level);
89  int getScrubRealTime() const;
90  void setScrubRepeat(int onoff);
91  int getScrubRepeat() const;
92  void setScrubSustain(float sustain);
93  float getScrubSustain() const;
94  void setScrubOffset(float offset);
95  float getScrubOffset() const;
96  void setScrubFrequency(int frequency);
97  int getScrubFrequency() const;
98  void setScrubDeltas(float fore, float back);
99  void getScrubDeltas(float &fore, float &back) const;
100  void setScrubIndex(float index);
101  float getScrubIndex() const;
102  void setScrubSmooth(int smooth);
103  int getScrubSmooth() const;
104  void setScrubReverse(bool is_reverse);
105  bool getScrubReverse() const;
106  void setScrubOneFrame(bool is_oneframe);
107  bool getScrubOneFrame() const;
108 
109  //
110  // Realtime methods
111  //
112 
113  int loadRealtime(const CL_Clip *clip, int start,int end,
114  float queue);
115  void startRealtime(int rate, int channels,float queue);
116  void stopRealtime();
117  int isRealtime() const;
118 
119  //
120  // Misc methods
121  //
122 
123  void getMaxLevel(float *l, float *r) const; // meter
124  void shutDown(); // unload test/scrub buffers
125  int isAUDeviceOpen() const;// query
126  void loseAUInterest() const;// reset
127  int obtainAUDevice() ; // get
128  int releaseAUDevice(); // release audio device
129 
130 protected:
131 
132 private:
133 
134  int sendAudioCommand(int command);
135  int loadFromClip(const CL_Clip *clip);
136  void loadSegmentFromClip(const CL_Clip *clip,
137  float *data[AU_MAX_CHANNELS],
138  int start, int end,
139  int &length);
140 
141 };
142 
143 
144 AU_API extern AU_SoundManager *AUgetSoundManager(); // Get sound interrupt ptr
145 
146 #endif
GT_API const UT_StringHolder filename
GLuint start
Definition: glcorearb.h:475
GLint level
Definition: glcorearb.h:108
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLintptr offset
Definition: glcorearb.h:665
#define AU_API
Definition: AU_API.h:10
GLuint GLuint end
Definition: glcorearb.h:475
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the queue
Definition: thread.h:623
AU_API AU_SoundManager * AUgetSoundManager()
virtual bool smooth(GA_AttributeOperand &d, GA_AttributeOperand &min, GA_AttributeOperand &max, GA_AttributeOperand &t) const
d = SYSsmooth(min, max, t);
LeafData & operator=(const LeafData &)=delete
GLuint index
Definition: glcorearb.h:786
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLboolean r
Definition: glcorearb.h:1222
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
Definition: ImathBoxAlgo.h:29
Definition: format.h:895
#define AU_MAX_CHANNELS
Definition: AU_Defines.h:17
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)