[openbeos-midi] Re: Synth Volume Help Required

  • From: cyanh256@xxxxxxxxxxxx
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Sun, 02 Dec 2007 20:11:47 GMT

> I'm looking for any tutorials/source code examples which deal with 
> controlling the onboard Synth volume from a BSlider. I'm having a few 
> problems. I have started to tinker with the midi kit so anything 
> suitable for a noob would do! :o)

By "onboard synth" do you mean the software synthesizer,
or the synthesizer on your soundcard (if any)?

The master volume of most MIDI devices can be controlled
using a SysEx message -- f0 7f 7f 04 01 LSB MSB f7
where LSB is the "fine" part of the setting, and MSB is
the "coarse" part, 0-127 each. I'm not sure if FluidSynth
responds to this -- it has more bugs than features -- but
give it a try anyway.

If you want to change the volume of an on-board synth
(on a soundcard), that can also be done via the soundcard's
mixer. I'm not sure if there's any standardized way in Haiku
for manipulating that though...


The slider part is pretty easy -- the member function
SetValue(int32 val) in your BSlider gets called every time the
slider's value changes. Assuming you've created a derived
class that defines this function, you can do the necessary
stuff inside SetValue(). The function is called continuously
while you drag the slider, so it updates in real-time.
For instance:

class SLIDER : public BSlider {
    public:
    void SetValue(int32 value) {
        BSlider :: SetValue(value);
        /* Send the SysEx message or whatever here */
    }
}

- Cyan

Other related posts: