November 18, 2017, 11:15:44 PM

Author Topic: Setting volume?  (Read 170 times)

Offline Rooster

  • Sr. Member
  • ****
  • Posts: 309
  • I don't know what this does...
Setting volume?
« on: September 13, 2017, 01:38:29 AM »
I a bit confused on how to change sound volume.

I was trying to use SetChannelVolume, but when set to zero it makes a blip noise.
So I know that it's playing a little before the change takes effect.

The only other thing I saw in the docs was setvolume, but the documentation for it was no help.

Is there any way to set the volume before the sound is played?



Offline TomToad

  • Full Member
  • ***
  • Posts: 107
Re: Setting volume?
« Reply #1 on: September 13, 2017, 03:08:20 AM »
Code: [Select]
Local Volume:Int = 0

'Non OOP way
Local Sound:TSound = LoadSound("MyAudio.ogg")
Local Channel:TChannel = CueSound(Sound)
SetChannelVolume(Channel,Volume)
ResumeChannel(Channel)

'or the OOP way
Local Sound:TSound = TSound.Load("MyAudio.ogg",False)
Local Channel:TChannel = Sound.Cue()
Channel.SetVolume(Volume)
Channel.SetPaused(False)

------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Rooster

  • Sr. Member
  • ****
  • Posts: 309
  • I don't know what this does...
Re: Setting volume?
« Reply #2 on: September 13, 2017, 03:28:15 AM »
Many thanks Tom. :)