[yoshimi] Re: (yet another) crazy idea?

  • From: Will Godfrey <willgodfrey@xxxxxxxxxxxxxxx>
  • To: yoshimi@xxxxxxxxxxxxx
  • Date: Tue, 15 Nov 2016 18:06:06 +0000

Hi hermann,

On Mon, 14 Nov 2016 00:02:41 +0100
Ichthyostega <prg@xxxxxxxxxxxxxxx> wrote:

On 09.11.2016 22:02, Will Godfrey wrote:
....and for every note-on there are a bunch of 'new' directives then value
calculations/insertions. For each note-off there is the corresponding bunch
of 'delete'. To me, This seems quite wrong.  

in such a situation, what you usually want is a pooling allocator.
The idea seems simple, but what typically makes matters difficult
is when the individual allocation is of varying, non uniform size.

When you build such a thing from scratch, there is the real danger
that what you create is buggy and performs worse than the allocator
provided by the platform (C++ / runtime library).

I quite agree!

I did have a quick thought about an alternative memory allocator, but quickly
dismissed this idea when I saw just how many bits were grabbed of all different
sizes. However, what I'm considering is quite different.

For any given part the note structure is identical apart from the incoming
pitch and velocity, and no matter what these values are the memory allocations
remain the same, so what I'm proposing is that we create a block of 'default'
notes for each active part, then at note-on we step through a simple list
looking for a spare one, then initialise it based on the incoming pitch and
velocity.

At the end of a release tail we clear the note location again, so it's
available for the next note-on. Not only does this eliminate all memory
allocations in normal play, but the clearing process can reset defaults ready
for the next note thereby evening out the processor loading to some degree.

The only time we need to delete and regenerate the note pool is when there is
a change made to the part itself, and then only when this either adds or removes
features such as changing the part effect type, not when (say) panning is
changed.

I'm not saying this will be easy, but it certainly looks promising. From
what I've understood of the code generally, I suspect many useful 'hooks' may
already be there. 

-- 
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.
Yoshimi source code is available from either: 
http://sourceforge.net/projects/yoshimi
Or: https://github.com/Yoshimi/yoshimi
Our list archive is at: https://www.freelists.org/archive/yoshimi
To post, email to yoshimi@xxxxxxxxxxxxx

Other related posts: