[chuck-users] code reusability

Daniel Trueman dtrueman at Princeton.EDU
Fri Jun 11 10:00:57 EDT 2010


i believe in the next release you'll be able to open MIDI/Hid devices by name...

On Jun 11, 2010, at 9:32 AM, Thomas Girod wrote:

> Okay, that's pretty much what I did. Trying all the devices until I find
> the one with the proper name is a good idea, thanks !
> 
> Tom
> 
> On Fri, Jun 11, 2010 at 02:08:38PM +0200, Kassen wrote:
>> Hi Thomas!
>> 
>> What I use for this kind of case (my Akai LPD8, for example) is a class with
>> it's own sporked listener shred.
>> 
>> At instantiation it could try to open all MIDI devices in turn, until the name
>> of the device is whatever the name of your controller is. from there on you can
>> add members and member functions that reflect whatever you want to do with the
>> device, including a public event that other shreds could wait for. In the case
>> of controllers with leds you'd probably also have member-functions that your
>> code could use to set these, with your class handling the MIDI.
>> 
>> If you build something like that once it will save you a lot of time in the
>> long run and only having to do MIDI (with all of its magic numbers) once should
>> make your coding a lot more pleasant. The class could sit in its own file (if
>> you make it public), or you could simply copy and paste it to the bottom of
>> your current project.
>> 
>> Hope that helps?
>> Kas.
> 
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list