| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/lib/streamaudio.h $ |
| 21 | * $Revision: 1.2 $ |
| 22 | * $Date: 2004/02/09 04:14:51 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * Interface for streaming audio, compressed or not |
| 26 | * |
| 27 | * $Log: streamaudio.h,v $ |
| 28 | * Revision 1.2 2004/02/09 04:14:51 kevinb |
| 29 | * Added newlines to all headers to reduce number of warnings printed |
| 30 | * |
| 31 | * Made some small changes to get everything compiling. |
| 32 | * |
| 33 | * All Ready to merge the 1.5 tree. |
| 34 | * |
| 35 | * Revision 1.1.1.1 2000/04/18 00:00:38 icculus |
| 36 | * initial checkin |
| 37 | * |
| 38 | * |
| 39 | * 30 10/25/99 6:00p Jeff |
| 40 | * fixed adecode.h include for Linux |
| 41 | * |
| 42 | * 29 10/21/99 1:52p Kevin |
| 43 | * Mac Merge! |
| 44 | * |
| 45 | * 28 9/30/99 4:35p Jeff |
| 46 | * fixed linux typo |
| 47 | * |
| 48 | * 27 9/30/99 4:29p Jeff |
| 49 | * Linux compile |
| 50 | * |
| 51 | * 26 7/28/99 3:04p Kevin |
| 52 | * Macintosh! |
| 53 | * |
| 54 | * 25 5/17/99 1:50p Ardussi |
| 55 | * changed to compile on Mac |
| 56 | * |
| 57 | * 24 5/13/99 5:04p Ardussi |
| 58 | * changes for compiling on the Mac |
| 59 | * |
| 60 | * 23 5/10/99 9:22p Samir |
| 61 | * added code to allow for certain streams to be specified to start on |
| 62 | * next sound frame. |
| 63 | * |
| 64 | * 22 4/15/99 1:44a Jeff |
| 65 | * changes for linux compile |
| 66 | * |
| 67 | * 21 4/10/99 5:09p Samir |
| 68 | * beginning to add prioritization of sounds code. currently non |
| 69 | * functional, but allows me to change all calls to Play3dSound so that I |
| 70 | * can test later. |
| 71 | * |
| 72 | * 20 3/04/99 6:38p Samir |
| 73 | * Saved stream state per frame. |
| 74 | * |
| 75 | * 19 3/03/99 5:08p Samir |
| 76 | * added slew of debug code: hopefully the library will be revamped after |
| 77 | * OEM. |
| 78 | * |
| 79 | * 18 2/28/99 5:11p Nate |
| 80 | * added playcount. |
| 81 | * |
| 82 | * 17 2/27/99 6:52p Samir |
| 83 | * added function to get current loop count |
| 84 | * |
| 85 | * 16 2/26/99 5:26p Samir |
| 86 | * fixes to streaming audio to reflect fix in direct sound mixer. |
| 87 | * |
| 88 | * 15 1/13/99 6:48a Jeff |
| 89 | * made linux friendly with some #ifdef's |
| 90 | * |
| 91 | * 14 12/13/98 6:50p Samir |
| 92 | * fixed problems with looping and next.switching sync. |
| 93 | * |
| 94 | * 13 12/11/98 3:27p Samir |
| 95 | * add debug code. |
| 96 | * |
| 97 | * 12 12/10/98 7:12p Samir |
| 98 | * fixed some bugs in file/playback buffer sequencing with new system. |
| 99 | * |
| 100 | * 11 12/10/98 10:11a Samir |
| 101 | * newer streaming audio library. |
| 102 | * |
| 103 | * 8 11/20/98 5:20p Samir |
| 104 | * correcting a lot of errors in AudioStream::Next |
| 105 | * |
| 106 | * 7 11/13/98 2:25p Samir |
| 107 | * added 'next' stream processing. |
| 108 | * |
| 109 | * 7 11/13/98 10:48a Samir |
| 110 | * added 'next' stream capability. |
| 111 | * |
| 112 | * 6 10/23/98 7:05p Samir |
| 113 | * added pause and resume |
| 114 | * |
| 115 | * 5 8/10/98 5:54p Samir |
| 116 | * added looping streams and soft measure stopping. |
| 117 | * |
| 118 | * 4 7/24/98 5:19p Samir |
| 119 | * added osfarchive class, |
| 120 | * |
| 121 | * 3 7/09/98 8:36p Samir |
| 122 | * fully implemented redo of Stream interface. |
| 123 | * |
| 124 | * 2 7/08/98 6:27p Samir |
| 125 | * stream library integrated with highlevel sound system. |
| 126 | * |
| 127 | * 1 7/08/98 6:22p Samir |
| 128 | * moved from man. |
| 129 | * |
| 130 | * 3 6/19/98 6:07p Jeff |
| 131 | * added a function to return a handle to the sound |
| 132 | * |
| 133 | * 2 6/18/98 5:17p Jeff |
| 134 | * Initial creation, support should be pretty much complete |
| 135 | * |
| 136 | * $NoKeywords: $ |
| 137 | */ |
| 138 | #ifndef __STREAMAUDIO_H_ |
| 139 | #define __STREAMAUDIO_H_cxx . . $ `stream_audio/streamaudio.h:139:9`! |
| 140 | |
| 141 | #include "adecode.h"cxx . . $ `<file>/AudioEncode/adecode.h`/ |
| 142 | #include "ssl_lib.h"cxx . . $ `<file>/sndlib/ssl_lib.h`/ |
| 143 | |
| 144 | void *AudioStreamCBcxx . . $ AudioStreamCB(9326456ed2624211).(void *user_data, int handle, int *size); |
| 145 | int ADecodeFileReadcxx . . $ ADecodeFileRead(42dc92c764946a43).(void *data, void *buf, uint32_tcxx . . $ uint32_t# qty); |
| 146 | int StreamPlaycxx . . $ StreamPlay(d157d8952ffc14b5).(const char *filename, float volume, int flags); |
| 147 | void StreamStopcxx . . $ StreamStop(d4f767463ce0a6b3).(int handle); |
| 148 | int StreamGetSoundHandlecxx . . $ StreamGetSoundHandle(7864480464b09eea).(int handle); |
| 149 | |
| 150 | ////////////////////////////////////////////////////////////////////////////// |
| 151 | class llsSystemcxx . . $ llsSystem#; |
| 152 | struct CFILEcxx . . $ CFILE#; |
| 153 | // stream file info |
| 154 | #define OSF_HDR_SIZEcxx . . $ `stream_audio/streamaudio.h:154:9`! 128 |
| 155 | #define OSF_TAGcxx . . $ `stream_audio/streamaudio.h:155:9`! "OSF1" |
| 156 | #define OSF_HDR_TITLE_OFScxx . . $ `stream_audio/streamaudio.h:156:9`! 64 |
| 157 | #define OSF_HDR_TITLE_LENcxx . . $ `stream_audio/streamaudio.h:157:9`! 32 |
| 158 | // stream type |
| 159 | #define OSF_DIGITAL_STRMcxx . . $ `stream_audio/streamaudio.h:159:9`! 0 |
| 160 | // compression type |
| 161 | #define OSF_DIGIRAW_STRMcxx . . $ `stream_audio/streamaudio.h:161:9`! 0 |
| 162 | #define OSF_DIGIACM_STRMcxx . . $ `stream_audio/streamaudio.h:162:9`! 1 |
| 163 | // stream format |
| 164 | #define SAF_8BIT_MASKcxx . . $ `stream_audio/streamaudio.h:164:9`! 0x00 |
| 165 | #define SAF_16BIT_MASKcxx . . $ `stream_audio/streamaudio.h:165:9`! 0x01 |
| 166 | #define SAF_MONO_MASKcxx . . $ `stream_audio/streamaudio.h:166:9`! 0x00 |
| 167 | #define SAF_STEREO_MASKcxx . . $ `stream_audio/streamaudio.h:167:9`! 0x10 |
| 168 | |
| 169 | #define SAF_8BIT_Mcxx . . $ `stream_audio/streamaudio.h:169:9`! (SAF_8BIT_MASKcxx . . $ `stream_audio/streamaudio.h:164:9`! | SAF_MONO_MASKcxx . . $ `stream_audio/streamaudio.h:166:9`!) // 0x00 |
| 170 | #define SAF_8BIT_Scxx . . $ `stream_audio/streamaudio.h:170:9`! (SAF_8BIT_MASKcxx . . $ `stream_audio/streamaudio.h:164:9`! | SAF_STEREO_MASKcxx . . $ `stream_audio/streamaudio.h:167:9`!) // 0x10 |
| 171 | #define SAF_16BIT_Mcxx . . $ `stream_audio/streamaudio.h:171:9`! (SAF_16BIT_MASKcxx . . $ `stream_audio/streamaudio.h:165:9`! | SAF_MONO_MASKcxx . . $ `stream_audio/streamaudio.h:166:9`!) // 0x01 |
| 172 | #define SAF_16BIT_Scxx . . $ `stream_audio/streamaudio.h:172:9`! (SAF_16BIT_MASKcxx . . $ `stream_audio/streamaudio.h:165:9`! | SAF_STEREO_MASKcxx . . $ `stream_audio/streamaudio.h:167:9`!) // 0x11 |
| 173 | ////////////////////////////////////////////////////////////////////////////// |
| 174 | struct tOSFDigiHdrcxx . . $ tOSFDigiHdr# // this struct belongs to OSF_DIGITAL_STRM |
| 175 | { |
| 176 | uint32_tcxx . . $ uint32_t# measurecxx . . $ tOSFDigiHdr#measure.; |
| 177 | }; |
| 178 | class OSFArchivecxx . . $ OSFArchive# { |
| 179 | CFILEcxx . . $ CFILE# *m_fpcxx . . $ OSFArchive#m_fp.; |
| 180 | uint32_tcxx . . $ uint32_t# m_lengthcxx . . $ OSFArchive#m_length.; // file information stored such as length |
| 181 | uint8_tcxx . . $ uint8_t# m_typecxx . . $ OSFArchive#m_type.; // stream type |
| 182 | uint8_tcxx . . $ uint8_t# m_compcxx . . $ OSFArchive#m_comp.; // compression type |
| 183 | uint8_tcxx . . $ uint8_t# m_flagscxx . . $ OSFArchive#m_flags.; // format |
| 184 | uint32_tcxx . . $ uint32_t# m_ratecxx . . $ OSFArchive#m_rate.; // frequency |
| 185 | bool m_writemodecxx . . $ OSFArchive#m_writemode.; // are we in write mode? |
| 186 | unioncxx . . $ OSFArchive#$anonymous_type_0# { |
| 187 | tOSFDigiHdrcxx . . $ tOSFDigiHdr# digicxx . . $ OSFArchive#$anonymous_type_0#digi.; |
| 188 | } m_hdrcxx . . $ OSFArchive#m_hdr.; |
| 189 | char m_namecxx . . $ OSFArchive#m_name.[OSF_HDR_TITLE_LENcxx . . $ `stream_audio/streamaudio.h:157:9`!]; // title string length. |
| 190 | int m_datastartcxx . . $ OSFArchive#m_datastart.; // pointer to start of data. |
| 191 | public: |
| 192 | OSFArchivecxx . . $ OSFArchive#OSFArchive(49f6e7a06ebc5aa8).(); |
| 193 | ~cxx . . $ OSFArchive#`~OSFArchive`(49f6e7a06ebc5aa8).OSFArchivecxx . . $ OSFArchive#(); |
| 194 | bool Opencxx . . $ OSFArchive#Open(e96b1cf346ae2c6).(const char *filename, bool write = false); |
| 195 | void Closecxx . . $ OSFArchive#Close(49f6e7a06ebc5aa8).(); |
| 196 | bool Openedcxx . . $ OSFArchive#Opened(50ce9a9e25b4a850).() const { return m_fpcxx . . $ OSFArchive#m_fp. ? true : false; }; |
| 197 | void Rewindcxx . . $ OSFArchive#Rewind(49f6e7a06ebc5aa8).(); |
| 198 | // write out operations. |
| 199 | bool SaveHeadercxx . . $ OSFArchive#SaveHeader(f1c414a58a83a2e8).(uint8_tcxx . . $ uint8_t# type, uint8_tcxx . . $ uint8_t# comp, uint8_tcxx . . $ uint8_t# flags, uint32_tcxx . . $ uint32_t# rate, uint32_tcxx . . $ uint32_t# length, void *hdr, const char *name); |
| 200 | bool WriteBlockcxx . . $ OSFArchive#WriteBlock(6a46171b248bf29b).(uint8_tcxx . . $ uint8_t# *blk, int size); |
| 201 | // read in operations. |
| 202 | int Readcxx . . $ OSFArchive#Read(7405b416d0535413).(uint8_tcxx . . $ uint8_t# *blk, int size); |
| 203 | // get archive info. |
| 204 | uint8_tcxx . . $ uint8_t# StreamTypecxx . . $ OSFArchive#StreamType(bd807b21b9713a30).() const { return m_typecxx . . $ OSFArchive#m_type.; }; |
| 205 | uint8_tcxx . . $ uint8_t# StreamCompcxx . . $ OSFArchive#StreamComp(bd807b21b9713a30).() const { return m_compcxx . . $ OSFArchive#m_comp.; }; |
| 206 | uint8_tcxx . . $ uint8_t# StreamFormatcxx . . $ OSFArchive#StreamFormat(bd807b21b9713a30).() const { return m_flagscxx . . $ OSFArchive#m_flags.; }; |
| 207 | uint32_tcxx . . $ uint32_t# StreamRatecxx . . $ OSFArchive#StreamRate(ddd8539a2fcdd4ce).() const { return m_ratecxx . . $ OSFArchive#m_rate.; }; |
| 208 | uint32_tcxx . . $ uint32_t# StreamLengthcxx . . $ OSFArchive#StreamLength(ddd8539a2fcdd4ce).() const { return m_lengthcxx . . $ OSFArchive#m_length.; }; |
| 209 | const char *StreamNamecxx . . $ OSFArchive#StreamName(a9f41ea0e82d88cf).() const { return (const char *)m_namecxx . . $ OSFArchive#m_name.; }; |
| 210 | // get header info. |
| 211 | const void *StreamHeadercxx . . $ OSFArchive#StreamHeader(3a8ef3fdc6e817ef).() const { return (void *)&m_hdrcxx . . $ OSFArchive#m_hdr..digicxx . . $ OSFArchive#$anonymous_type_0#digi.; }; |
| 212 | }; |
| 213 | ////////////////////////////////////////////////////////////////////////////// |
| 214 | // streamaudio constants. |
| 215 | #define STRM_BUFCOUNTcxx . . $ `stream_audio/streamaudio.h:215:9`! 4 |
| 216 | #define STRM_BUFSIZEcxx . . $ `stream_audio/streamaudio.h:216:9`! STREAM_BUFFER_SIZE |
| 217 | #define STRM_LIMITcxx . . $ `stream_audio/streamaudio.h:217:9`! 4 |
| 218 | #define STRM_STOPPEDcxx . . $ `stream_audio/streamaudio.h:218:9`! 0x0 |
| 219 | #define STRM_PLAYINGcxx . . $ `stream_audio/streamaudio.h:219:9`! 0x1 |
| 220 | #define STRM_PAUSEDcxx . . $ `stream_audio/streamaudio.h:220:9`! 0x2 |
| 221 | #define STRM_STOPPINGcxx . . $ `stream_audio/streamaudio.h:221:9`! 0x4 |
| 222 | #define STRM_PENDINGcxx . . $ `stream_audio/streamaudio.h:222:9`! 0x8 // DAJ |
| 223 | #define STRM_INVALIDcxx . . $ `stream_audio/streamaudio.h:223:9`! 0xff |
| 224 | // flags used to open stream. |
| 225 | #define STRM_OPNF_ONETIMEcxx . . $ `stream_audio/streamaudio.h:225:9`! 0x1 |
| 226 | #define STRM_OPNF_GRADUALcxx . . $ `stream_audio/streamaudio.h:226:9`! 0x2 |
| 227 | /* This class will handle streams for the music system. |
| 228 | Including allowing an interface to dynamically change the stream. |
| 229 | */ |
| 230 | #define STRM_BUFF_USEDcxx . . $ `stream_audio/streamaudio.h:230:9`! 0x1 // allocated buffer with data |
| 231 | #define STRM_BUFF_TERMINALcxx . . $ `stream_audio/streamaudio.h:231:9`! 0x2 // terminates on this buffer |
| 232 | #define STRM_BUFF_LOOPENDcxx . . $ `stream_audio/streamaudio.h:232:9`! 0x4 // marks last buffer in measure |
| 233 | class AudioStreamcxx . . $ AudioStream# { |
| 234 | OSFArchivecxx . . $ OSFArchive# m_archivecxx . . $ AudioStream#m_archive.; // audio stream archive object. |
| 235 | AudioDecodercxx . . $ AudioDecoder/::IAudioDecodercxx . . $ AudioDecoder/IAudioDecoder# *m_decodercxx . . $ AudioStream#m_decoder.; // audio codec object |
| 236 | structcxx . . $ AudioStream#$anonymous_type_1# { // mixing buffers |
| 237 | uint8_tcxx . . $ uint8_t# *datacxx . . $ AudioStream#$anonymous_type_1#data.; |
| 238 | int nbytescxx . . $ AudioStream#$anonymous_type_1#nbytes.; // number of bytes of valid data. |
| 239 | int flagscxx . . $ AudioStream#$anonymous_type_1#flags.; |
| 240 | int idcxx . . $ AudioStream#$anonymous_type_1#id.; |
| 241 | } m_buffercxx . . $ AudioStream#m_buffer.[STRM_BUFCOUNTcxx . . $ `stream_audio/streamaudio.h:215:9`!]; |
| 242 | int m_bufsizecxx . . $ AudioStream#m_bufsize.; // size of each buffer. |
| 243 | float m_measure_timercxx . . $ AudioStream#m_measure_timer.; // timer for measure checking. |
| 244 | float m_measure_timecxx . . $ AudioStream#m_measure_time.; // amount of time per measure. |
| 245 | float m_last_frametimecxx . . $ AudioStream#m_last_frametime.; |
| 246 | uint8_tcxx . . $ uint8_t# m_sbufidxcxx . . $ AudioStream#m_sbufidx.; // stream position markers |
| 247 | uint8_tcxx . . $ uint8_t# m_fbufidxcxx . . $ AudioStream#m_fbufidx.; // file position markers |
| 248 | uint8_tcxx . . $ uint8_t# m_curbufidxcxx . . $ AudioStream#m_curbufidx.; // current buffer in measure index |
| 249 | uint8_tcxx . . $ uint8_t# m_playcountcxx . . $ AudioStream#m_playcount.; |
| 250 | bool m_readaheadcxx . . $ AudioStream#m_readahead.; // if stream is currently reading from disk |
| 251 | bool m_readahead_finished_loopcxx . . $ AudioStream#m_readahead_finished_loop.; // if a loop's readahead has finished |
| 252 | int16_tcxx . . $ int16_t# m_nbufscxx . . $ AudioStream#m_nbufs.; // number of buffers streamed so far. |
| 253 | play_informationcxx . . $ play_information# m_playinfocxx . . $ AudioStream#m_playinfo.; // used by llsSystem |
| 254 | float m_volumecxx . . $ AudioStream#m_volume.; // volume of stream. |
| 255 | int16_tcxx . . $ int16_t# m_statecxx . . $ AudioStream#m_state., m_laststatecxx . . $ AudioStream#m_laststate.; // current state of stream playing |
| 256 | int m_llshandlecxx . . $ AudioStream#m_llshandle.; // internal sound handle. |
| 257 | int m_flagscxx . . $ AudioStream#m_flags.; // stream playing options. |
| 258 | int16_tcxx . . $ int16_t# m_streamindexcxx . . $ AudioStream#m_streamindex.; // index into active stream table. |
| 259 | int16_tcxx . . $ int16_t# m_loopcountcxx . . $ AudioStream#m_loopcount.; // loop counter. |
| 260 | int m_bytesleftcxx . . $ AudioStream#m_bytesleft.; // number of bytes left in file |
| 261 | int m_curmeasurecxx . . $ AudioStream#m_curmeasure.; // current measure. |
| 262 | int m_playbytesleftcxx . . $ AudioStream#m_playbytesleft., m_playbytestotalcxx . . $ AudioStream#m_playbytestotal.; |
| 263 | int m_curidcxx . . $ AudioStream#m_curid.; // stream's id # |
| 264 | int *m_stopflagcxx . . $ AudioStream#m_stopflag.; // location of stop flag used in stop function |
| 265 | bool m_loopcxx . . $ AudioStream#m_loop.; // are we looping? |
| 266 | bool m_stopnextmeasurecxx . . $ AudioStream#m_stopnextmeasure.; // stop on next measure. |
| 267 | bool m_start_on_framecxx . . $ AudioStream#m_start_on_frame.; // we will play this stream on the next ::Frame call. |
| 268 | bool m_start_on_frame_loopedcxx . . $ AudioStream#m_start_on_frame_looped.; // the stream that will play on next frame is looped. |
| 269 | private: |
| 270 | friend void *AudioStreamCBcxx . . $ AudioStreamCB(9326456ed2624211).(void *user_data, int handle, int *size); |
| 271 | friend int ADecodeFileReadcxx . . $ ADecodeFileRead(42dc92c764946a43).(void *data, void *buf, uint32_tcxx . . $ uint32_t# qty); |
| 272 | void *StreamCallbackcxx . . $ AudioStream#StreamCallback(5b9d5e032d1f146d).(int *size); // invoked by omsStreamCB. |
| 273 | int ReadFileDatacxx . . $ AudioStream#ReadFileData(9b79fb6aee4c0440).(int buf, int len); // reads in decompressed raw data. |
| 274 | int ReadFileDirectcxx . . $ AudioStream#ReadFileDirect(6abd07ddb1a912f0).(char *buf, int len); // reads in decompressed raw data. |
| 275 | void UpdateDatacxx . . $ AudioStream#UpdateData(49f6e7a06ebc5aa8).(); // updates file buffers |
| 276 | void Endcxx . . $ AudioStream#End(49f6e7a06ebc5aa8).(); // cleans up after a stop. |
| 277 | void Resetcxx . . $ AudioStream#Reset(49f6e7a06ebc5aa8).(); // resets to start of stream. |
| 278 | bool OpenDigitalStreamcxx . . $ AudioStream#OpenDigitalStream(c9857a73d68e59ba).(); // opens and prepares a digital stream |
| 279 | bool ReopenDigitalStreamcxx . . $ AudioStream#ReopenDigitalStream(355a5c9433db0802).(uint8_tcxx . . $ uint8_t# fbufidx, int nbufs); |
| 280 | |
| 281 | private: |
| 282 | // attach a low level sound system to all streams. |
| 283 | static llsSystemcxx . . $ llsSystem# *m_ll_sndsyscxx . . $ AudioStream#m_ll_sndsys.; |
| 284 | // list of all currently played streams |
| 285 | static AudioStreamcxx . . $ AudioStream# *m_streamscxx . . $ AudioStream#m_streams.[STRM_LIMITcxx . . $ `stream_audio/streamaudio.h:217:9`!]; |
| 286 | static int m_thisidcxx . . $ AudioStream#m_thisid.; |
| 287 | // allocates a stream slot for a stream |
| 288 | bool ActivateStreamcxx . . $ AudioStream#ActivateStream(321490c9ed9e4edf).(AudioStreamcxx . . $ AudioStream# *stream); |
| 289 | void DeactivateStreamcxx . . $ AudioStream#DeactivateStream(d2c77b78bb8a70f0).(AudioStreamcxx . . $ AudioStream# *stream); |
| 290 | |
| 291 | public: |
| 292 | // sets the low-level sound object |
| 293 | static void InitSystemcxx . . $ AudioStream#InitSystem(81c6c6b1aaadc380).(llsSystemcxx . . $ llsSystem# *sndsys); |
| 294 | // shutdsown |
| 295 | static void Shutdowncxx . . $ AudioStream#Shutdown(49f6e7a06ebc5aa8).(); |
| 296 | // called by application to allow stream playback |
| 297 | static void Framecxx . . $ AudioStream#Frame(49f6e7a06ebc5aa8).(); |
| 298 | // called to pause all streams. |
| 299 | static void PauseAllcxx . . $ AudioStream#PauseAll(49f6e7a06ebc5aa8).(); |
| 300 | static void ResumeAllcxx . . $ AudioStream#ResumeAll(49f6e7a06ebc5aa8).(); |
| 301 | public: |
| 302 | AudioStreamcxx . . $ AudioStream#AudioStream(49f6e7a06ebc5aa8).(); |
| 303 | ~cxx . . $ AudioStream#`~AudioStream`(49f6e7a06ebc5aa8).AudioStreamcxx . . $ AudioStream#(); |
| 304 | // simple operations |
| 305 | // flags specify what type of stream you want. |
| 306 | bool Opencxx . . $ AudioStream#Open(2551bed5d6fc04f6).(const char *filename, int open_flags = 0); |
| 307 | // specifies next stream to be opened when current one ends. |
| 308 | void Closecxx . . $ AudioStream#Close(49f6e7a06ebc5aa8).(); |
| 309 | // simple requests |
| 310 | bool Playcxx . . $ AudioStream#Play(efaadfb7dc14930a).(bool start_on_frame = false); // plays a stream |
| 311 | void Stopcxx . . $ AudioStream#Stop(87564e930d06994).(bool on_measure = false, |
| 312 | int *stop_flag = |
| 313 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // causes a rewind to start of stream, if on_measure is true, stop occurs when measure ends |
| 314 | void SetVolumecxx . . $ AudioStream#SetVolume(9364e6e7bff7660).(float vol); // sets volume |
| 315 | float GetVolumecxx . . $ AudioStream#GetVolume(9b8c9e39889c762c).(); // returns volume |
| 316 | // misc requests |
| 317 | int GetLoopCountcxx . . $ AudioStream#GetLoopCount(455f465bc33b4cdf).() const; // 0 = infinite. |
| 318 | void SetLoopCountcxx . . $ AudioStream#SetLoopCount(d4f767463ce0a6b3).(int loop_count); // sets the number of times this stream will loop (0 = infinite!) |
| 319 | void SetFlagscxx . . $ AudioStream#SetFlags(d4f767463ce0a6b3).(int flags); // sets flags for playback (STRM_OPNF_XXX) |
| 320 | void Pausecxx . . $ AudioStream#Pause(49f6e7a06ebc5aa8).(); // pauses a stream |
| 321 | void Resumecxx . . $ AudioStream#Resume(49f6e7a06ebc5aa8).(); // resumes a paused stream. |
| 322 | // state. |
| 323 | bool ReadAheadcxx . . $ AudioStream#ReadAhead(c9857a73d68e59ba).(); // are we still reading from disk? |
| 324 | bool ReadAheadFinishedLoopcxx . . $ AudioStream#ReadAheadFinishedLoop(c9857a73d68e59ba).(); // has stream finished with its readahead of current loop? |
| 325 | bool IsReadycxx . . $ AudioStream#IsReady(c9857a73d68e59ba).(); // is this stopped stream ready to play? |
| 326 | int Statecxx . . $ AudioStream#State(455f465bc33b4cdf).() const { // returns current state |
| 327 | return m_statecxx . . $ AudioStream#m_state.; |
| 328 | }; |
| 329 | // information |
| 330 | int GetLengthcxx . . $ AudioStream#GetLength(455f465bc33b4cdf).() const { return m_archivecxx . . $ AudioStream#m_archive..StreamLengthcxx . . $ OSFArchive#StreamLength(ddd8539a2fcdd4ce).(); }; |
| 331 | int GetPoscxx . . $ AudioStream#GetPos(455f465bc33b4cdf).() const { return m_archivecxx . . $ AudioStream#m_archive..StreamLengthcxx . . $ OSFArchive#StreamLength(ddd8539a2fcdd4ce).() - m_bytesleftcxx . . $ AudioStream#m_bytesleft.; }; |
| 332 | int GetBufferSizecxx . . $ AudioStream#GetBufferSize(455f465bc33b4cdf).() const { return m_bufsizecxx . . $ AudioStream#m_bufsize.; }; |
| 333 | int CurrentMeasurecxx . . $ AudioStream#CurrentMeasure(455f465bc33b4cdf).() const { // returns current measure. |
| 334 | return m_curmeasurecxx . . $ AudioStream#m_curmeasure.; |
| 335 | }; |
| 336 | int TotalMeasurescxx . . $ AudioStream#TotalMeasures(455f465bc33b4cdf).() const; // total measure count |
| 337 | int GetSoundHandlecxx . . $ AudioStream#GetSoundHandle(455f465bc33b4cdf).() const { // returns the sound library handle for this stream. |
| 338 | return m_llshandlecxx . . $ AudioStream#m_llshandle.; |
| 339 | }; |
| 340 | // these functions are the 'simplified' stream interface from Jeff (most of this code is from Jeff) |
| 341 | friend int StreamPlaycxx . . $ StreamPlay(d157d8952ffc14b5).(const char *filename, float volume, int flags); |
| 342 | friend void StreamStopcxx . . $ StreamStop(d4f767463ce0a6b3).(int handle); |
| 343 | friend int StreamGetSoundHandlecxx . . $ StreamGetSoundHandle(7864480464b09eea).(int handle); |
| 344 | }; |
| 345 | #endif |