Previously, volume changes would only be picked up by the next sound
started in the channel (if at all).
Fixes the hint music clashing in the fortune teller floor of the
department store and Club Exclaim in The Seven Colors.
Previously the puppetSound flag condition would only be disabled if the
sound was playing at the time of the movie switch.
Fixes music when entering the cat room straight from the start room
in The Seven Colors.
In some D4 version 400 (file version 0x45B) files, sound resource loop bounds are
invalid but their cast member flags are set to loop. Examples are
"Barbie and her Magical Dreamhouse" and "Necrobius" (Windows demo).
Invalid is any situation where the following does not hold:
`loop_start < loop_end <= size`
In the original environment, these resources are handled by disabling
the looping flag and resetting the loop bounds on the sound resources to
0 -> sample size.
This commit checks for invalid loop bounds and applies roughly the same
fix. This fixes the invalid sound looping behaviours present in the
aforementioned titles.
This should give the same behaviour as DirectorSound::playCastMember.
Fixes sounds playing twice if the animation takes too long in Spaceship
Warlock (e.g. the hovertaxi landing in the demo).
Previously, paths were verified by pathMakeRelative().
This method had several drawbacks; the code was increasingly ad-hoc
and recursive, and the function would return a Common::String that
was not guaranteed to be distinct. 90% of the time the path would need
to be converted to Common::Path so that file streams could use it.
This code has been replaced with findPath(), a function which takes a
path string as recieved from Director (e.g. a Lingo script, a filename
stored in a CastInfo record) and returns a Common::Path object for the
file on the local system. The inner workings have been split into subfunctions,
which should make it easier to add workarounds and fuzz at the correct
layer.
We used to close resources when we were closing movies, but with making
Archives owned by Director class, we now have list of all _seen_ resources.
This change implements a proper, ordered list of resources which are
overriding the ones loaded earlier.
Fixes cursors in the7colors which were read from previously loaded Shared Casts.
--start-movie=04CLUB:FloorColidor:IntoFloo
This reverts commit 72d890b751.
This brought a regression of turning sound in many games.
It breaks again the7colors when exiting the car:
--start-movie=03CAR:xn--Car.IO-ma28a:CarOutSideView03
By D5, titles are allowed to play back sounds on an arbitrary channel
and the mixer deals with it. This apparently works to an extent on Mac
for D4 and below, whereas Windows D4 has a hard limit of 4 channels.
As the clear intent is to play something, we should do that for all
versions, unless a counterexample shows up.
Used by Smarty.
The logic to determine if a sound is loopable or not didn't consder that
a sound could loop from the beginning. A short song in The Seven Colors
begins at sample 0 and ends at 6456, which was considered non-looping
before this.
Fixed exit door in the7colors, where the frame had a looping
birds chirping sound together with the following Lingo:
if the soundbusy of 2 then go to the frame
And that led to an infinite loop and inability to pass through the
opened door.
The original apparently is returning 0 in-between the sound loops
since it manually restarts the sound after its completion. We, in
contrast, are optimizing that and using LoopedAudioStream
since f48dbb43b6
playStream() is called right after setting loopPtr, which was leading
to immediate reset of loopPtr. Thus, we were not able to control
the looping sounds
It's possible for audio playback to still be underway at the time the
AudioFileDecoder is destroyed. For Mac games, destroying the _macresman
will also destroy the stream, feeing the pointer while it may be read from
in another thread. Copying the audio instead of just fetching the stream
from the MacResMan ensures that new stream will outlive the MacResMan if
necessary.
Fixes https://bugs.scummvm.org/ticket/13881.
Lingo function `closeResFile` is only responsible for closing resource
file opened by `openResFile`. Register in `openResFile` which files
where opened and close only those files in `closeResFile`.
- Rename `_openResFiles` to `_allOpenResFiles` and
- Add new `_openResFiles` hashmap to track which files were opened in
`openResFile`.
For looping sounds, the original code polled the score and created a new
AudioStream every time the previous iteration finished playing. The
downside of this approach is the sound needs to be fully resampled and
buffered after each playback, which can be heard as a gap between loops.
To fix this, loops now use a LoopableAudioStream. The reason why the
previous code did not was to allow for a specific edge case.
In Director, when a looping audio channel is set to cast member 0, the
loop is allowed to finish the current iteration before the audio stops.
Originally there wasn't a way of doing that, but now the
LoopableAudioStream classes can stop playing after a number of
iterations. As such, we keep a copy of the LoopableAudioStream handle
and call for the loop to stop when the cast member gets set to 0.
Improves looped audio playback in Eastern Mind.
Fixes the guitar solo between the transition from BLAST.DXR to INTRO.DXR
in Meet MediaBand.
Fixes the audio transition between n.am and s.am in Meet MediaBand.