Added volume controls to gstreamer / system calls"
This commit is contained in:
parent
d2ad9769bd
commit
675878fb30
|
@ -20,6 +20,8 @@ vars["$prompt"] = ">>>"
|
|||
vars["$playonload"] = True
|
||||
vars["$playing"] = False
|
||||
vars["$writeenable"] = True
|
||||
vars["$volume"] = 1.0
|
||||
vars["$volumeincr"] = 0.05
|
||||
|
||||
|
||||
opts.parse()
|
||||
|
|
|
@ -12,6 +12,11 @@ from ct import times
|
|||
from ct import path
|
||||
|
||||
|
||||
def about():
|
||||
print "Ocarina Version 3.0"
|
||||
print "Written by Bryan Schumaker (bjschuma@umich.edu)"
|
||||
|
||||
|
||||
def write(s,verbose):
|
||||
if (ocarina.vars["$writeenable"]==True) and (ocarina.vars["$verbose"]>=verbose):
|
||||
print str(s)
|
||||
|
@ -85,6 +90,18 @@ def stop():
|
|||
seek(0)
|
||||
|
||||
|
||||
def volup():
|
||||
'''Increase the volume'''
|
||||
import gstreamer
|
||||
gstreamer.volup()
|
||||
|
||||
|
||||
def voldown():
|
||||
'''Decrease the volume'''
|
||||
import gstreamer
|
||||
gstreamer.voldown()
|
||||
|
||||
|
||||
def pyfile(file):
|
||||
'''If file exists, try to execute it as a python script'''
|
||||
if path.exists(file) == True:
|
||||
|
|
|
@ -9,7 +9,7 @@ __date__ ="$Feb 24, 2010 9:13:41 PM$"
|
|||
|
||||
from ct.dict import Dict
|
||||
from ct.slist import Slist
|
||||
|
||||
from ct.call import *
|
||||
|
||||
# Maintain the list of guests
|
||||
class GuestList(Slist):
|
||||
|
@ -62,8 +62,7 @@ class Event(Dict):
|
|||
for priority,guest in self[name]:
|
||||
if self[name].active == True:
|
||||
if self.type(guest)=='unicode' or self.type(guest)=='str':
|
||||
import scripting
|
||||
scripting.runScript(guest)
|
||||
pyfile(guest)
|
||||
elif args==None:
|
||||
guest()
|
||||
else:
|
||||
|
|
|
@ -4,7 +4,6 @@ __author__ = "bjschuma"
|
|||
__date__ = "$Feb 5, 2010 7:53:19 PM$"
|
||||
|
||||
from ct import path
|
||||
#from ct.message import write
|
||||
from ct.call import write
|
||||
from ct.opts import args
|
||||
import gst
|
||||
|
@ -16,11 +15,6 @@ global time
|
|||
player = gst.element_factory_make("playbin2", "player")
|
||||
time = gst.Format(gst.FORMAT_TIME)
|
||||
bus = player.get_bus()
|
||||
volume = gst.element_factory_make("volume", "vol")
|
||||
player.add(volume)
|
||||
|
||||
# Volume range goes from 0 to 1.0 (before sounding bad)
|
||||
volume.set_property("volume", 1.0)
|
||||
|
||||
|
||||
|
||||
|
@ -142,6 +136,29 @@ def seek(prcnt,fraction=False):
|
|||
return 0
|
||||
|
||||
|
||||
def setvol(volume):
|
||||
global player
|
||||
player.set_property("volume",volume)
|
||||
|
||||
|
||||
def volup():
|
||||
volume = ocarina.vars["$volume"]
|
||||
volume += ocarina.vars["$volumeincr"]
|
||||
if volume >= 1.0:
|
||||
volume = 1.0
|
||||
ocarina.vars["$volume"] = volume
|
||||
setvol(volume)
|
||||
|
||||
|
||||
def voldown():
|
||||
volume = ocarina.vars["$volume"]
|
||||
volume -= ocarina.vars["$volumeincr"]
|
||||
if volume <= 0.0:
|
||||
volume = 0.0
|
||||
ocarina.vars["$volume"] = volume
|
||||
setvol(volume)
|
||||
|
||||
|
||||
bus.add_signal_watch()
|
||||
bus.connect("message", onMessage)
|
||||
ocarina.events.invite("ocarina-stop", uninit)
|
||||
|
|
|
@ -13,7 +13,6 @@ global events
|
|||
|
||||
vars = Dict()
|
||||
events = event.Event()
|
||||
plugins = None
|
||||
|
||||
'''Attempt to read in a configuration file'''
|
||||
def config():
|
||||
|
|
Loading…
Reference in New Issue