Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Nov 23, 2017 2:41 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: getting and setting master Volume on Linux systems
PostPosted: Mon Jul 16, 2012 11:56 am 
Offline
User avatar

Joined: Wed Oct 06, 2010 10:25 am
Posts: 154
Location: ---
Does anyone has found a solution on retrive master volume value and
to set It in Linux Environment ?
Thanks,
Max

ps: I'm using Centos 5.5 with kde2 and Alsa drivers

_________________
Massimiliano Fabbri
Freelance Senior Programmer
(Eudosia Systems)
Visual Basic 6 - RealStudio - Mobile Development
Php5/Mysql - Dot Net C# - Objective C
-------------------------------------------
http://www.eudosia-systems.it


Top
 Profile  
Reply with quote  
 Post subject: [solved] getting and setting master Volume on Linux systems
PostPosted: Wed Jul 25, 2012 9:28 am 
Offline
User avatar

Joined: Wed Oct 06, 2010 10:25 am
Posts: 154
Location: ---
Only the proof of concept for anyone is interested in

Function setmasterVolume(inVol as Integer) As Boolean
Dim s as New Shell

s.Mode=0
s.execute "amixer set Master " + str(inVol) + "%"


If s.errorCode<>0 then
MsgBox "Error Code: "+Str(s.errorCode)
return false
else

return true

end if

End Function

Function getMasterVolume() As string
Dim s as New Shell

s.Mode=0
s.execute "amixer get Master,0"


If s.errorCode<>0 then
MsgBox "Error Code: "+Str(s.errorCode)
Return "error"
else
Dim tArray() as String

tArray() = split(s.Result,":")

if tArray.Ubound >=0 then
Return regexsearch(tarray(5))
else
Return s.Result
end if

end if

End Function

Function RegExSearch(strToSearch as String) As String
Dim rg as New RegEx
Dim myMatch as RegExMatch


rg.SearchPattern="\[?[0-9]+\.?\d*"

myMatch=rg.search(strToSearch)

if myMatch <> Nil then
Return myMatch.SubExpressionString(0)
else
Return ""
End if

exception err as RegExException
MsgBox err.message
End Function

_________________
Massimiliano Fabbri
Freelance Senior Programmer
(Eudosia Systems)
Visual Basic 6 - RealStudio - Mobile Development
Php5/Mysql - Dot Net C# - Objective C
-------------------------------------------
http://www.eudosia-systems.it


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group