diff options
author | Olivier Belanger <olipet@d179-241.D-FAC.UMontreal.CA> | 2006-08-15 15:21:47 (GMT) |
---|---|---|
committer | Olivier Belanger <olipet@d179-241.D-FAC.UMontreal.CA> | 2006-08-15 15:21:47 (GMT) |
commit | 0229f646361a589f0e881d4dc4eabcaed981779e (patch) | |
tree | 2d192841ccb193e2fcdd928dfc3b0cf7dd701868 /GUI | |
parent | dce0136750116020cf0ea1ec61a6f7bec615f5ac (diff) |
update slider, mixer and CSoundNote.py
Diffstat (limited to 'GUI')
-rw-r--r-- | GUI/Core/MainWindow.py | 6 | ||||
-rw-r--r-- | GUI/Core/MixerWindow.py | 34 |
2 files changed, 11 insertions, 29 deletions
diff --git a/GUI/Core/MainWindow.py b/GUI/Core/MainWindow.py index 0a5c253..2bf0633 100644 --- a/GUI/Core/MainWindow.py +++ b/GUI/Core/MainWindow.py @@ -30,6 +30,7 @@ class MainWindow( gtk.Window ): self.trackPlayer = TrackPlayer( self.getTempo, self.getBeatsPerPage, self.updatePositionIndicator, + self.mixerWindow.getVolumeFunctions(), set( range( Constants.NUMBER_OF_TRACKS ) ) ) self.setupWindow() @@ -200,8 +201,7 @@ class MainWindow( gtk.Window ): self.positionIndicator.queue_draw() def handleVolumeChanged( self, widget, data ): - gainAdjust = "csound.SetChannel('masterVolume', %f)\n" % round( self.volumeAdjustment.value, 0 ) - CSoundClient.sendText( gainAdjust ) + CSoundClient.setMasterVolume(self.getVolume()) self.updateWindowTitle() def handleTempoChanged( self, widget, data ): @@ -290,7 +290,7 @@ class MainWindow( gtk.Window ): #----------------------------------- # access functions (not sure if this is the best way to go about doing this) #----------------------------------- - def getVolume( self, widget, data ): + def getVolume( self ): return round( self.volumeAdjustment.value, 0 ) def getTempo( self ): diff --git a/GUI/Core/MixerWindow.py b/GUI/Core/MixerWindow.py index 70e9a7e..b630856 100644 --- a/GUI/Core/MixerWindow.py +++ b/GUI/Core/MixerWindow.py @@ -19,36 +19,22 @@ class MixerWindow( gtk.Window ): self.bbox = gtk.VBox(False, 2) self.add(self.bbox) - #TODO: really cheap temporary system, yes, yes I know: MAGIC NUMBERS!!! - if Constants.NUMBER_OF_TRACKS >= 1: - self.track1Adjust = self.initSlider( "track 1", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 2: - self.track2Adjust = self.initSlider("track 2", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 3: - self.track3Adjust = self.initSlider( "track 3", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 4: - self.track4Adjust = self.initSlider( "track 4", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 5: - self.track5Adjust = self.initSlider( "track 5", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 6: - self.track6Adjust = self.initSlider( "track 6", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 7: - self.track7Adjust = self.initSlider( "track 7", .8, 0, 1, 0.01, 0, 2) - if Constants.NUMBER_OF_TRACKS >= 8: - self.track8Adjust = self.initSlider( "track 8", .8, 0, 1, 0.01, 0, 2) + self.volumeFunctions = {} + for trackIndex in range(Constants.NUMBER_OF_TRACKS): + self.volumeFunctions[ trackIndex ] = self.initSlider( "track %d " % ( trackIndex+1), .8, 0, 1, 0.01, 0, 2).get_value - self.okButton = self.initButton(" close ", self.hideWindow ) +#yes, yes I know: MAGIC NUMBERS!!! - def getMixerValues( self ): - return ( self.slider1Adjust.value, - self.slider2Adjust.value ) + self.closeButton = self.initButton(" close ", self.hideWindow ) + + def getVolumeFunctions( self ): + return self.volumeFunctions def initButton(self, label, buttonFunction): button = gtk.Button(label) button.connect("clicked", buttonFunction) self.bbox.pack_start(button) -# connect to a function getMixerValues pour accessibilit/ constante def initSlider(self, label, initValue, minValue, maxValue, incStep, policy, digits): sliderAdjust = gtk.Adjustment(initValue, minValue, maxValue, incStep, incStep, 0) slider = gtk.HScale(sliderAdjust) @@ -59,7 +45,3 @@ class MixerWindow( gtk.Window ): self.bbox.pack_start(gtk.Label(label), False, False, 0) self.bbox.pack_start(slider) return sliderAdjust - -class MixerValues( MixerWindow ): - def getMixerValues( self ): - return (MixerWindow.slider1Adjust.value, MixerWindow.slider2Adjust.value) |