[Gambas-user] Gambas + Midi + ALSA + file descriptors

Benoît Minisini gambas at ...1...
Tue Sep 27 17:47:29 CEST 2011


> Hello Benoît,
> 
> I'ld like to recapitulate...
> 
> 
> AIM:
> 
> *Receiving* Midi data FROM ALSA (rectius: FROM ALSA functions).
> 
> 
> STRATEGY:
> 
> Putting the FD - *passed by ALSA* - under "observation" for Read by using a
> mechanism like:  hfile = OPEN...For....WATCH. Normally the gambas-program
> sleeps, but when data come to that FD, and so it begins "ready", we'll
> have not to read data from FD (not from hfile !); the mechanism
> OPEN...etc... must awake the program and ''raise'' a gambas-event, as
> File_Read(). So, we'll read the right ad useful Midi data **FROM ALSA** by
> the special function: snd_seq_event_input(......).
> 
> > Is there a way for me to emulate a midi input so that I can
> > actually run your project?
> 
> Yes, you can use "aplaymidi" program.
> After run "aplaymidi", remember to allow the connection of my source TO
> aplaymidi, by writing the Id client number in special ALSA function:
> 
> err = snd_seq_connect_to(handle, outport, -->HERE<--, dport)
> 
> that you can find it in CAlsa.class of my source.
> 
> 
> ....But if you run my program, on its form you can send a midi data by
> pressing on the button "note".
> 
> 
> I send you attached "aseqdump" Alsa program, purposely modified for
> verifing the FD thata it uses. You can compare the FD, used by it, with FD
> shown by lsof -p PID_of_program command, or strace -p PID command.
> 
> So, equally, you can compare the fd of my source. This fd is used by my
> program and passed by ALSA function to OPEN... etc line.
> 
> Regards
> Paolo
> 

So we agree that you must watch the descriptor for reading (For Read Watch), 
not for writing (For Write Watch)?

I will look at that as soon as I have time.

Regards,

-- 
Benoît Minisini




More information about the User mailing list