Author Topic: Play speech while digital sound effect is also playing  (Read 13916 times)

0 Members and 1 Guest are viewing this topic.

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #15 on: October 11, 2015, 07:59:19 AM »
Why, though?

Offline Collector

Re: Play speech while digital sound effect is also playing
« Reply #16 on: October 11, 2015, 10:30:46 AM »
Just kicking ideas around for simultaneous sounds, that is all. It did make for pretty effective footfall sounds. Granted a bit of a moot point as it would just be another SND resource. Also DOSBox would just play it through the host's soundcard.
KQII Remake Pic

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #17 on: October 13, 2015, 10:59:35 AM »
Code: [Select]
// ===========================================================================
// When giving the milk bottle to one of the babies in the garden in KQ6 (room
// 480), script 481 starts a looping baby cry sound. However, that particular
// script also has an overriden check method (cryMusic::check). This method
// explicitly restarts the sound, even if it's set to be looped, thus the same
// sound is played twice, squelching all other sounds. We just rip the
// unnecessary cryMusic::check method out, thereby stopping the sound from
// constantly restarting (since it's being looped anyway), thus the normal
// game speech can work while the baby cry sound is heard.
// Fixes bug: #4955
-- ScummVM, /engines/sci/engine/script_patches.cpp

Actual method being replaced with naught but a return:
Code: [Select]
(method (check)
(if (((babyIsCrying and DoAudio(audPAUSE)) and (== DoAudio(audPOSITION) -1)) and not global84)
(self:play())
)
(super:check())
)
(I named local0 and looked up what subops 4 and 6 are, this should be correct.)

Make of that what you will.
« Last Edit: October 13, 2015, 11:02:02 AM by Kawa »

Offline troflip

Re: Play speech while digital sound effect is also playing
« Reply #18 on: October 13, 2015, 04:59:00 PM »
That's definitely some strange code. Does it work properly in Sierra's interpreter? It looks like it would just immediately pause any playing audio (thus the speech).

The other thing is that it's dependent on DoAudio returning a value. In ScummVM it doesn't return a value (well, it just returns whatever was in the accumulator). Maybe DoAudio(audPAUSE) is supposed to return some value, and it returns 0 in Sierra's interpreter in this case... now sure how or why though...
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #19 on: October 13, 2015, 05:31:49 PM »
I would've checked, and I have managed to make the beach connect to the garden with the baby's tears, but I neglected to give myself the bottle because I'm a dumbass so I had no way to make the baby's tears cry.

Edit: okay, edited the beach script again. Getting the ring should get me the bottle as well so I can make these babies cry.
Edit: got the milk, on my way to the babies.
Edit: okay those are clearly two digital samples overlapping in ScummVM. On to SSCI...
Edit: SSCI does not overlap the narrator and babies, and unless I'm mistaken they restart crying when the narrator shuts up.
« Last Edit: October 13, 2015, 05:54:27 PM by Kawa »

Offline troflip

Re: Play speech while digital sound effect is also playing
« Reply #20 on: October 13, 2015, 06:28:30 PM »
Ok, I tried plopping that code into my test game (I removed the global84, since that doesn't ever seem to be set, even in KQ6). And it worked!

And of course, in ScummVM, it doesn't work. The speech never happens.

I wish I could get the DebugPrint working in ScummVM. But the FileIO functions seem to work differently...
[edit: ah, ScummVM doesn't support writing arbitrary files... only save game files]



« Last Edit: October 13, 2015, 06:48:20 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #21 on: October 13, 2015, 06:50:24 PM »
More confirmation, (send gMusic1: number(5) play()), nice long sound, then a second or so later DoAudio(2 3), it cuts off the first in SSCI and overlaps them in ScummVM. There are no MIDI versions of those sounds. (send gMusic2: number(3) play()) on the other hand does cut off the first sound, as do two DoAudio calls.

One more reason to detect and deny XD

Offline troflip

Re: Play speech while digital sound effect is also playing
« Reply #22 on: October 13, 2015, 07:26:59 PM »
Looks like DoAudio(audPAUSE) isn't supposed to actually do anything. At least in Sierra's terp, it definitely does not pause the currently playing audio track. It also does not return any specific value (just whatever was in the accumulator, which in that snippet of code will likely be the value of babyCrying). So I'm not sure what its purpose is.

Kq6 has an Audio class with a pause function that calls audPAUSE, but no one calls it.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline troflip

Re: Play speech while digital sound effect is also playing
« Reply #23 on: October 13, 2015, 07:47:06 PM »
fyi, the following snippet seems to work both in ScummVM and Sierra... In ScummVM the background audio keeps playing. In Sierra's the background audio starts up again after the speech is finished.

Code: [Select]

(local
babyIsCrying = 0
)

(instance windSound of Sound
(properties
priority 15
number 400
loop -1
)

(method (play)
(= babyIsCrying 1)
(super:play())
)

(method (stop)
(= babyIsCrying 0)
(super:stop())
)

(method (check)
(if (babyIsCrying and (== DoAudio(audPOSITION) -1))
(self:play())
)
(super:check())
)
)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #24 on: October 16, 2015, 02:40:11 PM »
Incidentally, is it me or do audblast.drv and ScummVM speak at different pitches? Something I noticed while making babies cry.

Offline troflip

Re: Play speech while digital sound effect is also playing
« Reply #25 on: October 16, 2015, 02:57:09 PM »
I haven't noticed that.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Collector

Re: Play speech while digital sound effect is also playing
« Reply #26 on: October 16, 2015, 08:56:40 PM »
Incidentally, is it me or do audblast.drv and ScummVM speak at different pitches? Something I noticed while making babies cry.

Are you running the Win or DOS version in ScummVM? Not sure if it would make a difference, but the Win version was intended to be played through the Win31 Sound Mapper and the DOS via AUDBLAST.
KQII Remake Pic

Offline Kawa

Re: Play speech while digital sound effect is also playing
« Reply #27 on: October 17, 2015, 03:44:37 AM »
Are you running the Win or DOS version in ScummVM? Not sure if it would make a difference, but the Win version was intended to be played through the Win31 Sound Mapper and the DOS via AUDBLAST.
I recall the slow non-AVI logo, so that'd be DOS on both. Fortunately, I don't need that scene specifically to recheck such a thing.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.039 seconds with 21 queries.