|
From: <le...@gr...> - 2005-06-16 09:48:23
|
Le 16 juin 05 =E0 09:58, Axe...@St... a =E9crit =
:
> Hi,
>
> I'm trying to do some stuff with MidiShare and have some questions:
>
> Is there a fast/short way to copy a sequence? Something like:
>
> MidiSeqPtr seq1 =3D MidiNewSeq();
> ... fill it with events ...
> MidiSeqPtr seq2 =3D MidiNewSeq();
> (*seq2).first =3D MidiCopyEv((*seq1).first);
> (*seq2).last =3D MidiCopyEv((*seq1).last);
>
> This doesn't seem to work. I'm loading seq2 into the Player, play =20
> it, stop it.
> Then I load seq1 into the Player. This fails.
> What's wrong? How to do a correct real sequence copy (not just =20
> pointer copy)?
> Do I have to do something with the undef1/2 pointers? What are they =20=
> for?
You can use the following function :
MidiSeqPtr CopySeq(MidiSeqPtr src)
{
MidiEvPtr e =3D FirstEv(src);
MidiSeqPtr copy =3D MidiNewSeq();
while (copy && e){
MidiAddSeq(copy,MidiCopyEv(e));
e =3D Link(e);
}
return copy;
}
Note that the this version assume that they are enough MidiShare =20
events to copy the entire sequence : the MidiCopyEv(e) result is not =20=
checked for possible null value, you can improve it if you need to.
>
> An other question:
> Is there something wrong with the Player's time signature settings? =20=
> A music
> peace in 6/8 time signature is said to be in 6/3. And instead of a =20
> 4/4 time
> signature the PlayerState variables say 4/2.
>
Denominators of the time signature are coded in log2 base.
thus 4 is coded 2, thus 8 is coded 3...
See http://www.borg.com/~jglatt/tech/midifile/time.htm or http://=20
www.omega-art.com/midi/mfiles.html
Regards
Stephane=20=
|