1 // This may look like C code, but it is really -*- C++ -*- 2 3 // ------------------------------------------------------------------ 4 // The Goldware Library 5 // Copyright (C) 1990-1999 Odinn Sorensen 6 // ------------------------------------------------------------------ 7 // This library is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU Library General Public 9 // License as published by the Free Software Foundation; either 10 // version 2 of the License, or (at your option) any later version. 11 // 12 // This library is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 // Library General Public License for more details. 16 // 17 // You should have received a copy of the GNU Library General Public 18 // License along with this program; if not, write to the Free 19 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 // MA 02111-1307, USA 21 // ------------------------------------------------------------------ 22 // $Id: gsndall.h,v 1.2 2001/04/15 19:24:44 asa Exp $ 23 // ------------------------------------------------------------------ 24 // Sound interface class. 25 // ------------------------------------------------------------------ 26 27 #ifndef __gsndall_h 28 #define __gsndall_h 29 30 31 // ------------------------------------------------------------------ 32 33 #include <gsndsapi.h> 34 #ifdef __OS2__ 35 #define INCL_BASE 36 #include <os2.h> 37 #endif 38 #ifdef __WIN32__ 39 #include <windows.h> 40 #endif 41 42 43 // ------------------------------------------------------------------ 44 45 #ifdef DEBUG 46 extern int debug; 47 #endif 48 49 50 // ------------------------------------------------------------------ 51 52 class gsnd { 53 54 protected: 55 56 #if defined(__MSDOS__) 57 int mpx; 58 #if defined(__DJGPP__) || (defined(__WATCOMC__) && defined(__386__)) 59 int buffer; 60 #else 61 char* buffer; 62 #endif 63 gsapidata* data; 64 uint key_value; 65 int call_api(uint al, uint bx=0); 66 #endif 67 68 int api_open; 69 int file_open; 70 71 void free_buffer(); 72 73 public: 74 75 gsnd(); 76 ~gsnd(); 77 78 // API open/close 79 int open_api(); 80 int close_api(); 81 82 // Sound file open/close 83 int open(const char* file); 84 int close(); 85 86 // Sound play and control 87 int play(uint sample_rate=0); 88 int stop(); 89 int pause(); 90 int resume(); 91 int break_loop(int method=0); 92 void speaker(int onoff); 93 94 // Information 95 uint get_sample_rate(); api_is_open()96 int api_is_open() { return api_open; } 97 int is_playing(); 98 }; 99 100 101 // ------------------------------------------------------------------ 102 103 class gsound { 104 105 protected: 106 107 int installed; 108 109 public: 110 111 gsound(); 112 ~gsound(); 113 114 int load(const char* file); 115 int unload(); 116 int play(); 117 int stop(); 118 119 int is_playing(); 120 is_installed()121 int is_installed() { return installed; } 122 }; 123 124 125 // ------------------------------------------------------------------ 126 127 #endif 128 129 // ------------------------------------------------------------------ 130