[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [iiwusynth-devel] API function to change voice parameters atplay ti
From: |
M. Nentwig |
Subject: |
Re: [iiwusynth-devel] API function to change voice parameters atplay time |
Date: |
Mon, 13 May 2002 08:42:50 +0300 |
> -----Original Message-----
> From: ext Josh Green [mailto:address@hidden
> Sent: 13 May 2002 07:51
> To: M. Nentwig
> Cc: Peter Hanappe; iiwusynth devel; Swami Devel
> Subject: Re: [iiwusynth-devel] API function to change voice parameters
> atplay time
>
>
> On Sun, 2002-05-12 at 12:38, M. Nentwig wrote:
> > > Since Swami uses the sfloader all generators/modulators
> will be loaded
> >
> > > at note-on time. It appears from the current version of
> > > iiwusynth that I
> > > have that there isn't a way to load modulators yet via the
> > > sfloader API.
> >
> > I'm not too deep into the sfloader stuff yet, but I thought
> that Swami
> > simply replaces the functionality in iiwu_defsfont.c?
> > In this case, it can add modulators with
> > iiwu_voice_add_mod(voice, mod, IIWU_VOICE_ADD);
> >
>
> Found that routine. It just needs to be declared in
> iiwusynth.h instead
> of iiwu_voice.h.
>
> > Changing -modulators- of an already running voice doesn't look too
> > attractive to me (in terms of 'headache per usefulness').
> Generators,
> > yes.
> >
>
> Yeah, I really don't see any reason to change modulators of an already
> running voice.
Just thought I'd mention it - headache prevention :-)
>
> >
> > I see a way:
> > Again, in iiwu_defsfont.c, a new voice is created with
> > voice = iiwu_synth_alloc_voice(synth, sample,
> chan, key, vel);
> >
> > At this time, the unique ID of the voice is set. So you can
> store the
> > voice and its unique ID.
> > When referring to it later, use 'voice', and check, if the
> ID is still
> > the same (and it is not off).
> >
>
> So the voice will never be de-allocated (possibility of
> invalid pointer
> reference)? I guess that makes sense since it is desirable to
> stay away
> from malloc/free with real time apps.
Yes, there is a pool of voices, that get reassigned.
>
> > > I see that there is already a routine called
> 'iiwu_voice_gen_incr' and
> >
> > > the *_set routine of course. These aren't real time
> though, but the
> > > routines would look the same at least from the callers
> perspective.
> >
> > iiwu_voice_gen_incr should in fact do the job. The only drawback is,
> > that the caller has to remember the amount, that it has
> already added to
> > the generator.
> >
>
> Would iiwu_voice_gen_set also work then? That might be even
> better. Are
> there any consequences to be had by changing a generator in the middle
> of the synthesis thread processing a buffer?
The synthesis engine won't (shouldn't) mind, if you change generators
during voice operation. If a generator has changed, you have to call:
void
iiwu_voice_update_param(iiwu_voice_t* voice, int gen)
{
/* Purpose:
*
* The value of a generator (gen) has changed. (The different
* generators are listed in iiwusynth.h, or in SF2.01 page 48-49)
* Now the dependent 'voice' parameters are calculated.
*
* iiwu_voice_update_param can be called during the setup of the
* voice (to calculate the initial value for a voice parameter), or
* during its operation (a generator has been changed due to
* real-time parameter modifications like pitch-bend).
*
* Note: The generator holds two values: The base value .val and an
* offset caused by modulators .mod. _GEN(voice,
* generator_enumerator) returns the sum of both.*/
...
and the voice parameters are recalculated.
This should then probably also go into the API...
>
> > >
> > > Do you think that a real time generator control API could
> be created
> > > with relatively little effort? :)
> >
> > I think so. Maybe we don't need any additional functions.
> >
>
> Way cool. I'll hack around a bit and see what happens :)
>
> >
> > Try
> > http://prdownloads.sourceforge.net/millisampler/iiwu_17_tar.bz2
> > I was unable to test it (no MIDI interface at hand to start
> the synth).
> > Anyway, at the moment pitch wheel sensitivity can only be accessed
> > through the API function (no MIDI response, no command line
> equivalent).
> >
>
> I'll get to it when it comes down via CVS, i.e. too lazy.
>
> >
> > > Keep up the excellent work! Cheers.
> > > Josh Green
> >
> > You too!
> > Cheers
> >
> > Markus
> >
>
> Lates.
> Josh Green
>
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [iiwusynth-devel] API function to change voice parameters atplay time,
M. Nentwig <=