Author Topic: Setting the volume of a sound  (Read 3926 times)

0 Members and 1 Guest are viewing this topic.

Offline Cloudee1

Setting the volume of a sound
« on: January 28, 2016, 01:23:38 PM »
I have an instance of a sound, which points to an audio resource not a midi sound, in which I set the volume property

Code: [Select]
(instance dumbSound of Sound
(properties
number 0
priority 0
loop 1
vol 15; 127 is the default per sound.sc
)
)

I have also not set the value as well, but I didn't see any reason to paste both bits of code.

No matter what I try, I can't seem to alter the volume at which the sound plays, all four of these iterations play the sound at the same level.

Code: [Select]
(dumbSound play: number: 1)
(dumbSound play: number: 1 vol:15)
(dumbSound play: number: 1 setVol: 15)
(dumbSound play: number: 1 vol:15 setVol: 15)

Likewise, fade does not seem to work either. I am assuming that it is because of whatever it is that I am missing with the volume control, since I thought I saw somewhere in the code were it is really just altering the volume several times. Has anyone else noticed this or can see what it is that I am doing wrong?


Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Setting the volume of a sound
« Reply #1 on: January 28, 2016, 01:32:40 PM »
I believe there might be some comments to that effect somewhere in my SCI Quest source code :-)

From what I recall, it works fine for MIDI sounds, but not for digital audio. Which corresponds with that you're seeing.

Maybe try using the DoAudio kernel?
http://scicompanion.com/Documentation/Kernels/DoAudio.html
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Cloudee1

Re: Setting the volume of a sound
« Reply #2 on: January 28, 2016, 01:40:01 PM »
Yeah, that's a negative... all of this played it at the same level.

Code: [Select]
; (dumbSound play: number: 1 vol:15 setVol: 15)
(DoAudio audPLAY 1 audVOLUME 1)
(DoAudio audPLAY 1 audVOLUME 100)

(DoAudio audPLAY 1)
(DoAudio audVOLUME 1)

(DoAudio audPLAY 1)
(DoAudio audVOLUME 100)

Very frustrating, guess I can always dig the wav files back out of the trash and change the level there before resaving and reimporting it.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Setting the volume of a sound
« Reply #3 on: January 28, 2016, 02:00:21 PM »
Very frustrating, guess I can always dig the wav files back out of the trash and change the level there before resaving and reimporting it.

Yeah, it would have been good for Companion to include an option to increase/decrease the volume of a sound. I had to do the same thing in SCI Quest :P

btw, you can easily export as a .wav from Companion, so no need to dig around in the trash...

also btw, from ScummVM:

Code: [Select]
if (pSnd->pStreamAud) {
// we simply ignore volume changes for samples, because sierra sci also
//  doesn't support volume for samples via kDoSound
} else if (pSnd->pMidiParser) {

Another really annoying audio issue I encountered was that you can't reliably stop or mute looping MIDI sounds. If you try to and a note is being held down, it will continue to play. Luckily you can set the volume to zero for MIDI sounds ;-)
« Last Edit: January 28, 2016, 02:19:35 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Cloudee1

Re: Setting the volume of a sound
« Reply #4 on: January 28, 2016, 07:46:33 PM »
This sounds familiar, the note hanging issue, but I can't remember why.

For some reason, I am thinking that I created an empty sound resource, it just held a few rests, and when I needed to stop the music, I played it instead of stopping the other.

It may have been something to do with sciAudio... maybe not, like I said I can't remember
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: Setting the volume of a sound
« Reply #5 on: January 29, 2016, 12:35:24 AM »
The hanging note syndrome was common for external MIDI devices (MT-32) using MIDI interfaces that did not run in intelligent mode. It should not be an issue with DOSBox, though.
Brass Lantern Prop Competition

Offline troflip

Re: Setting the volume of a sound
« Reply #6 on: January 29, 2016, 03:17:55 AM »
The hanging note syndrome was common for external MIDI devices (MT-32) using MIDI interfaces that did not run in intelligent mode. It should not be an issue with DOSBox, though.

It happened with DOSBox and the adlib sound driver.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Setting the volume of a sound
« Reply #7 on: January 29, 2016, 05:59:23 PM »
Yeah, that's why I believe it's likely not the same issue.
Brass Lantern Prop Competition


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

Page created in 0.099 seconds with 23 queries.