Ticket #5476: psp-pix2-source13.patch
File psp-pix2-source13.patch, 89.1 KB (added by , 14 years ago) |
---|
-
backends/platform/psp/input.cpp
33 33 34 34 #include "backends/platform/psp/psppixelformat.h" 35 35 #include "backends/platform/psp/input.h" 36 #include "gui/message.h" 36 37 37 38 // Defines for working with PSP buttons 38 39 #define CHANGED(x) (_buttonsChanged & (x)) … … 45 46 #define PSP_TRIGGERS (PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER) 46 47 47 48 #define PAD_CHECK_TIME 53 49 #define CONTROL_MODE_CHANGE_TIME 2000 48 50 49 51 void InputHandler::init() { 50 52 sceCtrlSetSamplingCycle(0); // set sampling to vsync. n = n usecs 51 53 sceCtrlSetSamplingMode(1); // analog 54 _lastControlModeChangeTime=0; 52 55 } 53 56 54 57 bool InputHandler::getAllInputs(Common::Event &event) { … … 106 109 107 110 int newDpadX = 0, newDpadY = 0; 108 111 bool haveEvent = false; 109 110 if (DOWN(PSP_CTRL_UP)) { 111 newDpadY++; 112 if (DOWN(PSP_CTRL_RTRIGGER)) // Shifting causes diagonals 112 113 if(_lolControlMode) { 114 //alternative controls for Lands Of Lore control mode 115 116 //don't need diagonals...... 117 if (DOWN(PSP_CTRL_UP)) { 118 newDpadY++; 119 } 120 if (DOWN(PSP_CTRL_RIGHT)) { 121 newDpadX++; 122 } 123 if (DOWN(PSP_CTRL_DOWN)) { 124 newDpadY--; 125 } 126 if (DOWN(PSP_CTRL_LEFT)) { 127 newDpadX--; 128 } 129 130 if(DOWN(PSP_CTRL_SQUARE)) { //if square pressed the d-pad maps to the four fight buttons 131 if (_dpadX == 0 && _dpadY == 0) { // We were in the middle so we pressed dpad 132 event.type = Common::EVENT_KEYDOWN; 133 event.kbd.keycode = translateDpadLol(newDpadX, newDpadY, true); 134 event.kbd.ascii = event.kbd.keycode + 33; // Get ascii 135 haveEvent = true; 136 _dpadX = newDpadX; 137 _dpadY = newDpadY; 138 } else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad 139 event.type = Common::EVENT_KEYUP; 140 event.kbd.keycode = translateDpadLol(_dpadX, _dpadY, true); 141 event.kbd.ascii = event.kbd.keycode + 33; // Get ascii 142 haveEvent = true; 143 _dpadX = newDpadX; 144 _dpadY = newDpadY; 145 } else { // we moved from one pressed dpad direction to another one 146 event.type = Common::EVENT_KEYUP; 147 event.kbd.keycode = translateDpadLol(_dpadX, _dpadY, true); 148 event.kbd.ascii = event.kbd.keycode + 33; // Get ascii 149 haveEvent = true; 150 _dpadX = 0; 151 _dpadY = 0; 152 } 153 } else { // If square not pressed then dpad maps to movement controls. 154 if (newDpadX != _dpadX || newDpadY != _dpadY) { 155 if (_dpadX == 0 && _dpadY == 0) { // We were in the middle so we pressed dpad 156 event.type = Common::EVENT_KEYDOWN; 157 event.kbd.keycode = translateDpadLol(newDpadX, newDpadY, false); 158 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; // Get ascii 159 _dpadX = newDpadX; 160 _dpadY = newDpadY; 161 } else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad 162 event.type = Common::EVENT_KEYUP; 163 event.kbd.keycode = translateDpadLol(_dpadX, _dpadY, false); 164 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 165 _dpadX = newDpadX; 166 _dpadY = newDpadY; 167 } else { // we moved from one pressed dpad direction to another one 168 event.type = Common::EVENT_KEYUP; // first release the last dpad direction 169 event.kbd.keycode = translateDpadLol(_dpadX, _dpadY, false); 170 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 171 _dpadX = 0; // so that we'll pick up a new dpad movement the next round 172 _dpadY = 0; 173 } 174 PSP_DEBUG_PRINT("Keypad event. DpadX[%d], DpadY[%d]\n", _dpadX, _dpadY); 175 haveEvent = true; 176 } 177 } 178 } else { 179 if (DOWN(PSP_CTRL_UP)) { 180 newDpadY++; 181 if (DOWN(PSP_CTRL_RTRIGGER)) // Shifting causes diagonals 182 newDpadX++; 183 } 184 if (DOWN(PSP_CTRL_RIGHT)) { 113 185 newDpadX++; 114 }115 if (DOWN(PSP_CTRL_RIGHT)) {116 newDpadX++;117 if (DOWN(PSP_CTRL_ RTRIGGER))186 if (DOWN(PSP_CTRL_RTRIGGER)) 187 newDpadY--; 188 } 189 if (DOWN(PSP_CTRL_DOWN)) { 118 190 newDpadY--; 119 }120 if (DOWN(PSP_CTRL_DOWN)) {121 newDpadY--;122 if (DOWN(PSP_CTRL_ RTRIGGER))191 if (DOWN(PSP_CTRL_RTRIGGER)) 192 newDpadX--; 193 } 194 if (DOWN(PSP_CTRL_LEFT)) { 123 195 newDpadX--; 124 } 125 if (DOWN(PSP_CTRL_LEFT)) { 126 newDpadX--; 127 if (DOWN(PSP_CTRL_RTRIGGER)) 128 newDpadY++; 129 } 130 131 if (newDpadX != _dpadX || newDpadY != _dpadY) { 132 if (_dpadX == 0 && _dpadY == 0) { // We were in the middle so we pressed dpad 133 event.type = Common::EVENT_KEYDOWN; 134 event.kbd.keycode = translateDpad(newDpadX, newDpadY); 135 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; // Get ascii 136 _dpadX = newDpadX; 137 _dpadY = newDpadY; 138 } else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad 139 event.type = Common::EVENT_KEYUP; 140 event.kbd.keycode = translateDpad(_dpadX, _dpadY); 141 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 142 _dpadX = newDpadX; 143 _dpadY = newDpadY; 144 } else { // we moved from one pressed dpad direction to another one 145 event.type = Common::EVENT_KEYUP; // first release the last dpad direction 146 event.kbd.keycode = translateDpad(_dpadX, _dpadY); 147 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 148 _dpadX = 0; // so that we'll pick up a new dpad movement the next round 149 _dpadY = 0; 196 if (DOWN(PSP_CTRL_RTRIGGER)) 197 newDpadY++; 150 198 } 151 152 PSP_DEBUG_PRINT("Keypad event. DpadX[%d], DpadY[%d]\n", _dpadX, _dpadY); 153 haveEvent = true; 154 } 155 199 200 if (newDpadX != _dpadX || newDpadY != _dpadY) { 201 if (_dpadX == 0 && _dpadY == 0) { // We were in the middle so we pressed dpad 202 event.type = Common::EVENT_KEYDOWN; 203 event.kbd.keycode = translateDpad(newDpadX, newDpadY); 204 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; // Get ascii 205 _dpadX = newDpadX; 206 _dpadY = newDpadY; 207 } else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad 208 event.type = Common::EVENT_KEYUP; 209 event.kbd.keycode = translateDpad(_dpadX, _dpadY); 210 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 211 _dpadX = newDpadX; 212 _dpadY = newDpadY; 213 } else { // we moved from one pressed dpad direction to another one 214 event.type = Common::EVENT_KEYUP; // first release the last dpad direction 215 event.kbd.keycode = translateDpad(_dpadX, _dpadY); 216 event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; 217 _dpadX = 0; // so that we'll pick up a new dpad movement the next round 218 _dpadY = 0; 219 } 220 221 PSP_DEBUG_PRINT("Keypad event. DpadX[%d], DpadY[%d]\n", _dpadX, _dpadY); 222 haveEvent = true; 223 } 224 } 156 225 return haveEvent; 157 226 } 158 227 159 228 inline Common::KeyCode InputHandler::translateDpad(int x, int y) { 160 229 DEBUG_ENTER_FUNC(); 161 230 Common::KeyCode key; … … 184 253 return key; 185 254 } 186 255 256 inline Common::KeyCode InputHandler::translateDpadLol(int x, int y, bool fight) { 257 DEBUG_ENTER_FUNC(); 258 Common::KeyCode key; 259 if(fight) { 260 if (x == -1) key = Common::KEYCODE_F1; 261 else if (x == 1) key = Common::KEYCODE_F3; 262 else if (y == 1) key = Common::KEYCODE_F2; 263 else if (y == -1) key = Common::KEYCODE_F4; 264 } else { 265 if (x == -1) key = Common::KEYCODE_KP7; 266 else if (x == 1) key = Common::KEYCODE_KP9; 267 else if (y == 1) key = Common::KEYCODE_KP8; 268 else if (y == -1) key = Common::KEYCODE_KP2; 269 } 270 return key; 271 } 187 272 273 188 274 bool InputHandler::getButtonEvent(Common::Event &event, SceCtrlData &pad) { 189 275 DEBUG_ENTER_FUNC(); 190 276 bool haveEvent = false; 191 277 192 if (PRESSED(PSP_CTRL_SELECT))193 _keyboard->setVisible(true);278 //Change to LOL mode if square,triangle,X & O pressed simultaneouly. 279 //Only change if no other buttons are pressed to avoid sticking keys. 194 280 195 else if (CHANGED(PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START)) { 196 if (CHANGED(PSP_CTRL_CROSS)) { 197 event.type = DOWN(PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP; 198 event.mouse.x = _cursor->getX(); // Could this have to do with SCI enter problem? 199 event.mouse.y = _cursor->getY(); 200 PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "LButtonDown" : "LButtonUp"); 201 } else if (CHANGED(PSP_CTRL_CIRCLE)) { 202 event.type = DOWN(PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP; 203 event.mouse.x = _cursor->getX(); 204 event.mouse.y = _cursor->getY(); 281 if(DOWN(PSP_CTRL_CROSS) && DOWN(PSP_CTRL_SQUARE) && DOWN(PSP_CTRL_CIRCLE) && DOWN(PSP_CTRL_TRIANGLE) && !DOWN(PSP_CTRL_LEFT) && !DOWN(PSP_CTRL_DOWN) && !DOWN(PSP_CTRL_UP) && !DOWN(PSP_CTRL_RIGHT) && !DOWN(PSP_CTRL_LTRIGGER) && !DOWN(PSP_CTRL_START)) { 282 uint32 time = g_system->getMillis(); 283 //Only change mode if enough time passed since last change 284 if(time -_lastControlModeChangeTime > CONTROL_MODE_CHANGE_TIME) { 285 if(_lolControlMode) { 286 _lolControlMode=false; 287 _lastControlModeChangeTime=time; 288 GUI::TimedMessageDialog dialog("Normal Button Mode", 1500); 289 dialog.runModal(); 290 } else { 291 _lolControlMode=true; 292 _lastControlModeChangeTime=time; 293 //send keyup for . which is mapped to square in normal mode 294 event.type = Common::EVENT_KEYUP; 295 event.kbd.keycode = Common::KEYCODE_PERIOD; 296 event.kbd.ascii = '.'; 297 haveEvent=true; 298 299 GUI::TimedMessageDialog dialog("1st Person Button Mode", 1500); 300 dialog.runModal(); 301 } 302 return haveEvent; 303 } 304 } 305 if(_lolControlMode) { 306 if (PRESSED(PSP_CTRL_SELECT)) 307 _keyboard->setVisible(true); 308 309 else if (CHANGED(PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START)) { 310 if (CHANGED(PSP_CTRL_CROSS)) { 311 event.type = DOWN(PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP; 312 event.mouse.x = _cursor->getX(); // Could this have to do with SCI enter problem? 313 event.mouse.y = _cursor->getY(); 314 PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "LButtonDown" : "LButtonUp"); 315 } else if (CHANGED(PSP_CTRL_CIRCLE)) { 316 event.type = DOWN(PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP; 317 event.mouse.x = _cursor->getX(); 318 event.mouse.y = _cursor->getY(); 205 319 PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "RButtonDown" : "RButtonUp"); 206 } else { 207 //any of the other buttons. 208 event.type = _buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; 209 event.kbd.ascii = 0; 210 event.kbd.flags = 0; 211 212 if (CHANGED(PSP_CTRL_LTRIGGER)) { 213 event.kbd.keycode = Common::KEYCODE_ESCAPE; 214 event.kbd.ascii = 27; 215 } else if (CHANGED(PSP_CTRL_START)) { 216 event.kbd.keycode = Common::KEYCODE_F5; 217 event.kbd.ascii = Common::ASCII_F5; 218 if (DOWN(PSP_CTRL_RTRIGGER)) { 219 event.kbd.flags |= Common::KBD_CTRL; // Main menu to allow RTL 320 } else { 321 //any of the other buttons. 322 event.type = _buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; 323 event.kbd.ascii = 0; 324 event.kbd.flags = 0; 325 326 if (CHANGED(PSP_CTRL_LTRIGGER)) { 327 event.kbd.keycode = Common::KEYCODE_KP4; 328 event.kbd.ascii = Common::KEYCODE_KP4; 329 } else if (CHANGED(PSP_CTRL_SQUARE)) { //need to keyup movement/fighting keys to make certain they don't get stuck 330 if(DOWN(PSP_CTRL_SQUARE)) { 331 _dpadX = 0; 332 _dpadY = 0; 333 if(DOWN(PSP_CTRL_UP)) { 334 event.type = Common::EVENT_KEYUP; 335 event.kbd.keycode = Common::KEYCODE_KP8; 336 event.kbd.ascii = Common::KEYCODE_KP8; 337 } else if(DOWN(PSP_CTRL_LEFT)) { 338 event.type = Common::EVENT_KEYUP; 339 event.kbd.keycode = Common::KEYCODE_KP4; 340 event.kbd.ascii = Common::KEYCODE_KP4; 341 } else if(DOWN(PSP_CTRL_RIGHT)) { 342 event.type = Common::EVENT_KEYUP; 343 event.kbd.keycode = Common::KEYCODE_KP6; 344 event.kbd.ascii = Common::KEYCODE_KP6; 345 } else if(DOWN(PSP_CTRL_DOWN)) { 346 event.type = Common::EVENT_KEYUP; 347 event.kbd.keycode = Common::KEYCODE_KP2; 348 event.kbd.ascii = Common::KEYCODE_KP2; 349 } else return haveEvent; 350 } else { 351 _dpadX = 0; 352 _dpadY = 0; 353 if(DOWN(PSP_CTRL_UP)) { 354 event.type = Common::EVENT_KEYUP; 355 event.kbd.keycode = Common::KEYCODE_F2; 356 event.kbd.ascii = Common::ASCII_F2; 357 } else if(DOWN(PSP_CTRL_LEFT)) { 358 event.type = Common::EVENT_KEYUP; 359 event.kbd.keycode = Common::KEYCODE_F1; 360 event.kbd.ascii = Common::ASCII_F1; 361 } else if(DOWN(PSP_CTRL_RIGHT)) { 362 event.type = Common::EVENT_KEYUP; 363 event.kbd.keycode = Common::KEYCODE_F3; 364 event.kbd.ascii = Common::ASCII_F3; 365 } else if(DOWN(PSP_CTRL_DOWN)) { 366 event.type = Common::EVENT_KEYUP; 367 event.kbd.keycode = Common::KEYCODE_F4; 368 event.kbd.ascii = Common::ASCII_F4; 369 } else return haveEvent; 370 } 220 371 } 221 } else if (CHANGED(PSP_CTRL_SQUARE)) { 222 event.kbd.keycode = Common::KEYCODE_PERIOD; 223 event.kbd.ascii = '.'; 224 } else if (CHANGED(PSP_CTRL_TRIANGLE)) { 225 event.kbd.keycode = Common::KEYCODE_RETURN; 226 event.kbd.ascii = '\r'; 227 } else if (DOWN(PSP_CTRL_RTRIGGER)) { // An event 228 event.kbd.flags |= Common::KBD_SHIFT; 372 else if (CHANGED(PSP_CTRL_RTRIGGER)) { // An event 373 event.kbd.keycode = Common::KEYCODE_KP6; 374 event.kbd.ascii = Common::KEYCODE_KP6; 375 } else if (CHANGED(PSP_CTRL_TRIANGLE)) { 376 event.kbd.keycode = Common::KEYCODE_RETURN; 377 event.kbd.ascii = '\r'; 378 } else if (CHANGED(PSP_CTRL_START)) { 379 event.kbd.keycode = Common::KEYCODE_ESCAPE; 380 event.kbd.ascii = 27; 381 } 382 PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up"); 229 383 } 230 PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up"); 384 385 haveEvent = true; 386 } 387 } 388 else 389 { 390 if (PRESSED(PSP_CTRL_SELECT)) 391 _keyboard->setVisible(true); 392 393 else if (CHANGED(PSP_4BUTTONS | PSP_TRIGGERS | PSP_CTRL_START)) { 394 if (CHANGED(PSP_CTRL_CROSS)) { 395 event.type = DOWN(PSP_CTRL_CROSS) ? Common::EVENT_LBUTTONDOWN : Common::EVENT_LBUTTONUP; 396 event.mouse.x = _cursor->getX(); // Could this have to do with SCI enter problem? 397 event.mouse.y = _cursor->getY(); 398 PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "LButtonDown" : "LButtonUp"); 399 } else if (CHANGED(PSP_CTRL_CIRCLE)) { 400 event.type = DOWN(PSP_CTRL_CIRCLE) ? Common::EVENT_RBUTTONDOWN : Common::EVENT_RBUTTONUP; 401 event.mouse.x = _cursor->getX(); 402 event.mouse.y = _cursor->getY(); 403 PSP_DEBUG_PRINT("%s\n", event.type == Common::EVENT_LBUTTONDOWN ? "RButtonDown" : "RButtonUp"); 404 } else { 405 //any of the other buttons. 406 event.type = _buttonsChanged & pad.Buttons ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP; 407 event.kbd.ascii = 0; 408 event.kbd.flags = 0; 409 410 if (CHANGED(PSP_CTRL_LTRIGGER)) { 411 event.kbd.keycode = Common::KEYCODE_ESCAPE; 412 event.kbd.ascii = 27; 413 } else if (CHANGED(PSP_CTRL_START)) { 414 event.kbd.keycode = Common::KEYCODE_F5; 415 event.kbd.ascii = Common::ASCII_F5; 416 if (DOWN(PSP_CTRL_RTRIGGER)) { 417 event.kbd.flags |= Common::KBD_CTRL; // Main menu to allow RTL 418 } 419 } else if (CHANGED(PSP_CTRL_SQUARE)) { 420 event.kbd.keycode = Common::KEYCODE_PERIOD; 421 event.kbd.ascii = '.'; 422 } else if (CHANGED(PSP_CTRL_TRIANGLE)) { 423 event.kbd.keycode = Common::KEYCODE_RETURN; 424 event.kbd.ascii = '\r'; 425 } else if (DOWN(PSP_CTRL_RTRIGGER)) { // An event 426 event.kbd.flags |= Common::KBD_SHIFT; 427 } 428 PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up"); 429 } 430 431 haveEvent = true; 231 432 } 232 233 haveEvent = true;234 433 } 235 236 434 return haveEvent; 237 435 } 238 436 … … 254 452 PSP_DEBUG_PRINT("raw x[%d], y[%d]\n", analogStepX, analogStepY); 255 453 256 454 // If no movement then this has no effect 257 if ( DOWN(PSP_CTRL_RTRIGGER)) {455 if ((!_lolControlMode && DOWN(PSP_CTRL_RTRIGGER)) || (_lolControlMode && DOWN(PSP_CTRL_SQUARE))) { 258 456 // Fine control mode for analog 259 457 if (analogStepX != 0) { 260 458 if (analogStepX > 0) -
backends/platform/psp/input.h
51 51 uint32 _buttonsChanged; 52 52 int32 _dpadX, _dpadY; 53 53 int32 _accelX, _accelY; 54 uint32 _lastControlModeChangeTime; 55 bool _lolControlMode; 54 56 57 55 58 bool getEvent(Common::Event &event, SceCtrlData &pad); 56 59 bool getDpadEvent(Common::Event &event, SceCtrlData &pad); 57 60 bool getButtonEvent(Common::Event &event, SceCtrlData &pad); 58 61 bool getNubEvent(Common::Event &event, SceCtrlData &pad); 59 62 int32 modifyNubAxisMotion(int32 input); 60 63 Common::KeyCode translateDpad(int x, int y); 64 Common::KeyCode translateDpadLol(int x, int y, bool fight); 61 65 }; 62 66 63 67 #endif /* PSP_INPUT_H */ -
configure
87 87 add_engine drascula "Drascula: The Vampire Strikes Back" yes 88 88 add_engine gob "Gobli*ns" yes 89 89 add_engine groovie "Groovie" yes "groovie2" 90 add_engine groovie2 "Groovie 2 games" no91 add_engine hugo "Hugo Trilogy" no90 add_engine groovie2 "Groovie 2 games" yes 91 add_engine hugo "Hugo Trilogy" yes 92 92 add_engine kyra "Legend of Kyrandia" yes "lol" 93 add_engine lol "Lands of Lore" no93 add_engine lol "Lands of Lore" yes 94 94 add_engine lure "Lure of the Temptress" yes 95 add_engine m4 "M4/MADS" no95 add_engine m4 "M4/MADS" yes 96 96 add_engine made "MADE" yes 97 add_engine mohawk "Mohawk" no97 add_engine mohawk "Mohawk" yes 98 98 add_engine parallaction "Parallaction" yes 99 99 add_engine queen "Flight of the Amazon Queen" yes 100 100 add_engine saga "SAGA" yes "ihnm saga2" 101 101 add_engine ihnm "IHNM" yes 102 add_engine saga2 "SAGA 2 games" no102 add_engine saga2 "SAGA 2 games" yes 103 103 add_engine sci "SCI" yes "sci32" 104 add_engine sci32 "SCI32 games" no104 add_engine sci32 "SCI32 games" yes 105 105 add_engine sky "Beneath a Steel Sky" yes 106 106 add_engine sword1 "Broken Sword" yes 107 107 add_engine sword2 "Broken Sword II" yes … … 166 166 _nasmpath="$PATH" 167 167 NASMFLAGS="" 168 168 NASM="" 169 170 # Directories for installing ScummVM. 171 # This list is closely based on what GNU autoconf does, 172 # although the default value for datadir differs. 173 # Like GNU autoconf, we distinguish datadir and datarootdir 174 # to make it possible to change e.g. the location of the 175 # man pages independently of that of the engine data files, 176 # which are placed inside $datadir/scummvm 177 exec_prefix=NONE 178 prefix=NONE 179 bindir='${exec_prefix}/bin' 180 datarootdir='${prefix}/share' 181 datadir='${datarootdir}/scummvm' 182 docdir='${datarootdir}/doc/scummvm' 183 libdir='${exec_prefix}/lib' 184 #localedir='${datarootdir}/locale' 185 mandir='${datarootdir}/man' 186 169 _prefix=/usr/pspdev/local 187 170 # For cross compiling 188 171 _host="" 189 172 _host_cpu="" -
engines/agos/midi.cpp
29 29 #include "common/system.h" 30 30 31 31 #include "agos/agos.h" 32 #include "sound/audiocd.h" 32 33 33 34 namespace AGOS { 34 35 … … 96 97 } 97 98 98 99 void MidiPlayer::send(uint32 b) { 100 99 101 if (!_current) 100 102 return; 101 103 … … 208 210 if (track == _currentTrack) 209 211 return; 210 212 213 AudioCD.stop(); 214 AudioCD.play(_music.cdtracks[track], _loopTrack ? -1 : 1 , 0, 0); 215 211 216 if (_music.num_songs > 0) { 212 217 if (track >= _music.num_songs) 213 218 return; … … 225 230 parser->property (MidiParser::mpMalformedPitchBends, 1); 226 231 parser->setMidiDriver(this); 227 232 parser->setTimerRate(_driver->getBaseTempo()); 233 if(AudioCD.isPlaying()) parser->_dontplayme=true; 234 else parser->_dontplayme=false; 228 235 if (!parser->loadMusic(_music.songs[track], _music.song_sizes[track])) { 229 236 printf ("Error reading track!\n"); 230 237 delete parser; … … 239 246 _mutex.unlock(); 240 247 return; 241 248 } 249 if(AudioCD.isPlaying()) _music.parser->_dontplayme=true; 250 else _music.parser->_dontplayme=false; 242 251 _currentTrack = (byte)track; 243 252 _current = &_music; 244 253 _music.parser->jumpToTick(0); … … 250 259 251 260 void MidiPlayer::stop() { 252 261 Common::StackLock lock(_mutex); 262 AudioCD.stop(); 253 263 254 264 if (_music.parser) { 255 265 _current = &_music; … … 288 298 289 299 _musicVolume = musicVol; 290 300 _sfxVolume = sfxVol; 301 g_system->getMixer()->setVolumeForSoundType(g_system->getMixer()->kMusicSoundType,musicVol); 291 302 292 303 // Now tell all the channels this. 293 304 Common::StackLock lock(_mutex); … … 322 333 323 334 void MidiPlayer::queueTrack(int track, bool loop) { 324 335 _mutex.lock(); 325 if (_currentTrack == 255 ) {336 if (_currentTrack == 255 && !AudioCD.isPlaying()) { 326 337 _mutex.unlock(); 327 338 setLoop(loop); 328 339 startTrack(track); … … 523 534 } 524 535 } 525 536 526 void MidiPlayer::loadXMIDI(Common::File *in, bool sfx) { 537 538 void MidiPlayer::loadXMIDI(Common::File *in, bool sfx, uint8 cdtrack) { 527 539 Common::StackLock lock(_mutex); 528 540 MusicInfo *p = sfx ? &_sfx : &_music; 529 541 clearConstructs(*p); 530 542 543 uint8 si2xmis[][16]={{0},{9,10,11},{4,5,6,7,8},{12},{13},{14},{15},{16},{17,9,10,11},{18,16}, 544 {19,20,21},{22},{23,24,25},{29},{1,2},{30},{29,31,32},{1,2},{29,31,32},{33,34}, 545 {35,36},{37,38},{39,40},{41,42},{43,44},{45,46,47,48},{26,27,28},{49,50,51,52,53},{54},{55,56,57,58}, 546 {59,60},{61},{62,63,64,65},{65,62,64,63},{65,62,64,63},{66},{67},{68},{69},{70}, 547 {71,72},{73,74},{75},{76,77},{78},{79},{80},{81},{82,83,84,85,86},{86,87,88}, 548 {114},{115,116},{116},{117},{118,119},{120},{121},{122},{123},{124}, 549 {89},{90,91},{92,93},{94,91,95},{96},{97},{98,99},{98,100},{98,101},{98,101}, 550 {98,101},{102},{98,101},{103},{104,105,106},{107},{108},{109},{110,111,112},{113}, 551 {125,126},{127},{128},{129,130,131},{132,133},{134,135},{136},{137},{138},{138,139}, 552 {3},{140,141},{142},{143},{144} 553 }; 554 555 if(cdtrack!=0) { 556 for(int a=0;a<sizeof(p->cdtracks);a++) { 557 p->cdtracks[a]=si2xmis[cdtrack][a]; 558 } 559 } 560 531 561 char buf[4]; 532 562 uint32 pos = in->pos(); 533 563 uint32 size = 4; -
engines/agos/midi.h
42 42 byte num_songs; // For Type 1 SMF resources 43 43 byte *songs[16]; // For Type 1 SMF resources 44 44 uint32 song_sizes[16]; // For Type 1 SMF resources 45 uint8 cdtracks[16]; 45 46 46 47 MidiChannel *channel[16]; // Dynamic remapping of channels to resolve conflicts 47 48 byte volume[16]; // Current channel volume 48 49 50 49 51 MusicInfo() { clear(); } 50 52 void clear() { 51 53 parser = 0; data = 0; num_songs = 0; 52 54 memset(songs, 0, sizeof(songs)); 53 55 memset(song_sizes, 0, sizeof(song_sizes)); 54 56 memset(channel, 0, sizeof(channel)); 57 memset(cdtracks, 0, sizeof(cdtracks)); 55 58 } 56 59 }; 57 60 … … 94 97 95 98 void loadSMF(Common::File *in, int song, bool sfx = false); 96 99 void loadMultipleSMF(Common::File *in, bool sfx = false); 97 void loadXMIDI(Common::File *in, bool sfx = false );100 void loadXMIDI(Common::File *in, bool sfx = false, uint8 cdtrack = 0); 98 101 void loadS1D(Common::File *in, bool sfx = false); 99 102 100 103 void mapMT32toGM(bool map); -
engines/agos/res_snd.cpp
122 122 char buf[4]; 123 123 124 124 stopMusic(); 125 126 125 _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); 127 126 _gameFile->read(buf, 4); 128 127 if (!memcmp(buf, "FORM", 4)) { 129 128 _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); 130 _midi.loadXMIDI(_gameFile );129 _midi.loadXMIDI(_gameFile,false,music); 131 130 } else { 132 131 _gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET); 133 132 _midi.loadMultipleSMF(_gameFile); -
engines/cruise/sound.cpp
33 33 #include "sound/audiostream.h" 34 34 #include "sound/fmopl.h" 35 35 #include "sound/mods/soundfx.h" 36 #include "sound/audiocd.h" 36 37 37 38 namespace Cruise { 38 39 … … 652 653 void PCSoundFxPlayer::play() { 653 654 debug(9, "PCSoundFxPlayer::play()"); 654 655 if (_sfxData) { 656 //attempt to use cd audio first 657 AudioCD.stop(); 658 Common::String mystring=_musicName; 659 660 if(mystring=="CORP9") AudioCD.play(9, -1, 0, 0); 661 if(mystring=="CORP2") AudioCD.play(2, -1, 0, 0); 662 if(mystring=="CORP6") AudioCD.play(6, -1, 0, 0); 663 if(mystring=="CORP13") AudioCD.play(13, -1, 0, 0); 664 if(mystring=="CORP1") AudioCD.play(1, -1, 0, 0); 665 if(mystring=="CORP7") AudioCD.play(7, -1, 0, 0); 666 667 //not supported at this moment but here in case I get around to it 668 if(mystring=="CORP3") AudioCD.play(3, -1, 0, 0); 669 if(mystring=="CORP4") AudioCD.play(4, -1, 0, 0); 670 if(mystring=="CORP5") AudioCD.play(5, -1, 0, 0); 671 if(mystring=="CORP8") AudioCD.play(8, -1, 0, 0); 672 if(mystring=="CORP10") AudioCD.play(10, -1, 0, 0); 673 if(mystring=="CORP11") AudioCD.play(11, -1, 0, 0); 674 if(mystring=="CORP12") AudioCD.play(12, -1, 0, 0); 675 if(AudioCD.isPlaying()){ 676 //_playing=true; 677 return; 678 } 679 655 680 for (int i = 0; i < NUM_CHANNELS; ++i) { 656 681 _instrumentsChannelTable[i] = -1; 657 682 } … … 665 690 } 666 691 667 692 void PCSoundFxPlayer::stop() { 693 AudioCD.stop(); 668 694 if (_playing || _fadeOutCounter != 0) { 669 695 _fadeOutCounter = 0; 670 696 _playing = false; … … 677 703 } 678 704 679 705 void PCSoundFxPlayer::fadeOut() { 706 AudioCD.stop(); 680 707 if (_playing) { 681 708 _fadeOutCounter = 1; 682 709 _playing = false; -
engines/groovie/music.cpp
47 47 48 48 void MusicPlayer::playSong(uint32 fileref) { 49 49 Common::StackLock lock(_mutex); 50 AudioCD.stop(); 51 int doIloop=-1; 52 //if(loop) doIloop=-1; 53 int cdtrack=fileref-19455; 54 if (cdtrack==1) cdtrack=100; //used to avoid confusion with real audio cd track 55 /*switch(fileref) { 56 case 0x4c39: 57 cdtrack=58; 58 break; 59 case 0x4c3f: 60 cdtrack=64; 61 break; 62 } */ 63 if(cdtrack>0&&cdtrack<200) AudioCD.play(cdtrack,doIloop,0,0); 64 if(AudioCD.isPlaying()) 65 { 66 _isPlaying=true; 67 return; 68 } 50 69 51 70 // Set the volumes 52 71 _fadingEndVolume = 100; … … 338 357 void MusicPlayerMidi::endTrack() { 339 358 debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()"); 340 359 unload(); 360 AudioCD.stop(); 341 361 } 342 362 343 363 void MusicPlayerMidi::onTimerInternal() { -
engines/kyra/debugger.cpp
51 51 DCmd_Register("queryflag", WRAP_METHOD(Debugger, cmd_queryFlag)); 52 52 DCmd_Register("timers", WRAP_METHOD(Debugger, cmd_listTimers)); 53 53 DCmd_Register("settimercountdown", WRAP_METHOD(Debugger, cmd_setTimerCountdown)); 54 DCmd_Register("play", WRAP_METHOD(Debugger, cmd_play)); 55 DCmd_Register("loadsf", WRAP_METHOD(Debugger, cmd_loadsf)); 54 56 } 55 57 56 58 bool Debugger::cmd_setScreenDebug(int argc, const char **argv) { … … 68 70 return true; 69 71 } 70 72 73 bool Debugger::cmd_play(int argc, const char **argv) { 74 int val = atoi(argv[1]); 75 _vm->sound()->playTrack(val); 76 return true; 77 } 78 79 bool Debugger::cmd_loadsf(int argc, const char **argv) { 80 //char* val = atoi(argv[1]); 81 _vm->sound()->loadSoundFile(argv[1]); 82 return true; 83 } 71 84 bool Debugger::cmd_loadPalette(int argc, const char **argv) { 72 85 Palette palette(_vm->screen()->getPalette(0).getNumColors()); 73 86 -
engines/kyra/debugger.h
51 51 bool cmd_toggleFlag(int argc, const char **argv); 52 52 bool cmd_queryFlag(int argc, const char **argv); 53 53 bool cmd_listTimers(int argc, const char **argv); 54 bool cmd_play(int argc, const char **argv); 55 bool cmd_loadsf(int argc, const char **argv); 54 56 bool cmd_setTimerCountdown(int argc, const char **argv); 55 57 }; 56 58 -
engines/kyra/sound_adlib.cpp
48 48 #include "sound/mixer.h" 49 49 #include "sound/fmopl.h" 50 50 #include "sound/audiostream.h" 51 #include "sound/audiocd.h" 51 52 52 53 // Basic AdLib Programming: 53 54 // http://www.gamedev.net/reference/articles/article446.asp … … 2301 2302 void SoundAdLibPC::haltTrack() { 2302 2303 unk1(); 2303 2304 unk2(); 2305 AudioCD.stop(); 2304 2306 //_vm->_system->delayMillis(3 * 60); 2305 2307 } 2306 2308 … … 2309 2311 } 2310 2312 2311 2313 void SoundAdLibPC::playSoundEffect(uint8 track) { 2314 2312 2315 if (_sfxEnabled) 2313 play(track); 2316 { 2317 char filenamebuffer[25]; 2318 DigitalTrack dTrack=getDigitalEffectsTrack(track); 2319 sprintf(filenamebuffer, "track%i", dTrack.track); 2320 2321 if(dTrack.track!=0) { 2322 _mixer->stopHandle(_fxHandle); 2323 voicePlay(filenamebuffer,&_fxHandle,255,true); 2324 _currentSoundEffect = filenamebuffer; 2325 } 2326 if(!_mixer->isSoundHandleActive(_fxHandle)) play(track,true); 2327 } 2314 2328 } 2315 2329 2316 void SoundAdLibPC::play(uint8 track) { 2330 void SoundAdLibPC::play(uint8 track, bool soundeffect) { 2331 2332 if(soundeffect==false) 2333 { 2334 DigitalTrack dTrack = getDigitalMusicTrack(track); 2335 bool loop = dTrack.loop; 2336 uint8 tracktoplay = dTrack.track; 2337 AudioCD.stop(); 2338 2339 if(tracktoplay != 0) { 2340 AudioCD.play(tracktoplay, loop ? -1 : 1, 0, 0); 2341 } 2342 2343 if(AudioCD.isPlaying()) return; 2344 } 2317 2345 uint16 soundId = 0; 2318 2346 2319 2347 if (_v2) … … 2382 2410 2383 2411 void SoundAdLibPC::loadSoundFile(uint file) { 2384 2412 internalLoadFile(fileListEntry(file)); 2413 Common::String filename = fileListEntry(file); 2414 filename.toLowercase(); 2415 _currentTrack = filename; 2416 haltTrack(); 2385 2417 } 2386 2418 2387 2419 void SoundAdLibPC::loadSoundFile(Common::String file) { 2388 2420 internalLoadFile(file); 2421 file.toLowercase(); 2422 _currentTrack = file; 2423 haltTrack(); 2389 2424 } 2390 2425 2391 2426 void SoundAdLibPC::internalLoadFile(Common::String file) { … … 2446 2481 playSoundEffect(0); 2447 2482 } 2448 2483 2449 } // End of namespace Kyra 2484 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_introTracks[] = { 2485 {0, false}, {0, false}, {1, false}, {2, false}, {3, true}, {4, true}, 2486 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2487 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2488 {0, false}, {0, false}, {0, false}, {0, false}, {50, false}, {51, false}, 2489 {52, false}, {53, false}, {0, false}, {54, false}, {55, false}, {0, false}, 2490 {56, false}, {57, false}, {0, false}, {58, false}, {59, false}, {60, false}, 2491 {61, false}, {62, false}, {63, false} 2492 }; 2450 2493 2494 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra1aTracks[] = { 2495 {0, false}, {0, false}, {5, true}, {6, true}, {7, true}, {0, false}, 2496 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2497 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2498 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2499 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2500 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2501 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2502 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2503 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2504 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2505 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2506 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2507 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2508 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2509 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2510 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2511 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2512 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2513 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2514 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2515 }; 2516 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra1bTracks[] = { 2517 {0, false}, {0, false}, {9, true}, {10, false}, {11, true}, {45, true}, 2518 {12, false}, {13, false}, {14, true}, {15, false}, {0, false}, {8, false}, 2519 {0, false}, {16, true}, {17, true}, {0, false}, {0, false}, {0, false}, 2520 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2521 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2522 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2523 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2524 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2525 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2526 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2527 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2528 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2529 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2530 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2531 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2532 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2533 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2534 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2535 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2536 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2537 }; 2538 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra2aTracks[] = { 2539 {0, false}, {0, false}, {18, true}, {19, true}, {20, false}, {21, true}, 2540 {22, false}, {23, true}, {0, false}, {0, false}, {0, false}, {0, false}, 2541 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2542 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2543 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2544 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2545 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2546 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2547 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2548 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2549 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2550 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2551 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2552 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2553 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2554 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2555 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2556 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2557 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2558 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2559 }; 2560 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra3aTracks[] = { 2561 {0, false}, {0, false}, {5, true}, {25, true}, {26, true}, {0, false}, 2562 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2563 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2564 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2565 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2566 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2567 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2568 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2569 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2570 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2571 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2572 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2573 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2574 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2575 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2576 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2577 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2578 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2579 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2580 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2581 }; 2582 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra4aTracks[] = { 2583 {0, false}, {0, false}, {27, true}, {28, true}, {47, false}, {48, false}, 2584 {49, false}, {29, false}, {30, true}, {64, false}, {0, false}, {0, false}, 2585 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2586 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2587 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2588 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2589 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2590 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2591 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2592 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2593 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2594 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2595 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2596 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2597 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2598 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2599 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2600 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2601 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2602 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2603 }; 2604 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra4bTracks[] = { 2605 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2606 {0, false}, {0, false}, {0, false}, {0, false}, {31, true}, {65, false}, 2607 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2608 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2609 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2610 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2611 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2612 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2613 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2614 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2615 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2616 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2617 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2618 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2619 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2620 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2621 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2622 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2623 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2624 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2625 }; 2626 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra5aTracks[] = { 2627 {0, false}, {0, false}, {33, true}, {34, true}, {0, true}, {7, true}, 2628 {66, false}, {67, false}, {68, false}, {69, false}, {0, false}, {70, false}, 2629 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2630 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2631 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2632 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2633 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2634 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2635 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2636 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2637 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2638 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2639 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2640 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2641 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2642 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2643 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2644 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2645 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2646 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2647 }; 2648 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyra5bTracks[] = { 2649 {0, false}, {0, false}, {35, false}, {36, false}, {0, false}, {37, false}, 2650 {38, false}, {39, false}, {40, false}, {41, false}, {0, false}, {0, false}, 2651 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2652 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2653 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2654 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2655 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2656 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2657 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2658 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2659 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2660 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2661 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2662 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2663 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2664 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2665 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2666 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2667 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2668 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2669 }; 2670 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_kyramiscTracks[] = { 2671 {0, false}, {0, false}, {42, true}, {43, true}, {36, false}, {0, false}, 2672 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2673 {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, {0, false}, 2674 {0, false}, {0, false}, {71, false}, {72, false}, {73, false}, {74, false}, 2675 {75, false}, {76, false}, {77, false}, {78, false}, {79, false}, {80, false}, 2676 {81, false}, {82, false}, {83, false}, {84, false}, {85, false}, {86, false}, 2677 {87, false}, {88, false}, {89, false}, {90, false}, {0, false}, {0, false}, 2678 {0, false}, {94, false}, {95, false}, {0, false}, {97, false}, {98, false}, 2679 {99, false}, {100, false}, {101, false}, {102, false}, {103, false}, {104, false}, 2680 {105, false}, {106, false}, {107, false}, {108, false}, {109, false}, {110, false}, 2681 {111, false}, {112, false}, {113, false}, {114, false}, {115, false}, {0, false}, 2682 {0, false}, {118, false}, {119, false}, {120, false}, {121, false}, {122, false}, 2683 {123, false}, {124, false}, {125, true}, {0, false}, {127, false}, {128, false}, 2684 {129, false}, {130, false}, {131, false}, {132, false}, {133, false}, {134, false}, 2685 {135, false}, {136, false}, {137, false}, {138, false}, {139, false}, {140, false}, 2686 {141, false}, {142, false}, {143, true}, {144, false}, {145, false}, {146, false}, 2687 {147, false}, {148, false}, {149, false}, {150, false}, {151, false}, {152, false}, 2688 {153, false}, {154, false}, {155, false}, {156, false}, {157, false}, {158, false}, 2689 {159, false}, {160, false}, {0, false}, {162, false}, {163, false}, {164, false}, 2690 {165, false}, {0, false}, {167, false}, {168, false}, {169, false}, {170, false} 2691 }; 2692 2693 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2introTracks[] = { 2694 {0, false}, {0, false}, {1, false}, {2, false}, {3, false}, {4, true}, 2695 {5, true}, {6, false}, {7, false} 2696 }; 2697 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test1Tracks[] = { 2698 {0, false}, {0, false}, {8, true}, {9, true} 2699 }; 2700 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test2Tracks[] = { 2701 {0, false}, {0, false}, {18, true}, {19, true} 2702 }; 2703 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test3Tracks[] = { 2704 {0, false}, {0, false}, {20, true}, {21, true} 2705 }; 2706 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test4Tracks[] = { 2707 {0, false}, {0, false}, {22, true}, {23, true} 2708 }; 2709 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test5Tracks[] = { 2710 {0, false}, {0, false}, {24, false}, {25, false}, {26, false}, {27, false}, 2711 {28, true}, {29, true} 2712 }; 2713 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test6Tracks[] = { 2714 {0, false}, {0, false}, {0, false}, {30, true}, {31, true} 2715 }; 2716 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test7Tracks[] = { 2717 {0, false}, {0, false}, {32, true}, {33, true}, {34, false}, {35, true}, 2718 {36, false}, {37, false}, {38, false}, {39, true} 2719 }; 2720 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test8Tracks[] = { 2721 {0, false}, {0, false}, {40, true}, {41, false}, {42, false}, {43, true}, 2722 {44, false}, {45, true}, {46, false}, {47, true} 2723 }; 2724 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test9Tracks[] = { 2725 {0, false}, {0, false}, {48, true}, {49, false}, {50, true}, {51, true}, 2726 {52, true}, {53, true}, {54, true}, {55, true} 2727 }; 2728 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test10Tracks[] = { 2729 {0, false}, {0, false}, {10, false}, {11, false}, {12, true}, {13, true}, 2730 {14, false}, {15, false}, {16, false}, {17, true} 2731 }; 2732 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test11Tracks[] = { 2733 {0, false}, {0, false}, {56, true}, {57, false}, {58, false}, {59, true}, 2734 {60, true}, {61, true} 2735 }; 2736 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test12Tracks[] = { 2737 {0, false}, {0, false}, {62, true}, {63, true}, {63, true}, {64, true}, 2738 {65, false}, {66, true}, {67, true}, {68, true}, {69, true} 2739 }; 2740 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test13Tracks[] = { 2741 {0, false}, {0, false}, {70, true}, {71, false}, {72, false}, {73, true}, 2742 {74, true}, {75, false}, {76, true}, {77, false} 2743 }; 2744 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test14Tracks[] = { 2745 {0, false}, {0, false}, {78,true} 2746 }; 2747 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2test15Tracks[] = { 2748 {0, false}, {0, false}, {79, true}, {80, false}, {81, true}, {82, false} 2749 }; 2750 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2finaleTracks[] = { 2751 {0, false}, {0, false}, {0,false}, {83, true}, {84, false} 2752 }; 2753 2754 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_k2effectTracks[] = { 2755 {0, false}, {91, false}, {92, false}, {93, false}, {94, false}, {95, false}, 2756 {96, false}, {97, false}, {98, false}, {99, false}, {100, false}, {101, false}, 2757 {102, false}, {103, false}, {104, false}, {105, false}, {106, false}, {107, false}, 2758 {108, false}, {109, false}, {110, false}, {111, false}, {112, false}, {113, false}, 2759 {114, false}, {115, false}, {116, false}, {117, false}, {118, false}, {119, false}, 2760 {120, false}, {121, false}, {122, false}, {123, false}, {124, false}, {125, false}, 2761 {126, false}, {127, false}, {128, false}, {129, false}, {130, false}, {131, false}, 2762 {132, false}, {133, false}, {134, false}, {135, false}, {136, false}, {137, false}, 2763 {138, false}, {139, false}, {140, false}, {141, false}, {142, false}, {143, false}, 2764 {144, false}, {145, false}, {146, false}, {147, false}, {148, false}, {149, false}, 2765 {150, false}, {151, false}, {152, false}, {153, false} 2766 }; 2767 2768 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lolintroTracks[] = { 2769 {0, false}, {0, false}, {1,false}, {0, false},{0, false},{0, false}, {2, true}, {3, false} 2770 }; 2771 2772 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore01aTracks[] = { 2773 {0, false}, {0, false}, {4,true}, {5, true}, {6, true}, {7, true}, {8, false}, 2774 {9, true}, {10, false}, {11, false} 2775 }; 2776 2777 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore01bTracks[] = { 2778 {0, false}, {0, false}, {12,true}, {0, false}, {13, true}, {14, false}, {15, true}, 2779 {0, false}, {16, false}, {17, false} 2780 }; 2781 2782 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore01cTracks[] = { 2783 {0, false}, {0, false}, {18,false}, {19, true}, {20, true}, {21, true}, {22, true}, 2784 {23, true} 2785 }; 2786 2787 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore01dTracks[] = { 2788 {0, false}, {0, false}, {24,true}, {25, true}, {26, true} 2789 }; 2790 2791 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore02aTracks[] = { 2792 {0, false}, {0, false}, {27,true}, {28, true}, {29, true}, {30, true}, {31,false}, 2793 {32, false}, {33, false}, {34, true} 2794 }; 2795 2796 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore03aTracks[] = { 2797 {0, false}, {0, false}, {35,true}, {36, true}, {37, true}, {38, true}, {39,true} 2798 }; 2799 2800 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore03bTracks[] = { 2801 {0, false}, {0, false}, {40,false}, {41, false}, {42, false}, {43, false}, {44,false}, 2802 {45, false}, {46, false} 2803 }; 2804 2805 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore04aTracks[] = { 2806 {0, false}, {0, false}, {47, false}, {48, false}, {49, true}, {50, false}, {51,false}, 2807 {52, false}, {53, false} 2808 }; 2809 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore05aTracks[] = { 2810 {0, false}, {0, false}, {54, false}, {55, true}, {56, true}, {57, false}, {58,true} 2811 }; 2812 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore05bTracks[] = { 2813 {0, false}, {0, false}, {59, true}, {60, false}, {61, false}, {62, true}, {63,true} 2814 }; 2815 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore06aTracks[] = { 2816 {0, false}, {0, false}, {64, true}, {65, false}, {66, true}, {67, true}, {68,false} 2817 }; 2818 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore06bTracks[] = { 2819 {0, false}, {0, false}, {69, true} 2820 }; 2821 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore07aTracks[] = { 2822 {0, false}, {0, false}, {70, false}, {71, false} 2823 }; 2824 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore08aTracks[] = { 2825 {0, false}, {0, false}, {72, false}, {73, false}, {74, true}, {75, false}, {76,false}, {77,true} 2826 }; 2827 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lore08bTracks[] = { 2828 {0, false}, {0, false}, {78, true}, {79, false} 2829 }; 2830 const SoundAdLibPC::DigitalTrack SoundAdLibPC::_lorefinlTracks[] = { 2831 {0, false}, {0, false}, {80, false}, {81, false}, {82, false} 2832 }; 2833 2834 SoundAdLibPC::DigitalTrack SoundAdLibPC::getDigitalMusicTrack(uint8 track) { 2835 if (_vm->game() == GI_KYRA1) { 2836 if(_currentTrack == "kyra1a") return _kyra1aTracks[track]; 2837 else if (_currentTrack == "kyra1b") return _kyra1bTracks[track]; 2838 else if (_currentTrack == "kyra2a") return _kyra2aTracks[track]; 2839 else if (_currentTrack == "kyra3a") return _kyra3aTracks[track]; 2840 else if (_currentTrack == "kyra4a") return _kyra4aTracks[track]; 2841 else if (_currentTrack == "kyra4b") return _kyra4bTracks[track]; 2842 else if (_currentTrack == "kyra5a") return _kyra5aTracks[track]; 2843 else if (_currentTrack == "kyra5b") return _kyra5bTracks[track]; 2844 else if (_currentTrack == "kyramisc") return _kyramiscTracks[track]; 2845 else if (_currentTrack == "intro") return _introTracks[track]; 2846 } 2847 if (_vm->game() == GI_KYRA2) { 2848 if(_currentTrack == "k2intro") return _k2introTracks[track]; 2849 else if (_currentTrack == "k2test1") return _k2test1Tracks[track]; 2850 else if (_currentTrack == "k2test2") return _k2test2Tracks[track]; 2851 else if (_currentTrack == "k2test3") return _k2test3Tracks[track]; 2852 else if (_currentTrack == "k2test4") return _k2test4Tracks[track]; 2853 else if (_currentTrack == "k2test5") return _k2test5Tracks[track]; 2854 else if (_currentTrack == "k2test6") return _k2test6Tracks[track]; 2855 else if (_currentTrack == "k2test7") return _k2test7Tracks[track]; 2856 else if (_currentTrack == "k2test8") return _k2test8Tracks[track]; 2857 else if (_currentTrack == "k2test9") return _k2test9Tracks[track]; 2858 else if (_currentTrack == "k2test10") return _k2test10Tracks[track]; 2859 else if (_currentTrack == "k2test11") return _k2test11Tracks[track]; 2860 else if (_currentTrack == "k2test12") return _k2test12Tracks[track]; 2861 else if (_currentTrack == "k2test13") return _k2test13Tracks[track]; 2862 else if (_currentTrack == "k2test14") return _k2test14Tracks[track]; 2863 else if (_currentTrack == "k2test15") return _k2test15Tracks[track]; 2864 else if (_currentTrack == "k2finale") return _k2finaleTracks[track]; 2865 } 2866 if (_vm->game() == GI_LOL) { 2867 if(_currentTrack == "loreintr") return _lolintroTracks[track]; 2868 else if(_currentTrack == "lore01a") return _lore01aTracks[track]; 2869 else if(_currentTrack == "lore01b") return _lore01bTracks[track]; 2870 else if(_currentTrack == "lore01c") return _lore01cTracks[track]; 2871 else if(_currentTrack == "lore01d") return _lore01dTracks[track]; 2872 else if(_currentTrack == "lore02a") return _lore02aTracks[track]; 2873 else if(_currentTrack == "lore03a") return _lore03aTracks[track]; 2874 else if(_currentTrack == "lore03b") return _lore03bTracks[track]; 2875 else if(_currentTrack == "lore04a") return _lore04aTracks[track]; 2876 else if(_currentTrack == "lore05a") return _lore05aTracks[track]; 2877 else if(_currentTrack == "lore05b") return _lore05bTracks[track]; 2878 else if(_currentTrack == "lore06a") return _lore06aTracks[track]; 2879 else if(_currentTrack == "lore06b") return _lore06bTracks[track]; 2880 else if(_currentTrack == "lore07a") return _lore07aTracks[track]; 2881 else if(_currentTrack == "lore08a") return _lore08aTracks[track]; 2882 else if(_currentTrack == "lore08b") return _lore08bTracks[track]; 2883 else if(_currentTrack == "lorefinl") return _lorefinlTracks[track]; 2884 } 2885 return _introTracks[0]; //return empty track 2886 2887 } 2888 2889 SoundAdLibPC::DigitalTrack SoundAdLibPC::getDigitalEffectsTrack(uint8 track) { 2890 if (_vm->game() == GI_KYRA1) { 2891 return getDigitalMusicTrack(track); 2892 } 2893 if (_vm->game() == GI_KYRA2) { 2894 return _introTracks[0];//hack for now since I can't be arsed to fix the fx 2895 } 2896 return _introTracks[0]; //return empty track 2897 } 2898 2899 2900 2901 2902 } // end of namespace Kyra 2903 -
engines/kyra/sound_adlib.h
84 84 private: 85 85 void internalLoadFile(Common::String file); 86 86 87 void play(uint8 track );87 void play(uint8 track, bool soundeffect=false); 88 88 89 89 void unk1(); 90 90 void unk2(); … … 97 97 int _sfxPlayingSound; 98 98 99 99 Common::String _soundFileLoaded; 100 Common::String _currentTrack; 101 Common::String _currentSoundEffect; 100 102 101 103 uint8 _sfxPriority; 102 104 uint8 _sfxFourthByteOfSong; … … 106 108 107 109 static const int _kyra1NumSoundTriggers; 108 110 static const int _kyra1SoundTriggers[]; 111 112 Audio::SoundHandle _fxHandle; 113 114 struct DigitalTrack { 115 const uint8 track; 116 const bool loop; 117 }; 118 119 static const DigitalTrack _introTracks[]; 120 static const DigitalTrack _kyra1aTracks[]; 121 static const DigitalTrack _kyra1bTracks[]; 122 static const DigitalTrack _kyra2aTracks[]; 123 static const DigitalTrack _kyra3aTracks[]; 124 static const DigitalTrack _kyra4aTracks[]; 125 static const DigitalTrack _kyra4bTracks[]; 126 static const DigitalTrack _kyra5aTracks[]; 127 static const DigitalTrack _kyra5bTracks[]; 128 static const DigitalTrack _kyramiscTracks[]; 129 static const DigitalTrack _k2introTracks[]; 130 static const DigitalTrack _k2test1Tracks[]; 131 static const DigitalTrack _k2test2Tracks[]; 132 static const DigitalTrack _k2test3Tracks[]; 133 static const DigitalTrack _k2test4Tracks[]; 134 static const DigitalTrack _k2test5Tracks[]; 135 static const DigitalTrack _k2test6Tracks[]; 136 static const DigitalTrack _k2test7Tracks[]; 137 static const DigitalTrack _k2test8Tracks[]; 138 static const DigitalTrack _k2test9Tracks[]; 139 static const DigitalTrack _k2test10Tracks[]; 140 static const DigitalTrack _k2test11Tracks[]; 141 static const DigitalTrack _k2test12Tracks[]; 142 static const DigitalTrack _k2test13Tracks[]; 143 static const DigitalTrack _k2test14Tracks[]; 144 static const DigitalTrack _k2test15Tracks[]; 145 static const DigitalTrack _k2finaleTracks[]; 146 static const DigitalTrack _k2effectTracks[]; 147 148 static const DigitalTrack _lolintroTracks[]; 149 static const DigitalTrack _lore01aTracks[]; 150 static const DigitalTrack _lore01bTracks[]; 151 static const DigitalTrack _lore01cTracks[]; 152 static const DigitalTrack _lore01dTracks[]; 153 static const DigitalTrack _lore02aTracks[]; 154 static const DigitalTrack _lore03aTracks[]; 155 static const DigitalTrack _lore03bTracks[]; 156 static const DigitalTrack _lore04aTracks[]; 157 static const DigitalTrack _lore05aTracks[]; 158 static const DigitalTrack _lore05bTracks[]; 159 static const DigitalTrack _lore06aTracks[]; 160 static const DigitalTrack _lore06bTracks[]; 161 static const DigitalTrack _lore07aTracks[]; 162 static const DigitalTrack _lore08aTracks[]; 163 static const DigitalTrack _lore08bTracks[]; 164 static const DigitalTrack _lorefinlTracks[]; 165 DigitalTrack getDigitalMusicTrack(uint8 track); 166 DigitalTrack getDigitalEffectsTrack(uint8 track); 109 167 }; 110 168 111 169 } // End of namespace Kyra -
engines/kyra/sound_lol.cpp
30 30 #include "kyra/resource.h" 31 31 32 32 #include "sound/audiostream.h" 33 #include "sound/audiocd.h" 33 34 34 35 namespace Kyra { 35 36 -
engines/lure/debugger.cpp
35 35 #include "lure/room.h" 36 36 #include "lure/scripts.h" 37 37 #include "lure/strings.h" 38 #include "lure/sound.h" 38 39 39 40 namespace Lure { 40 41 … … 53 54 DCmd_Register("strings", WRAP_METHOD(Debugger, cmd_saveStrings)); 54 55 DCmd_Register("debug", WRAP_METHOD(Debugger, cmd_debug)); 55 56 DCmd_Register("script", WRAP_METHOD(Debugger, cmd_script)); 57 DCmd_Register("playsound", WRAP_METHOD(Debugger, cmd_playSounds)); 56 58 } 57 59 58 60 static int strToInt(const char *s) { … … 115 117 return true; 116 118 } 117 119 120 bool Debugger::cmd_playSounds(int argc, const char **argv) { 121 int a=strToInt(argv[1]); 122 Sound.killSounds(); 123 Sound.musicInterface_Play(a,0); 124 return true; 125 } 126 118 127 bool Debugger::cmd_listRooms(int argc, const char **argv) { 119 128 RoomDataList &rooms = Resources::getReference().roomData(); 120 129 StringData &strings = StringData::getReference(); -
engines/lure/debugger.h
49 49 bool cmd_saveStrings(int argc, const char **argv); 50 50 bool cmd_debug(int argc, const char **argv); 51 51 bool cmd_script(int argc, const char **argv); 52 bool cmd_playSounds(int argc, const char **argv); 52 53 }; 53 54 54 55 extern const char *directionList[5]; -
engines/lure/sound.cpp
33 33 #include "common/config-manager.h" 34 34 #include "common/endian.h" 35 35 #include "sound/midiparser.h" 36 #include "sound/audiocd.h" 37 #include "sound/mixer.h" 38 #include "sound/audiostream.h" 36 39 37 40 DECLARE_SINGLETON(Lure::SoundManager) 38 41 … … 41 44 //#define SOUND_CROP_CHANNELS 42 45 43 46 SoundManager::SoundManager() { 47 currentSection=1; 44 48 Disk &disk = Disk::getReference(); 45 49 _soundMutex = g_system->createMutex(); 50 _mixer = g_system->getMixer(); 46 51 47 52 int index; 48 53 _descs = disk.getEntry(SOUND_DESC_RESOURCE_ID); … … 83 88 SoundManager::~SoundManager() { 84 89 if (_driver) 85 90 _driver->setTimerCallback(this, NULL); 91 _mixer->stopAll(); 86 92 87 93 removeSounds(); 88 94 _activeSounds.clear(); … … 134 140 135 141 136 142 void SoundManager::loadSection(uint16 sectionId) { 143 137 144 debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::loadSection = %xh", sectionId); 138 145 killSounds(); 146 if( sectionId==ROLAND_MAIN_SOUND_RESOURCE_ID || sectionId==ADLIB_MAIN_SOUND_RESOURCE_ID) 147 { 148 currentSection=1; 149 } 150 else 151 { 152 currentSection=0; 153 } 139 154 140 155 if (_soundData) { 141 156 delete _soundData; … … 325 340 return rec; 326 341 } 327 342 } 343 if(AudioCD.isPlaying()) 344 { 345 if(AudioCD.getStatus().track==soundNumber || AudioCD.getStatus().track+128==soundNumber) 346 { 347 SoundDescResource *rec=new SoundDescResource(); 348 rec->soundNumber=soundNumber; 349 return rec; 350 } 351 } 352 for (int channel = 0; channel < ARRAYSIZE(_sounds); ++channel) 353 { 354 if(_mixer->isSoundHandleActive(_sounds[channel].handle) && _sounds[channel].tracknumber==soundNumber) 355 { 356 SoundDescResource *rec=new SoundDescResource(); 357 rec->soundNumber=soundNumber; 358 rec->channel=channel; 359 return rec; 360 } 361 } 328 362 329 363 // Signal that sound wasn't found 330 364 debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "SoundManager::findSound - sound not found"); … … 364 398 365 399 ++i; 366 400 } 401 _mixer->pauseAll(true); 402 367 403 } 368 404 369 405 void SoundManager::restoreSounds() { … … 382 418 383 419 ++i; 384 420 } 421 _mixer->pauseAll(false); 385 422 } 386 423 387 424 void SoundManager::fadeOut() { 388 425 debugC(ERROR_BASIC, kLureDebugSounds, "SoundManager::fadeOut"); 389 426 390 427 // Fade out all the active sounds 391 musicInterface_TidySounds();392 428 393 429 bool inProgress = true; 394 430 while (inProgress) … … 421 457 void SoundManager::musicInterface_Play(uint8 soundNumber, uint8 channelNumber, uint8 numChannels) { 422 458 debugC(ERROR_INTERMEDIATE, kLureDebugSounds, "musicInterface_Play soundNumber=%d, channel=%d", 423 459 soundNumber, channelNumber); 460 461 bool foundDigital=false; 462 463 uint8 sn=soundNumber; 464 if(currentSection!=0) sn+=10; 465 bool isMusic = (sn & 0x80)!= 0; 466 while(sn>127) 467 { 468 sn-=128; 469 } 470 uint8 soundNum = soundNumber & 0x7f; 471 472 473 debugC(ERROR_DETAILED, kLureDebugSounds, "MidiMusic::PlayMusic playing sound %d", soundNumber); 474 /*if(isMusic) 475 { 476 //if its music I'm going to try to play it using the audiocd player 477 AudioCD.stop(); 478 AudioCD.play(sn,1,0,0); 479 if(AudioCD.isPlaying()) foundDigital=true; 480 } 481 else 482 {*/ 483 //if it isn't then it must be sfx so I want to play it through digital audio instead. 484 //I'm using 4 channels here which I'm assuming is overkill but I'm guessing 485 486 char trackName[16]; 487 sprintf(trackName, "track%d", sn); 488 489 _mixer->stopHandle(_sounds[channelNumber].handle); 490 _sounds[channelNumber].tracknumber=-1; 491 492 _sounds[channelNumber].stream =0; 493 bool loops=false; 494 if(soundNumber==153) loops=true; 495 _sounds[channelNumber].stream = Audio::SeekableAudioStream::openStreamFile(trackName); 496 if (_sounds[channelNumber].stream != 0) { 497 //found a channel - play the fx 498 Audio::Timestamp start = Audio::Timestamp(0, 0, 75); 499 Audio::Timestamp end = 0 ? Audio::Timestamp(0, 0 + 0, 75) : _sounds[channelNumber].stream->getLength(); 500 501 _mixer->playStream(Audio::Mixer::kSFXSoundType, &_sounds[channelNumber].handle, 502 Audio::makeLoopingAudioStream(_sounds[channelNumber].stream,start ,end , (loops) ? 0 : 1)); 503 _sounds[channelNumber].tracknumber=soundNumber; 504 foundDigital=true; 505 } 506 // } 507 if(foundDigital) return; 508 509 510 511 424 512 Game &game = Game::getReference(); 425 513 426 514 if (!_soundData) 427 515 error("Sound section has not been specified"); 428 516 429 uint8 soundNum = soundNumber & 0x7f;430 517 if (soundNum > _soundsTotal) 431 518 error("Invalid sound index %d requested", soundNum); 432 519 … … 434 521 // Only play sounds if a sound driver is active 435 522 return; 436 523 437 bool isMusic = (soundNumber & 0x80) != 0;438 439 524 if (!game.soundFlag()) 440 525 // Don't play sounds if sound is turned off 441 526 return; … … 466 551 musicInterface_TidySounds(); 467 552 uint8 soundNum = soundNumber & 0x7f; 468 553 554 if(AudioCD.getStatus().track==soundNumber) AudioCD.stop(); 555 if(AudioCD.getStatus().track+128==soundNumber) AudioCD.stop(); 556 557 for (int channel = 0; channel < ARRAYSIZE(_sounds); ++channel) 558 { 559 if (_sounds[channel].tracknumber==soundNumber) 560 { 561 _mixer->stopHandle(_sounds[channel].handle); 562 _sounds[channel].tracknumber=-1; 563 } 564 } 565 469 566 g_system->lockMutex(_soundMutex); 470 567 MusicListIterator i; 471 568 for (i = _playingSounds.begin(); i != _playingSounds.end(); ++i) { … … 498 595 } 499 596 g_system->unlockMutex(_soundMutex); 500 597 598 if(AudioCD.isPlaying() && (AudioCD.getStatus().track==soundNumber||AudioCD.getStatus().track+128==soundNumber)) 599 { 600 result=true; 601 } 602 for (int channel = 0; channel < ARRAYSIZE(_sounds); ++channel) 603 { 604 if(_sounds[channel].tracknumber==soundNumber && _mixer->isSoundHandleActive(_sounds[channel].handle) ) 605 { 606 result=true; 607 } 608 } 501 609 return result; 502 610 } 503 611 … … 517 625 music->setVolume(volume); 518 626 } 519 627 g_system->unlockMutex(_soundMutex); 628 629 if(_mixer->isSoundHandleActive(_sounds[channelNum].handle) ) 630 { 631 _mixer->setChannelVolume(_sounds[channelNum].handle, volume); 632 } 633 634 520 635 } 521 636 522 637 // musicInterface_KillAll … … 532 647 MidiMusic *music = (*i).get(); 533 648 music->stopMusic(); 534 649 } 650 AudioCD.stop(); 535 651 652 for (int channel = 0; channel < ARRAYSIZE(_sounds); ++channel) 653 { 654 _mixer->stopHandle(_sounds[channel].handle); 655 _sounds[channel].tracknumber=-1; 656 } 657 536 658 _playingSounds.clear(); 537 659 _activeSounds.clear(); 538 660 g_system->unlockMutex(_soundMutex); … … 680 802 } 681 803 682 804 void MidiMusic::playMusic() { 683 debugC(ERROR_DETAILED, kLureDebugSounds, "MidiMusic::PlayMusic playing sound %d", _soundNumber); 684 _parser->loadMusic(_soundData, _soundSize); 685 _parser->setTrack(0); 805 _parser->loadMusic(_soundData, _soundSize); 806 _parser->setTrack(0); 686 807 _isPlaying = true; 687 808 } 688 809 -
engines/lure/sound.h
68 68 69 69 bool _passThrough; 70 70 71 71 72 public: 72 73 MidiMusic(MidiDriver *driver, ChannelEntry channels[NUM_CHANNELS], 73 74 uint8 channelNum, uint8 soundNum, bool isMus, uint8 numChannels, void *soundData, uint32 size); … … 128 129 Common::MutexRef _soundMutex; 129 130 bool _paused; 130 131 132 Audio::Mixer *_mixer; 133 134 struct SoundFX { 135 Audio::SoundHandle handle; 136 137 int tracknumber; 138 Audio::SeekableAudioStream *stream; 139 } _sounds[16]; 140 141 131 142 uint _musicVolume; 132 143 uint _sfxVolume; 133 144 … … 175 186 void musicInterface_KillAll(); 176 187 void musicInterface_ContinuePlaying(); 177 188 void musicInterface_TrashReverb(); 189 int currentSection; 178 190 }; 179 191 180 192 } // End of namespace Lure -
engines/m4/midi.cpp
29 29 #include "m4/m4.h" 30 30 #include "m4/midi.h" 31 31 #include "common/stream.h" 32 #include "sound/audiocd.h" 32 33 33 34 namespace M4 { 34 35 … … 145 146 146 147 void MidiPlayer::playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene) { 147 148 stopMusic(); 149 AudioCD.stop(); 148 150 149 151 char fullname[144]; 150 152 _vm->res()->changeExtension(fullname, name, "HMP"); … … 159 161 _vm->res()->toss(fullname); 160 162 _vm->res()->purge(); 161 163 162 if (_midiData) { 164 //support for CD Audio - not very efficient but just need to add a list of filenames for each game 165 //should really use game check also in case of duplicate file names but won't be an issue 166 //unless someone dumps a load of music into the game directory 167 168 char* nameArray[]={"name1","name2"}; 169 for(int a=0;a<sizeof(nameArray);a++) 170 { 171 if(nameArray[a]==name) AudioCD.play(a,loop?-1:1,0,0); 172 } 173 174 if (_midiData && !AudioCD.isPlaying()) { 163 175 /* 164 176 FILE *out = fopen("music.mid", "wb"); 165 177 fwrite(_midiData, smfSize, 1, out); … … 176 188 177 189 void MidiPlayer::stopMusic() { 178 190 Common::StackLock lock(_mutex); 191 AudioCD.stop(); 179 192 180 193 _isPlaying = false; 181 194 if (_parser) { -
engines/made/music.cpp
1 /* ScummVM - Graphic Adventure Engine1 /* ScummVM - Graphic Adventure Engine 2 2 * 3 3 * ScummVM is the legal property of its developers, whose names 4 4 * are too numerous to list here. Please refer to the COPYRIGHT … … 34 34 #include "common/file.h" 35 35 36 36 #include "made/music.h" 37 #include "sound/audiocd.h" 37 38 38 39 namespace Made { 39 40 … … 202 203 } 203 204 204 205 void MusicPlayer::stop() { 206 AudioCD.stop(); 205 207 Common::StackLock lock(_mutex); 206 208 207 209 _isPlaying = false; … … 212 214 } 213 215 214 216 void MusicPlayer::pause() { 217 AudioCD.stop(); 215 218 setVolume(-1); 216 219 _isPlaying = false; 217 220 } -
engines/made/scriptfuncs.cpp
273 273 274 274 if (_vm->getGameID() == GID_RTZ) { 275 275 if (musicNum > 0) { 276 276 277 _musicRes = _vm->_res->getXmidi(musicNum); 277 278 if (_musicRes) 278 _vm->_music->playXMIDI(_musicRes); 279 { 280 //AudioCD.stop(); 281 /* int loops[50]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 282 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 283 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 284 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 285 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 286 // AudioCD.play(musicNum,loops[musicNum],0,0); 287 //if(!AudioCD.isPlaying()) */ 288 _vm->_music->playXMIDI(_musicRes); 289 } 290 279 291 } 280 292 } else { 281 293 // HACK: music number 2 in LGOP2 is file MT32SET.TON, which … … 287 299 return 0; 288 300 if (musicNum > 0) { 289 301 _musicRes = _vm->_res->getMidi(musicNum); 290 if (_musicRes) 291 _vm->_music->playSMF(_musicRes); 302 if (_musicRes) { 303 if(AudioCD.getStatus().track!=musicNum) 304 { 305 AudioCD.stop(); 306 int loops[50]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 307 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 308 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 309 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 310 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; 311 AudioCD.play(musicNum,loops[musicNum],0,0); 312 } 313 if(!AudioCD.isPlaying()) _vm->_music->playSMF(_musicRes); 314 } 292 315 } 293 316 } 294 317 -
engines/saga/music.cpp
286 286 } else { 287 287 realTrackNumber = resourceId + 1; 288 288 } 289 if (_vm->getGameId() == GID_IHNM) { 290 flags = MUSIC_LOOP; 291 } 289 292 290 293 // Try to open standalone digital track 291 294 char trackName[2][16]; -
engines/sci/sound/midiparser_sci.cpp
563 563 case 0x9: 564 564 case 0xA: 565 565 case 0xE: 566 if(_pSnd->playSilent) info.event = info.channel() | 0x80; 566 567 info.basic.param1 = *(_position._play_pos++); 567 568 info.basic.param2 = *(_position._play_pos++); 568 569 if (info.command() == 0x9 && info.basic.param2 == 0) -
engines/sci/sound/music.cpp
35 35 #include "sci/engine/state.h" 36 36 #include "sci/sound/midiparser_sci.h" 37 37 #include "sci/sound/music.h" 38 #include "sound/audiocd.h" 38 39 39 40 namespace Sci { 40 41 … … 256 257 if (track->digitalChannelNr != -1) { 257 258 byte *channelData = track->channels[track->digitalChannelNr].data; 258 259 delete pSnd->pStreamAud; 260 delete pSnd->pStreamAud2; 259 261 byte flags = Audio::FLAG_UNSIGNED; 260 262 // Amiga SCI1 games had signed sound data 261 263 if (_soundVersion >= SCI_VERSION_1_EARLY && g_sci->getPlatform() == Common::kPlatformAmiga) … … 265 267 track->digitalSampleSize - track->digitalSampleStart - endPart, 266 268 track->digitalSampleRate, flags, DisposeAfterUse::NO); 267 269 delete pSnd->pLoopStream; 270 delete pSnd->pLoopStream2; 271 pSnd->pLoopStream2=0; 268 272 pSnd->pLoopStream = 0; 269 273 pSnd->soundType = Audio::Mixer::kSFXSoundType; 270 274 pSnd->hCurrentAud = Audio::SoundHandle(); … … 329 333 } 330 334 331 335 void SciMusic::soundPlay(MusicEntry *pSnd) { 336 332 337 _mutex.lock(); 333 338 334 339 uint playListCount = _playList.size(); … … 368 373 } 369 374 } 370 375 376 377 //Attempt to play using AudioCD sound 378 //If the CD Audio isn't already going then play with audiocd 379 pSnd->playSilent=false; 380 /*if(!AudioCD.isPlaying()) 381 { 382 AudioCD.play(pSnd->resourceId,pSnd->loop,0,0); 383 if(AudioCD.isPlaying()) pSnd->playSilent=true; 384 } 385 else 386 {*/ 387 //if its not priority 1 then try to play digitally as a sound effect 388 //I'm going to piggyback the existing audio functions and make my ogg behave like a SCI digital resource thus avoiding me doing any work.... 389 char trackName[16]; 390 sprintf(trackName, "track%d", pSnd->resourceId); 391 Audio::SeekableAudioStream *_cdSoundStream; 392 if(pSnd->status==kSoundPaused) 393 { 394 _pMixer->pauseHandle(pSnd->hCurrentAud2,false); 395 pSnd->playSilent=true; 396 } 397 if(!_pMixer->isSoundHandleActive(pSnd->hCurrentAud2)) 398 { 399 if(_cdSoundStream=Audio::SeekableAudioStream::openStreamFile(trackName)) 400 { 401 402 pSnd->length=_cdSoundStream->getLength().msecs(); 403 pSnd->pStreamAud2 = _cdSoundStream; 404 if (pSnd->loop > 1) { 405 pSnd->pLoopStream2 = new Audio::LoopingAudioStream(pSnd->pStreamAud2, 406 pSnd->loop, DisposeAfterUse::NO 407 ); 408 _pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud2, 409 pSnd->pLoopStream2, -1, pSnd->volume*2, 0, 410 DisposeAfterUse::NO); 411 } else { 412 _pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud2, 413 pSnd->pStreamAud2, -1, pSnd->volume*2, 0, 414 DisposeAfterUse::NO); 415 } 416 //_pMidiDrv->setVolume(vol); 417 pSnd->playSilent=true; 418 } 419 } 420 //} 371 421 if (pSnd->pStreamAud) { 372 422 if (!_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) { 373 423 // Sierra SCI ignores volume set when playing samples via kDoSound … … 411 461 } 412 462 413 463 void SciMusic::soundStop(MusicEntry *pSnd) { 464 465 if(pSnd&&pSnd->pStreamAud2) 466 { 467 int32 timeelapsed=_pMixer->getSoundElapsedTime(pSnd->hCurrentAud2); 468 469 if(pSnd->loop<=1&&pSnd->length-timeelapsed<4000&&_pMixer->isSoundHandleActive(pSnd->hCurrentAud2)) 470 { 471 return; 472 } 473 //checks to see if less than 4 seconds left in sample and carries on playing it if there are 474 } 414 475 SoundStatus previousStatus = pSnd->status; 476 if(pSnd->resourceId==AudioCD.getStatus().track) AudioCD.stop(); 415 477 pSnd->status = kSoundStopped; 416 478 if (_soundVersion <= SCI_VERSION_0_LATE) 417 479 pSnd->isQueued = false; 418 480 if (pSnd->pStreamAud) 419 481 _pMixer->stopHandle(pSnd->hCurrentAud); 482 //if(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud2)<pSnd->pStreamAud2->); 483 if (pSnd->pStreamAud2) 484 _pMixer->stopHandle(pSnd->hCurrentAud2); 420 485 421 486 if (pSnd->pMidiParser) { 422 487 _mutex.lock(); … … 438 503 if (pSnd->pStreamAud) { 439 504 // we simply ignore volume changes for samples, because sierra sci also 440 505 // doesn't support volume for samples via kDoSound 441 } else if (pSnd->pMidiParser) { 506 } 507 if (pSnd->pStreamAud2) { 508 _pMixer->setChannelVolume(pSnd->hCurrentAud2, volume * 2); // Mixer is 0-255, SCI is 0-127 509 } 510 if (pSnd->pMidiParser) { 442 511 _mutex.lock(); 443 512 pSnd->pMidiParser->mainThreadBegin(); 444 513 pSnd->pMidiParser->setVolume(volume); … … 481 550 delete pSnd->pLoopStream; 482 551 pSnd->pLoopStream = 0; 483 552 } 553 if (pSnd->pStreamAud2) { 554 _pMixer->stopHandle(pSnd->hCurrentAud2); 555 delete pSnd->pStreamAud2; 556 pSnd->pStreamAud2 = NULL; 557 delete pSnd->pLoopStream2; 558 pSnd->pLoopStream2 = 0; 559 } 484 560 485 561 _mutex.lock(); 486 562 uint sz = _playList.size(), i; … … 514 590 pSnd->status = kSoundPaused; 515 591 if (pSnd->pStreamAud) { 516 592 _pMixer->pauseHandle(pSnd->hCurrentAud, true); 517 } else { 518 if (pSnd->pMidiParser) { 593 } else 594 { 595 if (pSnd->pStreamAud2) { 596 _pMixer->pauseHandle(pSnd->hCurrentAud2, true); 597 } 598 if (pSnd->pMidiParser) { 519 599 _mutex.lock(); 520 600 pSnd->pMidiParser->mainThreadBegin(); 521 601 pSnd->pMidiParser->pause(); … … 536 616 if (pSnd->pStreamAud) { 537 617 _pMixer->pauseHandle(pSnd->hCurrentAud, false); 538 618 pSnd->status = kSoundPlaying; 539 } else { 619 } else 620 { 621 if (pSnd->pStreamAud2) { 622 _pMixer->pauseHandle(pSnd->hCurrentAud2, false); 623 pSnd->status = kSoundPlaying; 624 }else { 540 625 soundPlay(pSnd); 541 } 626 }} 542 627 } 543 628 544 629 void SciMusic::soundToggle(MusicEntry *pSnd, bool pause) { … … 665 750 soundType = Audio::Mixer::kMusicSoundType; 666 751 667 752 pStreamAud = 0; 753 pStreamAud2 = 0; 668 754 pLoopStream = 0; 755 pLoopStream2 = 0; 669 756 pMidiParser = 0; 670 757 } 671 758 … … 706 793 fadeStep = 0; 707 794 fadeCompleted = true; 708 795 } 709 796 710 797 // Only process MIDI streams in this thread, not digital sound effects 711 798 if (pMidiParser) { 712 799 pMidiParser->setVolume(volume); -
engines/sci/sound/music.h
87 87 bool fadeSetVolume; 88 88 bool fadeCompleted; 89 89 bool stopAfterFading; 90 bool playSilent; 91 uint32 length; 90 92 91 93 SoundStatus status; 92 94 … … 105 107 Audio::LoopingAudioStream *pLoopStream; 106 108 Audio::SoundHandle hCurrentAud; 107 109 110 111 Audio::RewindableAudioStream *pStreamAud2; 112 Audio::LoopingAudioStream *pLoopStream2; 113 Audio::SoundHandle hCurrentAud2; 114 108 115 public: 109 116 MusicEntry(); 110 117 ~MusicEntry(); … … 164 171 } 165 172 166 173 void updateAudioStreamTicker(MusicEntry *pSnd) { 167 assert(pSnd->pStreamAud != 0); 168 pSnd->ticker = (uint16)(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud) * 0.06); 174 175 if(pSnd->pStreamAud) pSnd->ticker = (uint16)(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud) * 0.06); 176 if(pSnd->pStreamAud2) pSnd->ticker = (uint16)(_pMixer->getSoundElapsedTime(pSnd->hCurrentAud2) * 0.06); 169 177 } 170 178 171 179 MusicEntry *getSlot(reg_t obj); -
engines/sci/sound/soundcmd.cpp
411 411 musicSlot->fadeSetVolume = false; 412 412 } 413 413 } else if (musicSlot->pMidiParser) { 414 415 if( musicSlot->pStreamAud2&&musicSlot->fadeSetVolume) 416 { 417 _music->soundSetVolume(musicSlot, musicSlot->volume); 418 musicSlot->fadeSetVolume = false; 419 } 414 420 // Update MIDI slots 415 421 if (musicSlot->signal == 0) { 416 422 if (musicSlot->dataInc != readSelectorValue(_segMan, obj, SELECTOR(dataInc))) { -
engines/scumm/imuse/imuse.cpp
575 575 // to bug #780918. 576 576 577 577 int i; 578 579 //HACK - I'm adding 99999 to the sound integer if its one I don't want to actually hear so I test for this here 580 bool dontplayme=false; 581 if(sound>99999) 582 { 583 sound-=99999; 584 dontplayme=true; 585 } 586 578 587 ImTrigger *trigger = _snm_triggers; 579 588 for (i = ARRAYSIZE(_snm_triggers); i; --i, ++trigger) { 580 589 if (trigger->sound && trigger->id && trigger->command[0] == 8 && trigger->command[1] == sound && getSoundStatus_internal (trigger->sound,true)) … … 606 615 if (!player) 607 616 return false; 608 617 618 609 619 // WORKAROUND: This is to work around a problem at the Dino Bungie 610 620 // Memorial. 611 621 // … … 636 646 637 647 player->clear(); 638 648 player->setOffsetNote(offset); 649 if(dontplayme) sound+=99999; 639 650 return player->startSound(sound, driver, _direct_passthrough); 640 651 } 641 652 -
engines/scumm/imuse/imuse_player.cpp
97 97 void *ptr; 98 98 int i; 99 99 100 101 //HACK - I'm adding 99999 to the sound integer if its one I don't want to actually hear so I test for this here 102 bool dontplayme=false; 103 if(sound>99999) 104 { 105 sound-=99999; 106 dontplayme=true; 107 } 108 100 109 // Not sure what the old code was doing, 101 110 // but we'll go ahead and do a similar check. 102 111 ptr = _se->findStartOfSound(sound); … … 122 131 _passThrough = passThrough; 123 132 124 133 for (i = 0; i < ARRAYSIZE(_parameterFaders); ++i) 134 { 125 135 _parameterFaders[i].init(); 136 } 126 137 hook_clear(); 127 138 if(dontplayme) sound+=99999; 128 139 if (start_seq_sound(sound) != 0) { 129 140 _active = false; 130 141 _midi = NULL; … … 173 184 } 174 185 175 186 int Player::start_seq_sound(int sound, bool reset_vars) { 187 188 //HACK - I'm adding 99999 to the sound integer if its one I don't want to actually hear so I test for this here 189 bool dontplayme=false; 190 if(sound>99999) 191 { 192 sound-=99999; 193 dontplayme=true; 194 } 195 176 196 byte *ptr; 177 178 197 if (reset_vars) { 179 198 _loop_to_beat = 1; 180 199 _loop_from_beat = 1; … … 204 223 _parser->property(MidiParser::mpSmartJump, 1); 205 224 _parser->loadMusic(ptr, 0); 206 225 _parser->setTrack(_track_index); 226 if(dontplayme) _parser->_dontplayme=true; 227 228 207 229 setSpeed(reset_vars ? 128 : _speed); 208 230 209 231 return 0; -
engines/scumm/saveload.cpp
471 471 putState(819, 0); 472 472 } 473 473 474 475 //HACK to stop adlib sound playing if cd audio patch is working 476 if (_game.id == GID_MONKEY_VGA && AudioCD.isPlaying()) { 477 int track=AudioCD.getStatus().track; 478 int numloops=AudioCD.getStatus().numLoops; 479 int currentcdsound=_sound->getCurrentCDSound(); 480 _sound->stopAllSounds(); 481 _sound->pauseSounds(false); 482 _sound->playCDTrack(track,numloops,0,0); 483 _sound->pauseSounds(true); 484 //_sound->_currentCDSound=currentcdsound; 485 } 486 487 if(_game.platform == Common::kPlatformPC && _game.version == 0x03 && _game.id == GID_LOOM) 488 { 489 int numloops=AudioCD.getStatus().numLoops; 490 int currentcdsound=_sound->getCurrentCDSound(); 491 _sound->stopAllSounds(); 492 _sound->pauseSounds(false); 493 _sound->playCDTrack(currentcdsound-32,numloops,0,0); 494 _sound->pauseSounds(true); 495 //_sound->_currentCDSound=currentcdsound; 496 } 497 474 498 if (hdr.ver < VER(33) && _game.version >= 7) { 475 499 // For a long time, we didn't set these vars to default values. 476 500 VAR(VAR_DEFAULT_TALK_DELAY) = 60; … … 574 598 575 599 _sound->pauseSounds(false); 576 600 601 577 602 // WORKAROUND: Original save/load script ran this script 578 603 // after game load, and o2_loadRoomWithEgo() does as well 579 604 // this script starts character-dependent music -
engines/scumm/scumm.cpp
1705 1705 break; 1706 1706 } 1707 1707 1708 //HACK to get the adlib version of Loom PC EGA to use the MT32 midi's. 1709 1710 if(_game.version == 3 && _game.platform == Common::kPlatformPC && _game.id== GID_LOOM) 1711 _musicType = MDT_MIDI; 1712 1713 1714 1708 1715 if ((_game.id == GID_MONKEY_EGA || (_game.id == GID_LOOM && _game.version == 3)) 1709 1716 && (_game.platform == Common::kPlatformPC) && _musicType == MDT_MIDI) { 1710 1717 Common::String fileName; -
engines/scumm/sound.cpp
168 168 Audio::AudioStream *stream; 169 169 int size = -1; 170 170 int rate; 171 bool foundatrack=false; 171 172 172 173 if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) { 173 174 if (soundID >= 13 && soundID <= 32) { … … 410 411 411 412 if (_vm->_game.id == GID_MONKEY_VGA || _vm->_game.id == GID_MONKEY_EGA 412 413 || (_vm->_game.id == GID_MONKEY && _vm->_game.platform == Common::kPlatformMacintosh)) { 414 if (_vm->_game.id == GID_MONKEY_VGA) 415 { 416 static const int tracks[20]={0x0000006e,0x0000006c,0x00000068,0x00000065,0x00000064,0x00000073,0x00000097,0x00000070,0x00000072,0x00000071,0x00000067,0x00000066,0x00000069,0x0000006a,0x0000006b,0x0000006d,0x0000006f,0x00000074,0x00000075,0x00000076}; 417 static const int loop[20]={1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1}; 418 for (int a=0;a<20;a++) 419 { 420 421 if(soundID==tracks[a]) 422 { 423 playCDTrack(a+1,loop[a],0,0); 424 stopCDTimer(); 425 foundatrack=true; 426 _currentCDSound=soundID; 427 } 428 } 429 } 430 413 431 // Works around the fact that in some places in MonkeyEGA/VGA, 414 432 // the music is never explicitly stopped. 415 433 // Rather it seems that starting a new music is supposed to … … 419 437 _vm->_imuse->stopAllSounds(); 420 438 } 421 439 } 440 else if(_vm->_game.platform == Common::kPlatformPC && _vm->_game.version == 0x03 && _vm->_game.id == GID_LOOM) 441 { 442 int loop=1; 443 if(soundID-32==11||soundID-32==31) loop=-1; 444 if(soundID<133) 445 { 446 playCDTrack(soundID-32,loop,0,0); 447 stopCDTimer(); 448 foundatrack=true; 449 _currentCDSound=soundID; 450 } 451 } 422 452 423 453 if (_vm->_musicEngine) { 454 if(foundatrack) soundID+=99999; 424 455 _vm->_musicEngine->startSound(soundID); 456 425 457 } 426 458 427 459 if (_vm->_townsPlayer) -
engines/touche/resource.cpp
32 32 #include "sound/decoders/vorbis.h" 33 33 #include "sound/decoders/raw.h" 34 34 #include "sound/audiostream.h" 35 #include "sound/audiocd.h" 35 36 36 37 #include "touche/midi.h" 37 38 #include "touche/touche.h" … … 600 601 } 601 602 602 603 void ToucheEngine::res_loadMusic(int num) { 604 //dont loop 17,19,20,24 605 int loops=-1; 606 if(num==17 || num==19 || num==20 || num == 24) loops=1; 607 AudioCD.stop(); 608 AudioCD.play(num,loops,0,0); 609 if(AudioCD.isPlaying()) return; 610 603 611 debugC(9, kDebugResource, "ToucheEngine::res_loadMusic() num=%d", num); 604 612 uint32 size; 605 613 const uint32 offs = res_getDataOffset(kResourceTypeMusic, num, &size); -
sound/midiparser.cpp
48 48 _abort_parse(0) { 49 49 memset(_active_notes, 0, sizeof(_active_notes)); 50 50 _next_event.start = NULL; 51 _dontplayme=false; 51 52 _next_event.delta = 0; 52 53 _next_event.event = 0; 53 54 _next_event.length = 0; … … 161 162 void MidiParser::onTimer() { 162 163 uint32 end_time; 163 164 uint32 event_time; 164 165 165 if (!_position._play_pos || !_driver) 166 166 return; 167 167 … … 228 228 } 229 229 _driver->metaEvent(info.ext.type, info.ext.data, (uint16)info.length); 230 230 } else { 231 if (info.command() == 0x8 ) {231 if (info.command() == 0x8 ) { 232 232 activeNote(info.channel(), info.basic.param1, false); 233 233 } else if (info.command() == 0x9) { 234 234 if (info.length > 0) 235 235 hangingNote(info.channel(), info.basic.param1, info.length * _psec_per_tick - (end_time - event_time)); 236 236 else 237 237 activeNote(info.channel(), info.basic.param1, true); 238 } 239 if(!_dontplayme) 240 { 241 sendToDriver(info.event, info.basic.param1, info.basic.param2); 238 242 } 239 sendToDriver(info.event, info.basic.param1, info.basic.param2);240 243 } 241 244 242 245 … … 250 253 _position._play_time = end_time; 251 254 _position._play_tick = (_position._play_time - _position._last_event_time) / _psec_per_tick + _position._last_event_tick; 252 255 } 256 253 257 } 254 258 255 259 void MidiParser::allNotesOff() { -
sound/midiparser.h
363 363 */ 364 364 mpCenterPitchWheelOnUnload = 4 365 365 }; 366 bool _dontplayme; 366 367 367 368 public: 368 369 typedef void (*XMidiCallbackProc)(byte eventData, void *refCon); -
sound/mixer.h
68 68 69 69 kMusicSoundType = 1, 70 70 kSFXSoundType = 2, 71 kSpeechSoundType = 3 71 kSpeechSoundType = 3, 72 72 }; 73 73 74 74 enum {