Phone sound Question

bergapappa

Member
Licensed User
Longtime User
I want the user to change phone music volume with a seekbar.
Found this in the docs.

SetVolume (Channel As Int, VolumeIndex As Int, ShowUI As Boolean)
Sets the volume of the specified channel.
Channel - One of the VOLUME constants.
VolumeIndex - The volume index. GetMaxVolume can be used to find the largest possible value.
ShowUI - Whether to show the volume UI windows.
Example:
Dim p As Phone
p.SetVolume(p.VOLUME_MUSIC, 3, True)

But what values should I choose in the seekbar to get the right values here instead of the "3".
I mean, there has to be a span, like from 1 - 10 or something like that.
What would be the Int for MaxVolume?

TNX in advance to all you helpfull guys!
 

bergapappa

Member
Licensed User
Longtime User
Tnx, but as I see it this only gives me the max sound. Does this variable not have a integer value that always is the same? Or, do I use this to first set the max value of the seekbar?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Yes, use it to set the seek bar. This will return the Max value for the volume on that device. Chances are it won't change across devices but you never know.
 
Upvote 0

bergapappa

Member
Licensed User
Longtime User
Seems like I didn't get it :)

I do this:
First in Activity Create: barvol2.Max = p.GetMaxVolume(2) -- here I wonder what channel to use?

Then for the change of the seekbar, looks like this:
Sub barvol2_ValueChanged (Value As Int, UserChanged As Boolean)
p.SetVolume(p.VOLUME_MUSIC, Value, True)
End Sub

Can you see what I'm doing wrong?
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Seems like I didn't get it :)

I do this:
First in Activity Create: barvol2.Max = p.GetMaxVolume(2) -- here I wonder what channel to use?

Provided that you have declared p as a global variable then this should be OK, although you would get an error if you hadn't.

The channel will be the same as the channel you've used in p.SetVolume i.e. p.VOLUME_MUSIC
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
p.VOLUME_MUSIC is a variable that holds the Integer.
 
Upvote 0

bergapappa

Member
Licensed User
Longtime User
Shit man, you really tought me something there.
I was convinced it had to be a number and thought number for Volume_Music was the one I needed to put there.

TNX a lot, more than one thing cleared up around here :)

Regards

Bergapappa
 
Upvote 0

Similar Threads

Top