| 80 | } |
| 81 | |
| 82 | void SoundObject::StartSound() |
| 83 | { |
| 84 | SoundPars pars; |
| 85 | FindSound(_soundName, pars); |
| 86 | |
| 87 | // Nothing resolved means no audio to play: either FindSound already reported |
| 88 | // an unknown key, or the entry is subtitle-only (titles, empty sound[] file). |
| 89 | // Either way play nothing — the same guard DynSoundObject::Simulate uses |
| 90 | // (pars.name[0]) — so an empty name never reaches the loader. Titles, if any, |
| 91 | // still run via SimulateTitles(). |
| 92 | if (pars.name.GetLength() == 0) |
| 93 | { |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if (_hasObject) |
| 98 | { |
| 99 | Object* source = _object; |
| 100 | if (_looped) |
| 101 | { |
| 102 | _sound = |
| 103 | GSoundScene->OpenAndPlay(pars.name, source->WorldPosition(), source->WorldSpeed(), pars.vol, pars.freq); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | _sound = GSoundScene->OpenAndPlayOnce(pars.name, source->WorldPosition(), source->WorldSpeed(), pars.vol, |
| 108 | pars.freq); |
| 109 | } |
| 110 | source->AttachWave(_sound, pars.freq); |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | if (_looped) |
| 115 | { |
| 116 | _sound = GSoundScene->OpenAndPlay2D(pars.name, pars.vol, pars.freq, false); |
| 117 | } |
| 118 | else |
| 119 | { |
| 120 | _sound = GSoundScene->OpenAndPlayOnce2D(pars.name, pars.vol, pars.freq, false); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | void SoundObject::LoadSound() |
| 126 | { |
nothing calls this directly
no test coverage detected