volume

Just starting out? Need help? Post your questions and find answers here.
mycure
New User
New User
Posts: 1
Joined: Tue Sep 23, 2003 9:31 pm
Location: Paris

volume

Post by mycure »

Any way to control the volume via MCI api?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: volume

Post by PB »

I don't know of any MCI method, but this does what you want:

viewtopic.php?t=5762
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post by Tomio »

Perhaps this is what you look for. It's a snippet from a program of mine:

;Volx = new VolumeValue


; read current (left+right) volume values:
waveOutGetVolume_(0, @Volumes.l)
VolL = Volumes & HFFFF : VolR = (Volumes >>16) & HFFFF

;write new values:
t1.f = (HFFFF/100)*Volx -0.5
VolL=t1: VolR=VolL: ii.l=VolR<<16 + VolL

waveoutSetVolume_(0, ii)

../tomio
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Hi,

I remember I have posted a question concerning MIDI and GPI gave me
a link to a very powerfull MCI pack including volume, etc... :

viewtopic.php?t=7394&highlight=

Enjoy.
Beware of the man who has the solution before he understands the problem...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Volx = new VolumeValue

What is the range for Volx? 0 to ?

(I tried up to 65535 but still had no sound).
Tomio
Enthusiast
Enthusiast
Posts: 291
Joined: Sun Apr 27, 2003 4:54 pm
Location: Germany

Post by Tomio »

PB wrote:> Volx = new VolumeValue

What is the range for Volx? 0 to ?

(I tried up to 65535 but still had no sound).
Volx = 0 - 100 , because that's the range of waveOutGetVolume.
And, of course, the soundChannel has to be open already, like that:

uu.l=mciSendString_("open "+ft$+" type waveaudio alias "+snda$,0,0,0)
If uu.l <> 0
mciGetErrorString_(uu.l,*sndbuf,sbl)
gosub err_
Return
EndIf
uu.l=mciSendString_("play "+snda$,0,0,0) ;no need to start "play"
If uu.l <> 0
mciGetErrorString_(uu.l,*sndbuf,sbl):
gosub err_
Return
EndIf



HFFFF.l=$FFFF

As already mentioned, these are snippets of a program.
But I use to manipulate the volume this way since long with success.

../tomio
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Look in the Includepack2 of japbe in the file "volumeMute.pbi"

GPI
Post Reply