mirror of
https://github.com/QB64Official/qb64.git
synced 2024-09-18 20:55:09 +00:00
48 lines
No EOL
2.4 KiB
Text
48 lines
No EOL
2.4 KiB
Text
{{DISPLAYTITLE:_SNDBAL}}
|
|
The [[_SNDBAL]] statement attempts to set the balance or 3D position of a sound.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:::[[_SNDBAL]] {{Parameter|handle&}}[, {{Parameter|x!}}][, {{Parameter|y!}}][, {{Parameter|z!}}]
|
|
|
|
|
|
{{PageDescription}}
|
|
*Attempts to position a sound in 3D space, or as close to it as the underlying software libraries allow. In some cases, this will be true 3D positioning, in others, a mere volume adjustment based on distance alone.
|
|
:::*x distance values go from left(negative) to right(positive).
|
|
:::*y distance values go from below(negative) to above(positive).
|
|
:::*z distance values go from behind(negative) to in front(positive).
|
|
*Omitted x, y or z {{KW|SINGLE}} values are set to 0.
|
|
*By setting the x value to -1 or 1 it plays the sound at full volume from the appropriate speaker.
|
|
*Sounds at a distance of 1 or -1 are played at full volume. Sounds further than a distance of 1000 cannot be heard.
|
|
*The volume decreases linearly (at a constant gradient) over distance. Half volume = 500.
|
|
* Opened sound files must have the "VOL" capability to use this statement.
|
|
* The sound file should have the "SYNC" capability when more than one sound is being used at the same time!
|
|
* An "'''ILLEGAL FUNCTION CALL'''" error can occur if another sound is using the primary or same channel position.
|
|
{{TextStart}} QB64 supports the following sound file formats ('''Bold is a guaranteed capability'''):
|
|
|
|
WAV = "'''VOL,SYNC,LEN''',PAUSE" [http://www.rarewares.org/ogg-oggdropxpd.php Free WAV to OGG GUI converter]
|
|
OGG = "VOL,SYNC,LEN,PAUSE" [http://www.rarewares.org/ogg-oggenc.php Free WAV to OGG converter]
|
|
AIF = "VOL,SYNC,LEN,PAUSE"
|
|
RIF = "VOL,SYNC,LEN,PAUSE"
|
|
VOC = "VOL,SYNC,LEN,PAUSE"
|
|
MID = "'''VOL'''"
|
|
MOD = "VOL,PAUSE"
|
|
MP3 = "'''VOL''',PAUSE,SETPOS" [http://www.freemp3wmaconverter.com/index.html Free WMA, MP3 and OGG converter]
|
|
|
|
''Note:'' {{Cb|_SNDBAL}} only affects MP3 volume. Sound will reside in main channel.
|
|
{{TextEnd}}
|
|
|
|
|
|
{{PageExamples}}
|
|
{{CodeStart}} '' ''
|
|
h& = {{Cl|_SNDOPEN}}("LOL.wav", "SYNC,VOL")
|
|
{{Cl|_SNDBAL}} h&, 1
|
|
{{Cl|_SNDPLAY}} h& '' ''
|
|
{{CodeEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
*{{KW|_SNDOPEN}}, {{KW|_SNDVOL}}, {{KW|_SNDLIMIT}}
|
|
|
|
|
|
{{PageNavigation}} |