1 /*************************************************************************** 2 AudioBase.h - description 3 ------------------- 4 begin : Sat Jul 8 2000 5 copyright : (C) 2000 by Simon White 6 email : s_a_white@email.com 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 /*************************************************************************** 18 * $Log: AudioBase.h,v $ 19 * Revision 1.4 2001/11/16 19:34:29 s_a_white 20 * Added extension to be used for file audio devices. 21 * 22 * Revision 1.3 2001/10/30 23:34:45 s_a_white 23 * Added pause. 24 * 25 * Revision 1.2 2001/07/03 17:53:29 s_a_white 26 * Added call to get pointer to current music buffer. 27 * 28 * Revision 1.1 2001/01/08 16:41:43 s_a_white 29 * App and Library Seperation 30 * 31 * Revision 1.4 2000/12/11 19:07:14 s_a_white 32 * AC99 Update. 33 * 34 ***************************************************************************/ 35 36 #ifndef _AudioBase_h_ 37 #define _AudioBase_h_ 38 39 #include <string.h> 40 #include "AudioConfig.h" 41 42 class AudioBase 43 { 44 protected: 45 AudioConfig _settings; 46 char *_errorString; 47 void *_sampleBuffer; 48 49 public: AudioBase()50 AudioBase () 51 { 52 _errorString = "None"; 53 _sampleBuffer = NULL; 54 } ~AudioBase()55 virtual ~AudioBase () {;} 56 57 // All drivers must support these 58 virtual void *open (AudioConfig &cfg, const char *name) = 0; 59 // Rev 1.3 (saw) - Definition is incorrect and has been updated. 60 // On a reset hardware buffers may have changed and therefore a 61 // new address needs to be returned by the driver. 62 virtual void *reset () = 0; 63 virtual void *write () = 0; 64 virtual void close () = 0; 65 virtual void pause () = 0; extension()66 virtual const char *extension () const { return ""; } buffer()67 void *buffer () { return _sampleBuffer; } 68 getConfig(AudioConfig & cfg)69 void getConfig (AudioConfig &cfg) const 70 { 71 cfg = _settings; 72 } 73 getErrorString()74 const char *getErrorString () const 75 { 76 return _errorString; 77 } 78 }; 79 80 #endif // _AudioBase_h_ 81