| 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/music.h $ |
| 21 | * $Revision: 21 $ |
| 22 | * $Date: 3/18/99 10:13a $ |
| 23 | * $Author: Samir $ |
| 24 | * |
| 25 | * Event driven music system |
| 26 | * |
| 27 | * $Log: /DescentIII/Main/Lib/music.h $ |
| 28 | * |
| 29 | * 21 3/18/99 10:13a Samir |
| 30 | * msuic update. |
| 31 | * |
| 32 | * 20 3/03/99 5:08p Samir |
| 33 | * added slew of debug code: hopefully the library will be revamped after |
| 34 | * OEM. |
| 35 | * |
| 36 | * 19 2/27/99 8:23p Samir |
| 37 | * fixes to music system to act nicely to sudden and frequent region |
| 38 | * changes. |
| 39 | * |
| 40 | * 18 2/27/99 6:52p Samir |
| 41 | * added function to get current loop count |
| 42 | * |
| 43 | * 17 2/27/99 4:37p Samir |
| 44 | * return name of loop currently playing. |
| 45 | * |
| 46 | * 16 2/26/99 5:26p Samir |
| 47 | * fixes to streaming audio to reflect fix in direct sound mixer. |
| 48 | * |
| 49 | * 15 2/22/99 3:23p Luke |
| 50 | * upped size of music buffers |
| 51 | * |
| 52 | * 14 1/28/99 2:22p Samir |
| 53 | * simplified music system for D3. |
| 54 | * |
| 55 | * 13 12/15/98 10:22a Samir |
| 56 | * upped max labels. |
| 57 | * |
| 58 | * 12 12/11/98 4:03p Samir |
| 59 | * made stream public for oms_stream. |
| 60 | * |
| 61 | * 11 12/10/98 10:12a Samir |
| 62 | * uses newer streaming audio library |
| 63 | * |
| 64 | * 10 12/07/98 11:44a Samir |
| 65 | * added new themes. |
| 66 | * |
| 67 | * 9 12/03/98 12:51p Samir |
| 68 | * changed WasStopped to HasStopped. |
| 69 | * |
| 70 | * 8 11/20/98 5:21p Samir |
| 71 | * added SEND_STRM_NEXT |
| 72 | * |
| 73 | * 7 11/13/98 2:29p Samir |
| 74 | * added oms_tracklist and newer music code. |
| 75 | * |
| 76 | * 6 8/14/98 7:37p Matt |
| 77 | * Since PSFILENAME_LEN is now considered to be the max length of the |
| 78 | * string itself (not counting the terminating null), buffers for file |
| 79 | * name need to be PSFILENAME_LEN+1 bytes long. |
| 80 | * |
| 81 | * 5 8/10/98 5:53p Samir |
| 82 | * improved switching between streams and basic background/combat music. |
| 83 | * |
| 84 | * 4 7/28/98 5:43p Samir |
| 85 | * reorg of music system. |
| 86 | * |
| 87 | * 3 7/24/98 5:20p Samir |
| 88 | * first real music checkin. |
| 89 | * |
| 90 | * 2 7/08/98 6:26p Samir |
| 91 | * took out obsolete code. |
| 92 | * |
| 93 | * 2 6/09/97 4:16p Samir |
| 94 | * RCS check in |
| 95 | * |
| 96 | * $NoKeywords: $ |
| 97 | */ |
| 98 | |
| 99 | #ifndef MUSIC_H |
| 100 | #define MUSIC_Hcxx . . $ `music/music.h:100:9`! |
| 101 | |
| 102 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 103 | #include "pserror.h"cxx . . $ `<file>/misc/pserror.h`/ |
| 104 | #include "psclass.h"cxx . . $ `<file>/lib/psclass.h`/ |
| 105 | #include "streamaudio.h"cxx . . $ `<file>/stream_audio/streamaudio.h`/ |
| 106 | |
| 107 | /////////////////////////////////////////////////////////////////////////////// |
| 108 | // These are internal constants for the music sequencer |
| 109 | |
| 110 | #define OMS_NUM_STRMcxx . . $ `music/music.h:110:9`! 2 |
| 111 | #define OMS_STRM_QSIZEcxx . . $ `music/music.h:111:9`! 8 |
| 112 | |
| 113 | // OMS Theme Types |
| 114 | #define OMS_THEME_TYPEScxx . . $ `music/music.h:114:9`! 8 |
| 115 | #define OMS_THEME_TYPE_NONEcxx . . $ `music/music.h:115:9`! 0 |
| 116 | #define OMS_THEME_TYPE_INTROcxx . . $ `music/music.h:116:9`! 1 |
| 117 | #define OMS_THEME_TYPE_IDLEcxx . . $ `music/music.h:117:9`! 2 |
| 118 | #define OMS_THEME_TYPE_COMBATcxx . . $ `music/music.h:118:9`! 3 |
| 119 | #define OMS_THEME_TYPE_DEATHcxx . . $ `music/music.h:119:9`! 4 |
| 120 | #define OMS_THEME_TYPE_IDLE_TO_COMBATcxx . . $ `music/music.h:120:9`! 5 |
| 121 | #define OMS_THEME_TYPE_COMBAT_TO_IDLEcxx . . $ `music/music.h:121:9`! 6 |
| 122 | |
| 123 | // OMS Stream commands |
| 124 | #define OMS_STRM_FREEcxx . . $ `music/music.h:124:9`! 255 // indicates free stream. |
| 125 | #define OMS_STRM_STOPcxx . . $ `music/music.h:125:9`! 0 // stop current stream. |
| 126 | #define OMS_STRM_PLAYcxx . . $ `music/music.h:126:9`! 1 // play current stream. |
| 127 | #define OMS_STRM_FADEOUTcxx . . $ `music/music.h:127:9`! 2 // fades out current stream in (parm secs). |
| 128 | #define OMS_STRM_FADEINcxx . . $ `music/music.h:128:9`! 3 // plays current stream, fade it in. at (parm secs) |
| 129 | #define OMS_STRM_DELAYcxx . . $ `music/music.h:129:9`! 4 // standard delay (parm = time) |
| 130 | #define OMS_STRM_LOADcxx . . $ `music/music.h:130:9`! 5 // loads song (parm = song type). |
| 131 | #define OMS_STRM_PARMcxx . . $ `music/music.h:131:9`! 6 // extra parameter for last stream command (parm = parameter) |
| 132 | #define OMS_STRM_SWITCHcxx . . $ `music/music.h:132:9`! 7 // switches on next measure of this calling stream to the dominant one. |
| 133 | #define OMS_STRM_NEXTcxx . . $ `music/music.h:133:9`! 8 // specifies setting a 'next' request on an opened stream. |
| 134 | |
| 135 | // //////////////////////////////////////////////////////////////////////////// |
| 136 | // generic event item for the queues. |
| 137 | struct oms_q_evtcxx . . $ oms_q_evt# { |
| 138 | uint8_tcxx . . $ uint8_t# cmdcxx . . $ oms_q_evt#cmd.; |
| 139 | unioncxx . . $ oms_q_evt#$anonymous_type_0# { |
| 140 | float fcxx . . $ oms_q_evt#$anonymous_type_0#f.; |
| 141 | int icxx . . $ oms_q_evt#$anonymous_type_0#i.; |
| 142 | void *pcxx . . $ oms_q_evt#$anonymous_type_0#p.; |
| 143 | } parmcxx . . $ oms_q_evt#parm.; |
| 144 | }; |
| 145 | |
| 146 | class OutrageMusicSeqcxx . . $ OutrageMusicSeq#; |
| 147 | |
| 148 | // internal class to the sequencer, handles command-based streams. |
| 149 | class oms_streamcxx . . $ oms_stream# { |
| 150 | friend class OutrageMusicSeqcxx . . $ OutrageMusicSeq#; |
| 151 | |
| 152 | OutrageMusicSeqcxx . . $ OutrageMusicSeq# *m_seqcxx . . $ oms_stream#m_seq.; // parent sequencer. |
| 153 | tQueuecxx . . $ tQueue#<oms_q_evtcxx . . $ oms_q_evt#, OMS_STRM_QSIZEcxx . . $ `music/music.h:111:9`!> m_qcxx . . $ oms_stream#m_q.; // queue of stream commands. |
| 154 | float m_timercxx . . $ oms_stream#m_timer., m_timer_initcxx . . $ oms_stream#m_timer_init.; // timer managed by user. |
| 155 | float m_maxvolcxx . . $ oms_stream#m_maxvol.; // sustained max volume of stream (used in fading). |
| 156 | oms_q_evtcxx . . $ oms_q_evt# m_statuscxx . . $ oms_stream#m_status.; // current command status (operation q item) |
| 157 | int m_stopcountcxx . . $ oms_stream#m_stopcount.; // number of times stopped. |
| 158 | |
| 159 | unioncxx . . $ oms_stream#$anonymous_type_1# { |
| 160 | int icxx . . $ oms_stream#$anonymous_type_1#i.; |
| 161 | float fcxx . . $ oms_stream#$anonymous_type_1#f.; |
| 162 | void *pcxx . . $ oms_stream#$anonymous_type_1#p.; |
| 163 | } m_datacxx . . $ oms_stream#m_data.; // data for internal ops. |
| 164 | unioncxx . . $ oms_stream#$anonymous_type_2# { |
| 165 | int icxx . . $ oms_stream#$anonymous_type_2#i.; |
| 166 | float fcxx . . $ oms_stream#$anonymous_type_2#f.; |
| 167 | void *pcxx . . $ oms_stream#$anonymous_type_2#p.; |
| 168 | } m_data2cxx . . $ oms_stream#m_data2.; // data for internal ops. |
| 169 | |
| 170 | private: |
| 171 | inline void STREAM_COMMANDPcxx . . $ oms_stream#STREAM_COMMANDP(d768f044801d3544).(uint8_tcxx . . $ uint8_t# cmd, void *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 172 | m_statuscxx . . $ oms_stream#m_status..cmdcxx . . $ oms_q_evt#cmd. = cmd; |
| 173 | m_statuscxx . . $ oms_stream#m_status..parmcxx . . $ oms_q_evt#parm..pcxx . . $ oms_q_evt#$anonymous_type_0#p. = p; |
| 174 | } |
| 175 | inline void STREAM_COMMANDFcxx . . $ oms_stream#STREAM_COMMANDF(b7c33f97f9e0ec6e).(uint8_tcxx . . $ uint8_t# cmd, float cmdparm = 0) { |
| 176 | m_statuscxx . . $ oms_stream#m_status..cmdcxx . . $ oms_q_evt#cmd. = cmd; |
| 177 | m_statuscxx . . $ oms_stream#m_status..parmcxx . . $ oms_q_evt#parm..fcxx . . $ oms_q_evt#$anonymous_type_0#f. = cmdparm; |
| 178 | }; |
| 179 | inline void STREAM_COMMANDIcxx . . $ oms_stream#STREAM_COMMANDI(d5cb1b1d97598ec6).(uint8_tcxx . . $ uint8_t# cmd, int cmdparm = 0) { |
| 180 | m_statuscxx . . $ oms_stream#m_status..cmdcxx . . $ oms_q_evt#cmd. = cmd; |
| 181 | m_statuscxx . . $ oms_stream#m_status..parmcxx . . $ oms_q_evt#parm..fcxx . . $ oms_q_evt#$anonymous_type_0#f. = cmdparm; |
| 182 | }; |
| 183 | inline void STREAM_TIMERcxx . . $ oms_stream#STREAM_TIMER(9364e6e7bff7660).(float time_init) { |
| 184 | m_timercxx . . $ oms_stream#m_timer. = time_init; |
| 185 | m_timer_initcxx . . $ oms_stream#m_timer_init. = time_init; |
| 186 | }; |
| 187 | |
| 188 | bool processCommandcxx . . $ oms_stream#processCommand(c9857a73d68e59ba).(); // processes current command on stream |
| 189 | void processQLoadcxx . . $ oms_stream#processQLoad(85c52e162fed56f9).(const char *fname); // processes load song q event. |
| 190 | |
| 191 | public: |
| 192 | oms_streamcxx . . $ oms_stream#oms_stream(49f6e7a06ebc5aa8).(); |
| 193 | ~cxx . . $ oms_stream#`~oms_stream`(49f6e7a06ebc5aa8).oms_streamcxx . . $ oms_stream#(); |
| 194 | |
| 195 | AudioStreamcxx . . $ AudioStream# m_streamcxx . . $ oms_stream#m_stream.; // current audio stream playing |
| 196 | |
| 197 | public: |
| 198 | void Processcxx . . $ oms_stream#Process(9364e6e7bff7660).(float frmtime); // processes a stream's events. |
| 199 | void Sendcxx . . $ oms_stream#Send(36d0edcfc1eef0f6).(oms_q_evtcxx . . $ oms_q_evt# *evt); // sends an event to the stream. |
| 200 | void Resetcxx . . $ oms_stream#Reset(a5fc4bceefd19664).(OutrageMusicSeqcxx . . $ OutrageMusicSeq# *seq = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // reset stream. |
| 201 | void SetVolumecxx . . $ oms_stream#SetVolume(9364e6e7bff7660).(float vol); // volume. |
| 202 | int GetPlayRequestCountcxx . . $ oms_stream#GetPlayRequestCount(b126dc7c1de90089).(); // tells how many play events send are pending processing. |
| 203 | |
| 204 | // event senders |
| 205 | public: |
| 206 | void SEND_STRM_LOADcxx . . $ oms_stream#SEND_STRM_LOAD(85c52e162fed56f9).(const char *fname); |
| 207 | void SEND_STRM_FADEOUTcxx . . $ oms_stream#SEND_STRM_FADEOUT(9364e6e7bff7660).(float time); |
| 208 | void SEND_STRM_FADEINcxx . . $ oms_stream#SEND_STRM_FADEIN(9364e6e7bff7660).(float time); |
| 209 | void SEND_STRM_STOPcxx . . $ oms_stream#SEND_STRM_STOP(49f6e7a06ebc5aa8).(); |
| 210 | void SEND_STRM_PLAYcxx . . $ oms_stream#SEND_STRM_PLAY(c65574cb55d59f26).(float vol, uint8_tcxx . . $ uint8_t# count); |
| 211 | void SEND_STRM_FREEcxx . . $ oms_stream#SEND_STRM_FREE(49f6e7a06ebc5aa8).(); |
| 212 | void SEND_STRM_SWITCHcxx . . $ oms_stream#SEND_STRM_SWITCH(c13a04b6074e49a2).(bool *switch_flag); // when stream is done, changes value of flag. |
| 213 | void SEND_STRM_NEXTcxx . . $ oms_stream#SEND_STRM_NEXT(3d35f441af9ce940).(const char *fname, float vol, uint8_tcxx . . $ uint8_t# count, |
| 214 | bool *switch_flag); // specifies next stream to play in current stream. |
| 215 | |
| 216 | // return values (after process is called, this is updated.) |
| 217 | public: |
| 218 | bool m_valid_resultcxx . . $ oms_stream#m_valid_result.; // is this a valid returned result? |
| 219 | oms_q_evtcxx . . $ oms_q_evt# m_resultcxx . . $ oms_stream#m_result.; // result event returned from process. |
| 220 | }; |
| 221 | |
| 222 | class oms_tracklistcxx . . $ oms_tracklist# { |
| 223 | char **m_fnamelistcxx . . $ oms_tracklist#m_fnamelist.; // filename list |
| 224 | char **m_symlistcxx . . $ oms_tracklist#m_symlist.; // symbolic list |
| 225 | int16_tcxx . . $ int16_t# m_numtrackscxx . . $ oms_tracklist#m_numtracks.; // number of tracks |
| 226 | int16_tcxx . . $ int16_t# m_maxtrackscxx . . $ oms_tracklist#m_maxtracks.; |
| 227 | bool m_initcxx . . $ oms_tracklist#m_init.; // determines if initialized |
| 228 | |
| 229 | public: |
| 230 | oms_tracklistcxx . . $ oms_tracklist#oms_tracklist(49f6e7a06ebc5aa8).(); |
| 231 | ~cxx . . $ oms_tracklist#`~oms_tracklist`(49f6e7a06ebc5aa8).oms_tracklistcxx . . $ oms_tracklist#(); |
| 232 | |
| 233 | void initcxx . . $ oms_tracklist#init(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# maxtracks); // initializes track list system |
| 234 | void freecxx . . $ oms_tracklist#free(49f6e7a06ebc5aa8).(); // frees track list system |
| 235 | void resetcxx . . $ oms_tracklist#reset(49f6e7a06ebc5aa8).(); // resets track list to 0 |
| 236 | |
| 237 | bool addcxx . . $ oms_tracklist#add(b7a7aa4a824b7595).(const char *fname, const char *sym); |
| 238 | const char *getcxx . . $ oms_tracklist#get(fb58d2e09a2a1ce6).(const char *sym); // returns a track filename. |
| 239 | }; |
| 240 | |
| 241 | // //////////////////////////////////////////////////////////////////////////// |
| 242 | // The Outrage Music Sequencer v1.0 |
| 243 | // playback songs with special FX. |
| 244 | // this is an intermediate between song playback and event driven music. |
| 245 | // the calling application must act as the 'brain' in most cases. |
| 246 | |
| 247 | typedef int16_tcxx . . $ int16_t# tMusicValcxx . . $ tMusicVal#; // used for paramaters |
| 248 | |
| 249 | inline float NORMALIZE_MUSICVALcxx . . $ NORMALIZE_MUSICVAL(3045ab9ceb343f89).(tMusicValcxx . . $ tMusicVal# val) { return ((float)val) / 255.0f; } |
| 250 | inline tMusicValcxx . . $ tMusicVal# QUANTIZE_MUSICVALcxx . . $ QUANTIZE_MUSICVAL(16fe5f45793b5599).(float fval) { return (fval * 255); } |
| 251 | |
| 252 | #define MAX_MUSIC_INSTRUCTIONScxx . . $ `music/music.h:252:9`! 1280 |
| 253 | #define MAX_MUSIC_STRLENcxx . . $ `music/music.h:253:9`! 2048 |
| 254 | #define N_MUSIC_REGScxx . . $ `music/music.h:254:9`! 16 |
| 255 | |
| 256 | // OMS Events |
| 257 | #define OMSEVT_MAKEcxx . . $ `music/music.h:257:9`!(_evt, _priority) (((_evt) << 2) + (_priority & 0x03)) |
| 258 | #define OMSEVT_PRIORITYcxx . . $ `music/music.h:258:9`!(_evt) ((_evt) & 0x3) |
| 259 | |
| 260 | #define OMS_EVT_NONEcxx . . $ `music/music.h:260:9`! OMSEVT_MAKEcxx . . $ `music/music.h:257:9`!(0, 0) |
| 261 | #define OMS_EVT_SONGENDEDcxx . . $ `music/music.h:261:9`! OMSEVT_MAKEcxx . . $ `music/music.h:257:9`!(32, 0) // music completed (parm tells us what theme) |
| 262 | #define OMS_EVT_LOOPENDINGcxx . . $ `music/music.h:262:9`! OMSEVT_MAKEcxx . . $ `music/music.h:257:9`!(31, 0) // a loop is ending. |
| 263 | |
| 264 | // class |
| 265 | class OutrageMusicSeqcxx . . $ OutrageMusicSeq# { |
| 266 | friend class oms_streamcxx . . $ oms_stream#; // stream should know about data here. |
| 267 | |
| 268 | // music scripting system. |
| 269 | struct music_inscxx . . $ OutrageMusicSeq#music_ins# { |
| 270 | uint8_tcxx . . $ uint8_t# cmdcxx . . $ OutrageMusicSeq#music_ins#cmd.; // OMFCMD_ |
| 271 | unioncxx . . $ OutrageMusicSeq#music_ins#$anonymous_type_3# { |
| 272 | tMusicValcxx . . $ tMusicVal# numcxx . . $ OutrageMusicSeq#music_ins#$anonymous_type_3#num.; |
| 273 | char *strcxx . . $ OutrageMusicSeq#music_ins#$anonymous_type_3#str.; |
| 274 | } oprcxx . . $ OutrageMusicSeq#music_ins#opr.; // operand is either numeric or a string |
| 275 | }; |
| 276 | |
| 277 | struct music_streamcxx . . $ OutrageMusicSeq#music_stream# { |
| 278 | oms_streamcxx . . $ oms_stream# *strmcxx . . $ OutrageMusicSeq#music_stream#strm.; // attached stream. |
| 279 | oms_streamcxx . . $ oms_stream# *old_strmcxx . . $ OutrageMusicSeq#music_stream#old_strm.; // previous stream. |
| 280 | const char *loop_namecxx . . $ OutrageMusicSeq#music_stream#loop_name.; |
| 281 | const char *pending_loop_namecxx . . $ OutrageMusicSeq#music_stream#pending_loop_name.; // loop name preparing to play. |
| 282 | int16_tcxx . . $ int16_t# regioncxx . . $ OutrageMusicSeq#music_stream#region.; // region id. |
| 283 | int16_tcxx . . $ int16_t# typecxx . . $ OutrageMusicSeq#music_stream#type.; |
| 284 | music_inscxx . . $ OutrageMusicSeq#music_ins# *inscxx . . $ OutrageMusicSeq#music_stream#ins.; // intro, combat, etc. section |
| 285 | int16_tcxx . . $ int16_t# last_ipcxx . . $ OutrageMusicSeq#music_stream#last_ip.; // last ip value |
| 286 | int16_tcxx . . $ int16_t# ipcxx . . $ OutrageMusicSeq#music_stream#ip.; |
| 287 | tMusicValcxx . . $ tMusicVal# b_regcxx . . $ OutrageMusicSeq#music_stream#b_reg.; // branch register |
| 288 | tMusicValcxx . . $ tMusicVal# c_regcxx . . $ OutrageMusicSeq#music_stream#c_reg.; // compare regs |
| 289 | tMusicValcxx . . $ tMusicVal# p_regcxx . . $ OutrageMusicSeq#music_stream#p_reg.; // play count register. |
| 290 | tMusicValcxx . . $ tMusicVal# i_regcxx . . $ OutrageMusicSeq#music_stream#i_reg.; // iteration register |
| 291 | const char *ln_regcxx . . $ OutrageMusicSeq#music_stream#ln_reg.; // loopname register |
| 292 | bool request_stopcxx . . $ OutrageMusicSeq#music_stream#request_stop.; // we're requesting to stop at end of song. |
| 293 | bool ifi_blockcxx . . $ OutrageMusicSeq#music_stream#ifi_block.; // are we executing an ifi block? |
| 294 | bool immediate_switchcxx . . $ OutrageMusicSeq#music_stream#immediate_switch.; // immediate switch to new song. |
| 295 | bool stream_idlecxx . . $ OutrageMusicSeq#music_stream#stream_idle.; // are we in a next switch? |
| 296 | bool errorcxx . . $ OutrageMusicSeq#music_stream#error.; |
| 297 | uint8_tcxx . . $ uint8_t# padcxx . . $ OutrageMusicSeq#music_stream#pad.[3]; |
| 298 | }; |
| 299 | |
| 300 | // data |
| 301 | tMusicValcxx . . $ tMusicVal# m_registerscxx . . $ OutrageMusicSeq#m_registers.[N_MUSIC_REGScxx . . $ `music/music.h:254:9`!]; // registers |
| 302 | music_streamcxx . . $ OutrageMusicSeq#music_stream# *m_active_songcxx . . $ OutrageMusicSeq#m_active_song., *m_pending_songcxx . . $ OutrageMusicSeq#m_pending_song., *m_playing_songcxx . . $ OutrageMusicSeq#m_playing_song.; |
| 303 | oms_streamcxx . . $ oms_stream# m_strmcxx . . $ OutrageMusicSeq#m_strm.[OMS_NUM_STRMcxx . . $ `music/music.h:110:9`!]; // stream attached to it. |
| 304 | |
| 305 | bool m_sequencer_runcxx . . $ OutrageMusicSeq#m_sequencer_run.; // do we run the sequencer. |
| 306 | bool m_sequencer_initcxx . . $ OutrageMusicSeq#m_sequencer_init.; // is sequencer initialized. |
| 307 | int m_dominant_strmcxx . . $ OutrageMusicSeq#m_dominant_strm.; // which stream is dominant. |
| 308 | float m_timercxx . . $ OutrageMusicSeq#m_timer.; // master timer. |
| 309 | float m_mastervolcxx . . $ OutrageMusicSeq#m_mastervol.; // master volume. |
| 310 | |
| 311 | oms_tracklistcxx . . $ oms_tracklist# m_tracklistcxx . . $ OutrageMusicSeq#m_tracklist.; // sequencer track list. |
| 312 | tListcxx . . $ tList#<music_streamcxx . . $ OutrageMusicSeq#music_stream#> m_music_listcxx . . $ OutrageMusicSeq#m_music_list.; // list of tracks. |
| 313 | |
| 314 | int16_tcxx . . $ int16_t# m_curregioncxx . . $ OutrageMusicSeq#m_curregion.; // current region. |
| 315 | |
| 316 | private: |
| 317 | // Music list management |
| 318 | music_streamcxx . . $ OutrageMusicSeq#music_stream# *AddToListcxx . . $ OutrageMusicSeq#AddToList(f85d6ba651fd2932).(int16_tcxx . . $ int16_t# region, int16_tcxx . . $ int16_t# theme_type, int n_inst, const music_inscxx . . $ OutrageMusicSeq#music_ins# *ins); |
| 319 | void FreeListcxx . . $ OutrageMusicSeq#FreeList(49f6e7a06ebc5aa8).(); |
| 320 | music_streamcxx . . $ OutrageMusicSeq#music_stream# *GetSongcxx . . $ OutrageMusicSeq#GetSong(6b0dba704165f12d).(int16_tcxx . . $ int16_t# region, int16_tcxx . . $ int16_t# theme_type); |
| 321 | bool LoadThemecxx . . $ OutrageMusicSeq#LoadTheme(c5f7da30cbc0f4e9).(const char *file); // takes a filename containing oms data. |
| 322 | |
| 323 | void ExecScriptcxx . . $ OutrageMusicSeq#ExecScript(4d93a3f1eb77106f).(music_streamcxx . . $ OutrageMusicSeq#music_stream# *strm); |
| 324 | |
| 325 | inline int DOMINANT_STRM_ADJUSTcxx . . $ OutrageMusicSeq#DOMINANT_STRM_ADJUST(b126dc7c1de90089).() { |
| 326 | int nstrm = m_dominant_strmcxx . . $ OutrageMusicSeq#m_dominant_strm. + 1; |
| 327 | if (nstrm == OMS_NUM_STRMcxx . . $ `music/music.h:110:9`!) |
| 328 | nstrm = 0; |
| 329 | return nstrm; |
| 330 | }; |
| 331 | |
| 332 | private: |
| 333 | music_inscxx . . $ OutrageMusicSeq#music_ins# *m_ins_buffercxx . . $ OutrageMusicSeq#m_ins_buffer.; // music instruction buffer |
| 334 | music_inscxx . . $ OutrageMusicSeq#music_ins# *m_ins_curptrcxx . . $ OutrageMusicSeq#m_ins_curptr.; // current pointer to free instruction buffer. |
| 335 | char *m_str_buffercxx . . $ OutrageMusicSeq#m_str_buffer.; // string buffer. |
| 336 | char *m_str_curptrcxx . . $ OutrageMusicSeq#m_str_curptr.; // current pointer to free string |
| 337 | |
| 338 | music_inscxx . . $ OutrageMusicSeq#music_ins# *alloc_and_copy_inscxx . . $ OutrageMusicSeq#alloc_and_copy_ins(a6d3bfd1aa71f3e4).(int len, const music_inscxx . . $ OutrageMusicSeq#music_ins# *ins); |
| 339 | char *alloc_and_copy_strcxx . . $ OutrageMusicSeq#alloc_and_copy_str(a8b8e32347182212).(const char *str); |
| 340 | |
| 341 | public: |
| 342 | OutrageMusicSeqcxx . . $ OutrageMusicSeq#OutrageMusicSeq(49f6e7a06ebc5aa8).(); |
| 343 | ~cxx . . $ OutrageMusicSeq#`~OutrageMusicSeq`(49f6e7a06ebc5aa8).OutrageMusicSeqcxx . . $ OutrageMusicSeq#(); |
| 344 | |
| 345 | // takes a OMS theme file. |
| 346 | bool Initcxx . . $ OutrageMusicSeq#Init(c5f7da30cbc0f4e9).(const char *theme_file); |
| 347 | void Shutdowncxx . . $ OutrageMusicSeq#Shutdown(49f6e7a06ebc5aa8).(); |
| 348 | |
| 349 | bool IsSequencerRunningcxx . . $ OutrageMusicSeq#IsSequencerRunning(50ce9a9e25b4a850).() const { return m_sequencer_initcxx . . $ OutrageMusicSeq#m_sequencer_init. && m_sequencer_runcxx . . $ OutrageMusicSeq#m_sequencer_run.; } |
| 350 | |
| 351 | // starts the sequencer (usually at the beginning of a level) |
| 352 | void Startcxx . . $ OutrageMusicSeq#Start(49f6e7a06ebc5aa8).(); |
| 353 | |
| 354 | // stops the sequencer, flushes events |
| 355 | void Stopcxx . . $ OutrageMusicSeq#Stop(49f6e7a06ebc5aa8).(); |
| 356 | |
| 357 | // do a frame |
| 358 | void Framecxx . . $ OutrageMusicSeq#Frame(9364e6e7bff7660).(float frame_time); |
| 359 | |
| 360 | // set volume of sequencer |
| 361 | void SetVolumecxx . . $ OutrageMusicSeq#SetVolume(9364e6e7bff7660).(float vol); |
| 362 | |
| 363 | // start a song, stopping the old either cleanly (on measure) or abruptly. |
| 364 | void StartSongcxx . . $ OutrageMusicSeq#StartSong(918ebd27a9ddbad3).(int song, bool clean_switch); |
| 365 | |
| 366 | // stops song, cold. |
| 367 | void StopSongcxx . . $ OutrageMusicSeq#StopSong(49f6e7a06ebc5aa8).(); |
| 368 | |
| 369 | // pauses |
| 370 | void Pausecxx . . $ OutrageMusicSeq#Pause(49f6e7a06ebc5aa8).(); |
| 371 | |
| 372 | // resumes |
| 373 | void Resumecxx . . $ OutrageMusicSeq#Resume(49f6e7a06ebc5aa8).(); |
| 374 | |
| 375 | // get and set user defined (theme file) parameters |
| 376 | void SetRegistercxx . . $ OutrageMusicSeq#SetRegister(ce859b6b863b003).(int parm, tMusicValcxx . . $ tMusicVal# val); |
| 377 | tMusicValcxx . . $ tMusicVal# GetRegistercxx . . $ OutrageMusicSeq#GetRegister(60050ad348e56ea6).(int parm); |
| 378 | |
| 379 | // region setting |
| 380 | void SetCurrentRegioncxx . . $ OutrageMusicSeq#SetCurrentRegion(68e3ae50fe6578a9).(int16_tcxx . . $ int16_t# region); |
| 381 | int16_tcxx . . $ int16_t# GetCurrentRegioncxx . . $ OutrageMusicSeq#GetCurrentRegion(524863554b4a534e).() const; |
| 382 | |
| 383 | // gets current region PLAYING, not PENDING like above. |
| 384 | int16_tcxx . . $ int16_t# GetPlayingRegioncxx . . $ OutrageMusicSeq#GetPlayingRegion(524863554b4a534e).() const; |
| 385 | |
| 386 | // get current loop playing |
| 387 | const char *GetCurrentLoopNamecxx . . $ OutrageMusicSeq#GetCurrentLoopName(417cf66b9f96246d).(int *loop_count); |
| 388 | |
| 389 | public: |
| 390 | tQueuecxx . . $ tQueue#<oms_q_evtcxx . . $ oms_q_evt#, 4> m_output_qcxx . . $ OutrageMusicSeq#m_output_q.; // output events |
| 391 | }; |
| 392 | |
| 393 | #endif |