Volume setting error

Smee

Well-Known Member
Licensed User
Longtime User
Can someone advise what is wrong with this code

B4X:
This does not work
p.SetVolume(p.VOLUME_MUSIC,p.GetMaxVolume,False)

but this does

 p.SetVolume(3,15,False)

Compiling code. Error
Error compiling program.
Error description: Cannot cast: {Type=Boolean,Rank=0} to number.
Occurred on line: 1064
p.SetVolume(p.VOLUME_MUSIC,p.GetMaxVolume,False)
Word: false
 

stevel05

Expert
Licensed User
Longtime User
GetMaxVolume requires a Channel parameter.

B4X:
p.SetVolume(p.VOLUME_MUSIC,p.GetMaxVolume(p.VOLUME_MUSIC),False)
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
GetMaxVolume requires a Channel parameter.

B4X:
p.SetVolume(p.VOLUME_MUSIC,p.GetMaxVolume(p.VOLUME_MUSIC),False)


:sign0013:
I was just about to post i realised my mistake.

Thankyou for the correction. However it does not opver-ride the device volume control (TTS). Which is what i need to do.

Is this possible? or am i missing something?

Thanks

Joe
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
thanks Steve

I had seen that but i did not really want to add another library to a fast becoming bloated project if there was another way

Joe
 
Upvote 0
Top