00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SOLARIS_DSP_SOURCE_H
00030 #define SOLARIS_DSP_SOURCE_H
00031
00032 #ifndef __cplusplus
00033 #error This is a C++ include file
00034 #endif
00035
00036
00037
00038
00039 #include "Reporter.h"
00040 #include "AudioSource.h"
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00057 class SolarisDspSource : public AudioSource, public virtual Reporter
00058 {
00059 private:
00060
00064 char * fileName;
00065
00069 int fileDescriptor;
00070
00071
00072 protected:
00073
00079 inline
00080 SolarisDspSource ( void ) throw ( Exception )
00081 {
00082 throw Exception( __FILE__, __LINE__);
00083 }
00084
00091 void
00092 init ( const char * name ) throw ( Exception );
00093
00099 void
00100 strip ( void ) throw ( Exception );
00101
00102
00103 public:
00104
00116 inline
00117 SolarisDspSource ( const char * name,
00118 int sampleRate = 44100,
00119 int bitsPerSample = 16,
00120 int channel = 2 )
00121 throw ( Exception )
00122
00123 : AudioSource( sampleRate, bitsPerSample, channel)
00124 {
00125 init( name);
00126 }
00127
00134 inline
00135 SolarisDspSource ( const SolarisDspSource & sds )
00136 throw ( Exception )
00137 : AudioSource( sds )
00138 {
00139 init( sds.fileName);
00140 }
00141
00147 inline virtual
00148 ~SolarisDspSource ( void ) throw ( Exception )
00149 {
00150 strip();
00151 }
00152
00160 inline virtual SolarisDspSource &
00161 operator= ( const SolarisDspSource & ds ) throw ( Exception )
00162 {
00163 if ( this != &ds ) {
00164 strip();
00165 AudioSource::operator=( ds);
00166 init( ds.fileName);
00167 }
00168 return *this;
00169 }
00170
00176 virtual inline bool
00177 isBigEndian ( void ) const throw ()
00178 {
00179 #ifdef WORDS_BIGENDIAN
00180 return true;
00181 #else
00182 return false;
00183 #endif
00184 }
00185
00197 virtual bool
00198 open ( void ) throw ( Exception );
00199
00205 inline virtual bool
00206 isOpen ( void ) const throw ()
00207 {
00208 return fileDescriptor != 0;
00209 }
00210
00222 virtual bool
00223 canRead ( unsigned int sec,
00224 unsigned int usec ) throw ( Exception );
00225
00235 virtual unsigned int
00236 read ( void * buf,
00237 unsigned int len ) throw ( Exception );
00238
00244 virtual void
00245 close ( void ) throw ( Exception );
00246 };
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 #endif
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281