Re: [seq24-users] Midi Clock Sync patch (slave seq24 to external sequencers)
Brought to you by:
rcbuse
|
From: Kevin M. <ke...@su...> - 2009-07-01 02:33:03
|
I started looking at the code to see why it keeps running, even after
recv'ing a stop message from the rm1x.
2 things:
1.)
I think the bug is with this code in the "STOP" conditional:
m_usemidiclock = false;
this disables MIDI control. which we don't want. seq24's running loop
still runs while stopped. but it relys on the fact that there's 0 song
position increments....
commenting it out isn't enough to fix it however... I'm still tracking that
down.
But the code here is certainly not going to work, as it allows the
non-midi-controlled seq24 to run willy nilly. :-)
2.)
I don't think we should "start" the sequencer on a CLOCK tick... there's
time delay in that method.
I think that sets seq24 maybe 2 ticks behind... (there's a delay until the
seq24 actually starts incrementing the song ptr after looping around a
couple times - then actually starting....)
Also, I'm not sure why the CLOCK need to be changed to start().
was there a reason for this? or did it just seem cleaner?
here's some debugging using printf and your code:
I get a constant stream of 1's (yamaha rm1x must be spamming CLOCK even
when stopped)...
upon startup of seq24, and the rm1x. I see 1 1 1 1 1 1 1 1 1
when press start on rm1x, I get 5 6 1 3 then 1 2 1 2 1 2 ....
when I hit stop on rm1x, I get 7 8 then 1 1 1 1 1 1 1
looks like maybe we miss a tick or two here, since CLOCK calls start(false)
on the 2nd time around, after getting the start msg, and then on the 3rd
time around we actually increment the song pointer... so, does that mean
we're running 2 ticks behind?
stopped... spamming clocks 1 1 1 1 1 1
start 5 6
running 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 2
stop 7 8
stopped... spamming again... 1 1 1 1 1 1
/* start propagation if not already running*/
if (ev.get_status() == EVENT_MIDI_CLOCK)
{
printf( "1\n" );
if (m_midiclockrunning)
{
printf( "2\n" );
m_midiclocktick += 8;
}
else if (m_usemidiclock)
{
printf( "3\n" );
start(false);
m_midiclockrunning = true;
}
}
/*prapare for MIDI clock usage at song position 0*/
else if (ev.get_status() == EVENT_MIDI_START)
{
printf( "4\n" );
if (!m_midiclockrunning) {
m_usemidiclock = true;
m_midiclocktick = 0;
m_midiclockpos = 0;
}
}
/*prapare for MIDI clock usage at current song
position*/
else if (ev.get_status() == EVENT_MIDI_CONTINUE)
{
printf( "5\n" );
if (!m_midiclockrunning) {
printf( "6\n" );
m_usemidiclock = true;
}
}
/*stop MIDI clock usage*/
else if (ev.get_status() == EVENT_MIDI_STOP)
{
printf( "7\n" );
if (m_midiclockrunning)
{
printf( "8\n" );
m_midiclockrunning = false;
m_usemidiclock = false;
all_notes_off();
}
}
/*adjust position if not in MIDI clock run mode*/
else if (ev.get_status() == EVENT_MIDI_SONG_POS)
{
printf( "9\n" );
if (!m_midiclockrunning) {
printf( "10\n" );
unsigned char a, b;
ev.get_data(&a, &b);
m_midiclockpos = ((unsigned int)a << 7) | b;
}
}
---
kevin meinert | http://www.subatomicglue.com
On Tue, Jun 30, 2009 at 7:17 PM, Kevin Meinert <ke...@su...>wrote:
>
> With the latest bazaar revision...
> Stop on my yamaha rm1x no longer causes seq24 to stop... (I can't get
> seq24 to stop using the rm1x now).
>
> the back button on the rm1x rests the song pointer to the beginning (while
> sitll running)
> the play button on the rm1x does start the sequence in seq24
>
> (Same with x0xb0x. Start on x0xb0x, starts the seq24. Stop does
> nothing... Start again on x0xb0x, and the sequence resets on seq24 (but
> continues to run.
> I cannot stop seq24...)
>
>
> is there something wrong with using this code? It's updated to the newer
> ideas you've put on the list... let me know if I've missed one.
>
>
> // Obey MidiTimeClock:
> if (ev.get_status() == EVENT_MIDI_START)
> {
> if (!m_midiclockrunning)
> {
> stop();
> start( false );
> m_midiclockrunning = true;
> m_usemidiclock = true;
> m_midiclocktick = 0;
> m_midiclockpos = 0;
> }
> }
> // midi continue: start from current pos.
> else if (ev.get_status() == EVENT_MIDI_CONTINUE)
> {
> if (!m_midiclockrunning)
> {
> m_midiclockrunning = true;
> start( false );
> //m_usemidiclock = true;
> }
> }
> else if (ev.get_status() == EVENT_MIDI_STOP)
> {
> // no harm stopping again, if there's a stuck note,
> it could be useful to reissue...
> //if (m_midiclockrunning)
> //{
> // do nothing, just let the system pause
> // since we're not getting ticks after the
> stop, the song wont advance
> // when start is recieved, we'll reset the
> position, or
> // when continue is recieved, we wont
> m_midiclockrunning = false;
> all_notes_off();
> //}
> }
> else if (ev.get_status() == EVENT_MIDI_CLOCK)
> {
> if (m_midiclockrunning)
> m_midiclocktick += 8;
> }
> // not tested (todo: test it!)
> else if (ev.get_status() == EVENT_MIDI_SONG_POS)
> {
> unsigned char a, b;
> ev.get_data( &a, &b );
> m_midiclockpos = ((int)a << 7) && (int)b;
> }
>
> ---
> kevin meinert | http://www.subatomicglue.com
>
>
> On Fri, Jun 26, 2009 at 4:09 PM, Alex <x37...@gm...> wrote:
>
>> Yeah, I'll check it out soon..
>> I have a 707 which sends midi clock messages out even when the
>> sequence isn't "running"
>>
>> -Alex
>>
>> On Fri, Jun 26, 2009 at 9:29 AM, Guido Scholz<gui...@ba...>
>> wrote:
>> > Am Thu, 25. Jun 2009 um 18:37:43 -0700 schrieb Alex:
>> >
>> > Hi Alex,
>> >
>> >> > MIDI Clock:
>> >> > * if not running, start running
>> >
>> >> This is incorrect. Masters may send clock messages even if slaves
>> >> shouldn't be syncing... before a start or continue message is sent or
>> >> after a stop message is sent.
>> >
>> > Sorry, my description was too short. The current implementation does
>> > something like this:
>> >
>> > MIDI Clock:
>> > * if not running, but prepared to run by "Start" or "Continue" then
>> > start running
>> >
>> > This should comply to the text below (as far as I understand):
>> >
>> >> "A master stops the slave simultaneously by sending a MIDI Stop
>> >> message. The master may then continue to send MIDI Clocks at the rate
>> >> of its tempo, but the slave should ignore these, and not advance its
>> >> "song position". Of course, the slave may use these continuing MIDI
>> >> Clocks to ascertain what the master's tempo is at all times. "
>> >
>> >
>> >> MIDI sync in for seq24, awesome!
>> >
>> > Are you able to run tests of the current code with your hardware?
>> >
>> > Guido
>> >
>> > --
>> > http://www.bayernline.de/~gscholz/<http://www.bayernline.de/%7Egscholz/>
>> > http://www.lug-burghausen.org/
>> >
>> > -----BEGIN PGP SIGNATURE-----
>> > Version: GnuPG v1.4.6 (GNU/Linux)
>> >
>> > iD8DBQFKRPdPk6cKJms5yBsRAgx7AJ4y2V+VR/9SzTagYMWF+yr/Q9cWCwCfUlwq
>> > 3gjrKWhG9r4hDU3biWSgsKQ=
>> > =q1/X
>> > -----END PGP SIGNATURE-----
>> >
>> >
>> ------------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > seq24-users mailing list
>> > seq...@li...
>> > https://lists.sourceforge.net/lists/listinfo/seq24-users
>> >
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> seq24-users mailing list
>> seq...@li...
>> https://lists.sourceforge.net/lists/listinfo/seq24-users
>>
>
>
|