QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: warren on May 15, 2018, 11:32:58 am

Title: _SNDPLAYCOPY
Post by: warren on May 15, 2018, 11:32:58 am
Playing small wav works fine until a Beep or Sound is executed and then the volume of the wav play is drastically reduced. Anyone know what's wrong. Win7 sys and nothing is found wrong.   
Title: Re: _SNDPLAYCOPY
Post by: FellippeHeitor on May 15, 2018, 12:43:02 pm
In my experience, playing a new sound on the same channel of a previously playing sound will reduce the level of the first momentarily then after the new sound is played the volume of the first will come back to the normal value. Is that the case?
Title: Re: _SNDPLAYCOPY
Post by: warren on May 15, 2018, 01:26:11 pm
little more info:QB64 1.2, WIN7

Handle& = _SNDOPEN(PATH$ + "CLICK.WAV")
IF Handle& = 0 THEN  END

1:
_SNDPLAYCOPY Handle&, 1   
BEEP
SOUND 0,1
_DELAY 1
GOTO 1

After first wav play (64 ms long), vol = ~10% when a Beep or Sound cmd is operated. volume of wav remains low. Handle&=1.

thanks. warren.

Title: Re: _SNDPLAYCOPY
Post by: FellippeHeitor on May 15, 2018, 01:41:59 pm
That's expected behavior. All short sounds you're playing at a very short interval are all output through the same channel, which has the side effect you experience of a previous sound being lowered in level so that the new sound gets played.
Title: Re: _SNDPLAYCOPY
Post by: warren on May 15, 2018, 02:10:06 pm
Fellippe you are right!  after trying a little longer wav file the volume was much higher(still reduced some). Is this effect a condition of QB64 or my computer?  Beep and Sound cmds don't interfere with each other only sndplayer. Any idea about how to work around the feature? ... warren
Title: Re: _SNDPLAYCOPY
Post by: FellippeHeitor on May 15, 2018, 02:26:26 pm
QB64 uses an external library (https://www.openal.org/) to handle sound and as such we just pass the play command to it, to put it simply. Because of that I assume it's standard behavior.