[openbeos-midi] Re: Synth Volume Help Required

  • From: Al Elias <al@xxxxxxxxxxxxxxxxxxxxxxx>
  • To: openbeos-midi@xxxxxxxxxxxxx
  • Date: Mon, 03 Dec 2007 17:18:23 +0000

cyanh256@xxxxxxxxxxxx wrote:
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)?

At the moment, I'm working on R5 using the standard (headSpace) softSynth.
From the outset, all I want to achieve is an understanding of the midiKit API so the most obvoius starting point for me is to write a small app that can play back a smf using the softsynth.
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

I, quite literally, have an all or nothing situation with the slider: silence to speaker damage with just a small increment in the slider position. I will post some code when I'm back in BeOS-land, probably tomorrow, perhaps then you can point out where I have gone wrong :o)

Thanks for the above reply  BTW.

Al




Other related posts: