Page 371 -
P. 371

add a slider


           Pump up the volume!


           To make the program more useful, the DJ wants to be able to dynamically
           and interactively control the volume of the track as it plays. Basically, as the   Louder!
           track plays, the DJ wants to fiddle with the volume.














                                                                                              Softer, softer,
                                                                                               softer...












           In the physical world, most devices
           that have a volume control provide
           either a large, circular knob or
           a slider on a scale:








                                         The control might look like this,             ...or the control
                                         a slider that can be moved from
                                                                                       might look like this.
                                         left (down) to right (up)...                  Turn it up to the
                                                                                       right, down to the
                                                                                       left..
           Because a slider is much easier to manipulate with a click and drag of a
           mouse than a knob, the slider on a scale is used in lots of modern GUIs. It’s the
           classic choice for showing a volume control.


           Look closely at the slider. What do you need to model?

           336    Chapter 9
   366   367   368   369   370   371   372   373   374   375   376