Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIRECTOR: allocate more than 2 audio channels for earlier Director versions #3540

Merged
merged 1 commit into from Nov 20, 2021

Conversation

@mistydemeo
Copy link
Contributor

@mistydemeo mistydemeo commented Nov 15, 2021

I've found a Director 3 game that tries to play back audio on channel 3, which currently leads to an assertion failure - see #3539. I'm not entirely clear how it was determined that older Director versions had only two channels; looking at the commit history D4 was given 4 channels in 88d8577, but it's not really clear to me if it was determined for sure that pre-D4 should only have two channels.

cc @moralrecordings for thoughts, since you bumped the number of channels for D4.

@djsrv
Copy link
Member

@djsrv djsrv commented Nov 16, 2021

There are two ways for Director to play sounds - with the score and with Lingo.

The score can only control sound channels 1 and 2.

In D2-3, Lingo commands for sounds don't allow you to specify which channel to play in, and IIRC they always default to channel 1. In Director 4, Macromedia added a channel argument to some of the sound commands, and they can control channels 3 and 4 without interfering with the score.

Unless I'm missing something, there is no way for a movie to interact with sound channels 3 and 4 before Director 4, if they existed at all. If a D2-3 movie is somehow doing that, I'm inclined to believe our sound code has an off-by-one error or something similar. Unless we can confirm there is in fact a legitimate way to use channels 2-4 before Director 4, this should not be merged.

If there is a legitimate way for movies to interact with sound channels 3 and 4, we'd also need to adjust the code that actually plays the sounds in those channels:

// Channels above 2 are only usable by Lingo.
if (g_director->getVersion() >= 400) {
sound->playPuppetSound(3);
sound->playPuppetSound(4);
}

Loading

@mistydemeo
Copy link
Contributor Author

@mistydemeo mistydemeo commented Nov 17, 2021

I dug up the source in question. Looks like the original Lingo source is specifying 3 in this case:

PlayAiffFile(3,"P07")

Where PlayAiffFile is a macro that dispatches to playFile with the channel number unaltered. From checking, looks like it uses the numbers 1 and 3 in the source, but not 2.

Edit:

In D2-3, Lingo commands for sounds don't allow you to specify which channel to play in, and IIRC they always default to channel 1.

I checked the manuals, and both 3.0 and 3.1 have the sound channel as the first argument - sound playFile whichChannel, whichFile. Maybe I'm misunderstanding and it's referring to something else though?

Loading

@mistydemeo mistydemeo force-pushed the director_3_more_than_two_channels branch from 43c97d7 to 9e0ee1d Nov 20, 2021
@mistydemeo
Copy link
Contributor Author

@mistydemeo mistydemeo commented Nov 20, 2021

Updated the commit to alter the check in score.cpp to check for D3 instead of D4, and restored the original check except made it so the old behaviour works on D2. In testing, I confirmed that Oz gains the ability to play back voices with these two checks.

Loading

@djsrv djsrv merged commit 1e9ecf4 into scummvm:master Nov 20, 2021
8 checks passed
Loading
@djsrv
Copy link
Member

@djsrv djsrv commented Nov 20, 2021

Great, thanks for confirming.

Loading

@mistydemeo mistydemeo deleted the director_3_more_than_two_channels branch Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants