Opened 20 years ago

Closed 20 years ago

Last modified 5 years ago

#8317 closed patch

Panning and volume

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Indiana Jones 4


I didn't realize it until I started replaying some games in preparation for 0.6.0, but sound effects are softer in the current version of ScummVM than they are in earlier versions. This is probably because of the panning. When a sound isn't panned, vol_l and vol_r won't ever exceed 127, so sound effects are muted, even when they should be playing at full blast.

The more I think about that, the more wrong it seems. As an experiment, the attached patch causes the panning to affect at most one channel at a time. I was afraid that this would affect the perceived volume badly, but it sounds pretty ok to me.

Ticket imported from: #886786. Ticket imported from: patches/422.

Attachments (1)

panvolume.diff (1.6 KB ) - added by eriktorbjorn 20 years ago.
Patch against a January 27 CVS snapshot

Download all attachments as: .zip

Change History (10)

by eriktorbjorn, 20 years ago

Attachment: panvolume.diff added

Patch against a January 27 CVS snapshot

comment:1 by eriktorbjorn, 20 years ago

Owner: set to fingolfin

comment:2 by eriktorbjorn, 20 years ago

By the way, the game that finally made me experiment with this was Fate of Atlantis. I realized I could hardly make out Indy's first line in the intro. Partly because I had cranked up the music volume. :-)

comment:3 by fingolfin, 20 years ago

That patch isn't correct - mostly because the "panning" code we have isn't actually panning, but balance ;-)

When I am back home later today or tonight, I can look into replacing this with either real panning code, or balance code, depending on what we actually need (or maybe both).

Quick explanation: * balance is the effect we have (and which your patch fixes): turn the volume of the two channels up and down seperatly * pan OTOH will not loose any audio data; if for example panning is set 100% to the right, it will play *both* the left and right channel on the right speaker, and silence on the left speaker.

The question which remains, of course, is which one the various engines actually want/need :-)

comment:4 by eriktorbjorn, 20 years ago

The only games I know of that use "panning" (in whatever sense we mean it):

* Curse of Monkey Island * Broken Sword I * Broken Sword II

Both CMI and Broken Sword use panning to simulate sound coming from either side of the scene.

I only know of one case where CMI uses it, and that's when van Halgen is swinging across the screen between ship-to-ship battles. (I'm not even sure if this is still working. It didn't sound like it when I tried, but I didn't have a proper savegame so I had to cheat my way there.) Note that CMI changes the panning of the sound several times while it is playing.

I'm not too familiar with Broken Sword I, but I assume it uses it the same way as Broken Sword II. BS2 uses it for both sound effects and speech. I have a feeling that most of these sounds are actually stored as mono, but at least BS1 have a few stereo sound effects, e.g. the sound of the wind at the very beginning. (This is probably to allow the sound to track the movement of the leaves, without having to change panning in mid-sound.)

comment:5 by eriktorbjorn, 20 years ago

I forgot to mention that the original BS2 engine implemented panning by calling IDirectSoundBuffer_SetPan(). I don't know if that means any more to you than it did to me. :-)

comment:6 by fingolfin, 20 years ago

Well at least it is something that we can look up in some online docs (google rulez :-)

comment:7 by fingolfin, 20 years ago

Status: newclosed

comment:8 by fingolfin, 20 years ago

Official MSDN docs: default.asp?url=/library/en-us/directx9_c/directX/htm/ idirectsoundbuffer8setpan.asp

The docs indicate that the "pan" there actually is "balance"; i.e. our code now is correct (with your patch, which I'll commit now, together with a rename from pan->balance)

comment:9 by digitall, 5 years ago

Component: Engine: SCUMM
Game: Indiana Jones 4
Note: See TracTickets for help on using tickets.