Advertisement
Guest User

Untitled

a guest
Jan 24th, 2025
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.21 KB | None | 0 0
  1. //**sound.h** line 73
  2.  
  3. bool playPCM(const byte *data, uint32 size);
  4. bool isPlayingVoice(); // add
  5. void playVoice(const Common::String &filename, int num); // add
  6.  
  7. //**sound.cpp** line 29
  8. #include "audio/decoders/raw.h"
  9. #include "audio/decoders/wave.h" // add
  10. #include "audio/mixer.h"
  11.  
  12. //**sound.cpp** line 247
  13.  
  14. bool Sound::isPlayingVoice() {
  15.     Channel *ch = &_channels[0];
  16.     if (_mixer->isSoundHandleActive(ch->handle)) {
  17.         return true;
  18.     }
  19.     return false;
  20. }
  21.  
  22. void Sound::playVoice(const Common::String &dlgFile, int num) {
  23.     Common::String filename = Common::String::format("aud%s%d.wav", dlgFile.c_str(), num);
  24.     Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(filename.c_str());
  25.  
  26.     if (!stream)
  27.         return;
  28.  
  29.     _mixer->stopAll();
  30.  
  31.     Audio::AudioStream *input = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
  32.  
  33.     Channel *ch = &_channels[0];
  34.     byte volume = 127;
  35.     _mixer->playStream(Audio::Mixer::kSpeechSoundType, &ch->handle, input, -1, volume, 0, DisposeAfterUse::YES);
  36. }
  37.  
  38. bool Sound::playPCM(const byte *data, uint32 size) {
  39.  
  40. //**dialog.h** line 121
  41.  
  42. Common::String _str;
  43. Common::String _filename;
  44.  
  45. //**dgds.cpp** line 122
  46.  
  47. const Common::FSNode gameDataDir(ConfMan.getPath("path"));
  48. SearchMan.addSubDirectoryMatching(gameDataDir, "patches");
  49. SearchMan.addSubDirectoryMatching(gameDataDir, "audio"); // add
  50.  
  51. //**scene.cpp** line 935
  52.  
  53. if (!haveTiredDlg) {
  54.     Dialog dlg;
  55.     dlg._filename = Common::String("S61.SDS"); // add
  56.     dlg._num = TIRED_DLG_ID;
  57.  
  58. //**scene.cpp** line 1018
  59.  
  60. bool finished = false;
  61. if (clearDlgFlag || (dlg._state->_hideTime && timeNow >= dlg._state->_hideTime && !DgdsEngine::getInstance()->_soundPlayer->isPlayingVoice())) { // change
  62.     finished = true;
  63. }
  64.  
  65. //**dgds.cpp** line 41
  66.  
  67. #include "dgds/menu.h"
  68. #include "dgds/sound.h" // add
  69.  
  70. //**scene.h** line 172
  71.  
  72. virtual bool parse(Common::SeekableReadStream *s, const Common::String &filename) = 0; // change
  73.  
  74. //**scene.h** line 199
  75.  
  76. bool readOpList(Common::SeekableReadStream *s, Common::Array<SceneOp> &list) const;
  77. bool readDialogList(Common::SeekableReadStream *s, Common::Array<Dialog> &list, const Common::String &filename, int16 filenum = 0) const; // change
  78. bool readTriggerList(Common::SeekableReadStream *s, Common::Array<SceneTrigger> &list) const;
  79.  
  80. //**scene.h** line 219
  81.  
  82. bool loadRestart(const Common::String &filename, ResourceManager *resourceManager, Decompressor *decompressor);
  83. bool parse(Common::SeekableReadStream *s, const Common::String &filename) override; // change
  84. bool parseInf(Common::SeekableReadStream *s);
  85.  
  86. //**scene.h** line 275
  87.  
  88. bool load(const Common::String &filename, ResourceManager *resourceManager, Decompressor *decompressor);
  89. bool parse(Common::SeekableReadStream *s, const Common::String &filename) override; // change
  90. void unload();
  91.  
  92. //**scene.cpp** line 260
  93.  
  94. bool Scene::readDialogList(Common::SeekableReadStream *s, Common::Array<Dialog> &list, const Common::String &filename, int16 filenum /* = 0 */) const { // change
  95.  
  96. //**scene.cpp** line 268
  97.  
  98. for (uint i = startsize; i < list.size(); i++) {
  99.     Dialog &dst = list[i];
  100.     dst._filename = filename; // add
  101.     dst._num = s->readUint16LE();
  102.  
  103. //**scene.cpp** line 535
  104.  
  105. if (chunk.isSection(ID_SDS)) {
  106.     result = parse(stream, filename); // change
  107. }
  108.  
  109. //**scene.cpp** line 546
  110.  
  111. bool SDSScene::parse(Common::SeekableReadStream *stream, const Common::String &filename) {
  112.  
  113. //**scene.cpp** line 568
  114.  
  115. if (isVersionUnder(" 1.214")) {
  116.     readDialogList(stream, _dialogs, filename); // change
  117. }
  118.  
  119. //**scene.cpp** line 720
  120.  
  121. _version = fileVersion;
  122. result = readDialogList(stream, _dialogs, filename, fileNum);
  123. _version = oldVer;
  124.  
  125. //**scene.cpp** line 1160
  126.  
  127. DgdsEngine::getInstance()->_soundPlayer->playVoice(dlg._filename, dlg._num); // add
  128.  
  129. int time = delay * (9 - engine->getTextSpeed());
  130. assert(dlg._state);
  131.  
  132. //**scene.cpp** line 1721
  133.  
  134. if (chunk.isSection(ID_GDS)) {
  135.     // do nothing, this is the container.
  136.     assert(chunk.isContainer());
  137. } else if (chunk.isSection(ID_INF)) {
  138.     result = parseInf(stream);
  139. } else if (chunk.isSection(ID_SDS)) {
  140.     result = parse(stream, filename); // change
  141. }
  142.  
  143. //**scene.cpp** line 1912
  144.  
  145. bool GDSScene::parse(Common::SeekableReadStream *stream, const Common::String &filename) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement