[gmpi] Re: Reqs TODO

  • From: Tim Hockin <thockin@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Sat, 15 Nov 2003 11:36:03 -0800

On Sun, Nov 16, 2003 at 09:12:39AM +1300, Jeff McClintock wrote:
> > Personally I find offsets easier for a plugin too. There are some plugin
> > types that benefit from absolutes, but in my opinion the majority does not
> > and would benefit from offsets more.
> 
> Yes, I guess it depends on what you are used to, offsets would work, but I'm
> still uncomfortable with having 64bit timestamps in the host and 32bit
> timestamp in the plugin...

That is a valid point

> I've been looking at some of my code, and I now see that any plugin that
> deals with 'future' events..a Sequencer/Arpegiator, or MIDI-Delay needs
> absolute timestamps, also my synths use absolute timestamps for
> note-priority and voice-stealing determination (you need to record each
> note's note-on time in order to determine the best voice to steal later).

Neither way prevents this.

> So if we use 64bit timestamps in the host and 32bit-relative timestamps in
> the plugin, we're going to have to also support plugins that require 64bit
> timestamps, so we're going to need conversion routines, which will no doubt
> have to perform many small memory allocations ( to convert from a smaller
> event structure to a larger 64 bit one).

64 bit int is a primitive, in almost every environment, now.  Stack
allocations are practically free, and static allocations ARE free.

As I said - I have no preference.  I think it matters how you code the
plugin.

32 bit offsets + 64 bit absolute of sample 0:
---------------------------------------------
        int32_t i;
        for i = 0 to nsamples //32 bit compare, add
                is there an event for i? //32 bit compare
                        handle it
                        maybe store 64 bit start_time + i //64 bit add
                do stuff
        endfor

Mostly 32 bit operations, only 64 bits when you need to convert to absolute


64 bit absolutes + 64 bit absolute of sample 0:
---------------------------------------------
        int64_t i;
        for i = start_time to start_time + nsamples //64 bit compare, add
                is there an event for i?  // 64 bit compare
                        handle it
                        maybe store i
                do_stuff
        endfor

Mostly 64 bit operations.

Reality is that 64 bit operations hurt on 32 bit platforms.

I think I am suddenly leaning towards 32 bit offsets except that all of this
probably doesn't even register against DSP costs.

SO the question is, which inner loop is more confortable and would run
fastest?  Maybe this warrants a real benchmark??


----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: