denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Midi-status


From: Richard Shann
Subject: Re: [Denemo-devel] Midi-status
Date: Wed, 11 Mar 2009 20:07:56 +0000

On Wed, 2009-03-11 at 11:54 -0500, Jeremiah Benham wrote:
> Richard, I am having trouble with port creation and deletion. 
Looking at your code I suggest you create a field in DenemoStaff 

gint jack_port_number

then where you call
create_jack_midi_port(numstaffs, thestaffstruct->denemo_name->str);
instead of passing in numstaffs i.e. telling jack which portnum you want
do

thestaffstruct->jack_port_number = 
create_jack_midi_port(thestaffstruct->denemo_name->str);

with create_... returning -1 for error. That is let jackmidi choose the
portnum.

Inside jackmidi.c let create_jack_midi_port look thru the output_ports
array for an empty slot & fill it and return the index.
When using output_ports[] check for NULL before use and skip to the next
one.
If searching all the MAX_OUTPUT_PORTS becomes an time issue you can keep
track of the highest in-use port with a simple static gint in jackmidi.
Richard

BTW in the current code: passing numstaffs seems wrong? it is the total
number of staffs?? Also the boolean before the call to
create_jack_midi_port() is always TRUE?


> The output ports are pointers contained in an array like this.
> jack_port_t output_ports[MAX_NUMBER_OF_PORTS];
> 
> Here is the problem:
> If I have 2 staffs but delete the first one. I delete the port in
> jackmidi which gives me a NULL output_ports[0] and a output_ports[1]
> with a pointer; Then later when trying to add a new port denemo thinks
> the newly added staff is the second staff even if ADDED BEFORE. Then
> jack ignores the request and only one port exists. Later this causes a
> crash on playback because jackmidi wants to write to output_port[0] but
> this is NULL.
> 
> My question is this:
> Can I somehow push or pop the pointers in an array moving them down by
> assigning 
> output_ports[0] = output_ports[1]; 
> 
> This would be placed in a loop so if the user deletes the staff 1 (or
> whatever) from a score that has 20 staffs in it it would be pushed to a
> lower number in the array. I am not sure how to do this exactly. Does
> this output_ports[0] = output_ports[1] just create a pointer to anouther
> pointer? 
No it puts the int stored at the address output_ports+1 into memory at
address output_ports, which is the immediately preceding sizeof(int)
bytes.

Richard


> Is there a function you know of that will do this for me?
> 
> Jeremiah
> 
> 
> 
> On Wed, 2009-03-11 at 10:02 +0000, Richard Shann wrote:
> > On Tue, 2009-03-10 at 23:21 +0100, Nils Gey wrote:
> > > Hi Jeremiah,
> > > 
> > > do you think some kind of live-midi-out via jackmidi will be ready for 
> > > the next release?
> > > 
> > > If you need any information or help I would be glad to provide you with 
> > > research etc.
> > As I recall the last email from Jeremiah on this topic was that he was
> > not convinced that it was worth doing ... is this still the case?
> > 
> > Richard
> > 
> > 
> > 
> > > 
> > > Nils
> > > 
> > > 
> > > _______________________________________________
> > > Denemo-devel mailing list
> > > address@hidden
> > > http://lists.gnu.org/mailman/listinfo/denemo-devel
> > 
> > 
> > 
> > _______________________________________________
> > Denemo-devel mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/denemo-devel
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]