[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-dev] MIDIOut on Linux (stefan?)
nescivi <nescivi@xxxxxxxxx> writes:
> m> I've been trying to get MIDIOut working reliably on Linux
> m> several times, and never really succeeded without a manual
> m> call to "acoonect". AM I really that stupid, or
> m> is something broken in the ALSA seq code in SCLang?
>
> m> SPecifically, I can not seem to connect a MIDIOut to
> m> a specific MIDIClient.destination. I get no error,
> m> but if I send MIDI events, they never reach that specified destination.
> m> They only do if I manually call "aconnect" to connect
> m> the two ports.
> m> Which is kind of problematic, since aconnect required
> m> PortIDs as arguments, which can change, so it is
> m> sometimes not reliable to write code that can make
> m> MIDIOut connections unattended...
>
> m> Stefan, can you clarify this? DO you know of this problem?
> m> Or am I just missing something?
>
> This seems to be how it is. At least, that is the way I used it in my
> patches that use MIDI (from a bit more than a year ago).
> It would be nice if this could be made different somehow.
>
In particular, I am refering to this function in SC_AlsaMIDI.cpp:
int SC_AlsaMidiClient::sendEvent(int outputIndex, int uid, snd_seq_event_t* evt, float late)
{
snd_seq_real_time time;
if ((outputIndex < 0) || (outputIndex >= mNumOutPorts)) return errIndexOutOfRange;
snd_seq_ev_set_source(evt, mOutPorts[outputIndex]);
if (uid == 0) {
// send to all subscribed ports
snd_seq_ev_set_subs(evt);
} else {
// send to specific port
int cid, pid;
SC_AlsaParseUID(uid, cid, pid);
snd_seq_ev_set_dest(evt, cid, pid);
}
if (late > 0.f) {
time.tv_sec = (unsigned)(late * 1.0e-6f);
time.tv_nsec = (unsigned)(late * 1.0e3f);
} else {
time.tv_sec = time.tv_nsec = 0;
}
snd_seq_ev_schedule_real(evt, mQueue, 1, &time);
snd_seq_event_output_direct(mHandle, evt);
return errNone;
}
Which definitely indicates to me that the uid was once supposed
to work.
--
CYa,
Mario