Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

OssDspSource.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 
00003    Copyright (c) 2000 Tyrell Corporation. All rights reserved.
00004 
00005    Tyrell DarkIce
00006 
00007    File     : OssDspSource.h
00008    Version  : $Revision: 1.7 $
00009    Author   : $Author: darkeye $
00010    Location : $Source: /cvsroot/darkice/darkice/src/OssDspSource.h,v $
00011    
00012    Copyright notice:
00013 
00014     This program is free software; you can redistribute it and/or
00015     modify it under the terms of the GNU General Public License  
00016     as published by the Free Software Foundation; either version 2
00017     of the License, or (at your option) any later version.
00018    
00019     This program is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00022     GNU General Public License for more details.
00023    
00024     You should have received a copy of the GNU General Public License
00025     along with this program; if not, write to the Free Software
00026     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028 ------------------------------------------------------------------------------*/
00029 #ifndef OSS_DSP_SOURCE_H
00030 #define OSS_DSP_SOURCE_H
00031 
00032 #ifndef __cplusplus
00033 #error This is a C++ include file
00034 #endif
00035 
00036 
00037 /* ============================================================ include files */
00038 
00039 #include "Reporter.h"
00040 #include "AudioSource.h"
00041 
00042 
00043 /* ================================================================ constants */
00044 
00045 
00046 /* =================================================================== macros */
00047 
00048 
00049 /* =============================================================== data types */
00050 
00057 class OssDspSource : public AudioSource, public virtual Reporter
00058 {
00059     private:
00060 
00064         char      * fileName;
00065 
00069         int         fileDescriptor;
00070 
00075         bool        running;
00076 
00077 
00078     protected:
00079 
00085         inline
00086         OssDspSource ( void )                       throw ( Exception )
00087         {
00088             throw Exception( __FILE__, __LINE__);
00089         }
00090 
00097         void
00098         init (  const char    * name )              throw ( Exception );
00099 
00105         void
00106         strip ( void )                              throw ( Exception );
00107 
00108 
00109     public:
00110 
00122         inline
00123         OssDspSource (  const char    * name,
00124                         int             sampleRate    = 44100,
00125                         int             bitsPerSample = 16,
00126                         int             channel       = 2 )
00127                                                         throw ( Exception )
00128 
00129                     : AudioSource( sampleRate, bitsPerSample, channel)
00130         {
00131             init( name);
00132         }
00133 
00140         inline
00141         OssDspSource (  const OssDspSource &    ods )   throw ( Exception )
00142                     : AudioSource( ods )
00143         {
00144             init( ods.fileName);
00145         }
00146 
00152         inline virtual
00153         ~OssDspSource ( void )                          throw ( Exception )
00154         {
00155             strip();
00156         }
00157 
00165         inline virtual OssDspSource &
00166         operator= (     const OssDspSource &     ds )   throw ( Exception )
00167         {
00168             if ( this != &ds ) {
00169                 strip();
00170                 AudioSource::operator=( ds);
00171                 init( ds.fileName);
00172             }
00173             return *this;
00174         }
00175 
00181         virtual bool
00182         isBigEndian ( void ) const           throw ();
00183 
00195         virtual bool
00196         open ( void )                                   throw ( Exception );
00197 
00203         inline virtual bool
00204         isOpen ( void ) const                           throw ()
00205         {
00206             return fileDescriptor != 0;
00207         }
00208 
00220         virtual bool
00221         canRead (               unsigned int    sec,
00222                                 unsigned int    usec )  throw ( Exception );
00223 
00233         virtual unsigned int
00234         read (                  void          * buf,
00235                                 unsigned int    len )   throw ( Exception );
00236 
00242         virtual void
00243         close ( void )                                  throw ( Exception );
00244 };
00245 
00246 
00247 /* ================================================= external data structures */
00248 
00249 
00250 /* ====================================================== function prototypes */
00251 
00252 
00253 
00254 #endif  /* OSS_DSP_SOURCE_H */
00255 
00256 
00257 /*------------------------------------------------------------------------------
00258  
00259   $Source: /cvsroot/darkice/darkice/src/OssDspSource.h,v $
00260 
00261   $Log: OssDspSource.h,v $
00262   Revision 1.7  2005/04/14 11:53:17  darkeye
00263   fixed API documentation issues
00264 
00265   Revision 1.6  2002/12/20 10:40:40  darkeye
00266   added support for big endian OSS devices (like Linux PowerPC)
00267 
00268   Revision 1.5  2001/09/18 14:57:19  darkeye
00269   finalized Solaris port
00270 
00271   Revision 1.4  2001/09/02 14:08:40  darkeye
00272   setting the sound card recording sample rate is now more relaxed
00273   there is no error reported if the sample rate is not exactly the same
00274 
00275   Revision 1.3  2000/11/12 13:31:40  darkeye
00276   added kdoc-style documentation comments
00277 
00278   Revision 1.2  2000/11/05 17:37:24  darkeye
00279   removed clone() functions
00280 
00281   Revision 1.1.1.1  2000/11/05 10:05:53  darkeye
00282   initial version
00283 
00284   
00285 ------------------------------------------------------------------------------*/
00286 

Generated on Sat Oct 22 13:17:04 2005 for DarkIce by  doxygen 1.4.4