Hi Perry,

Thanks for the suggestion, I'll try that out.
In fact I realized that unfortunately killing the shred, or terminating the program is not enough to close the ports. You need to terminate ChucK.
An alternative could be that of using Std.system("chuck midi_config.ck"). At this point I could simply print the port names on the terminal.

Anyway, I'll try both and see.

Cheers,
Mario

--
electronic musician, sound artist, creative coder, QA engineer
https://vimeo.com/creativecodingsalerno http://mbuoninfante.tumblr.com https://github.com/mariobuoninfante https://bitbucket.org/mariobuoninfante

On 27 Mar 2020 16:09, "Perry R. Cook" <prc@cs.princeton.edu> wrote:
I’m not sure if they can be closed, but as long as you don’t chuck them to now, the extra ones really shouldn’t take up (much) computational resources.  

One option would be to first run a MIDIConfig.ck file that opens them all and writes all the names and numbers into a MIDICONFIG.txt file.  Then when you run your main file, it reads that and only opens the one(s) you need.  Or your first MIDIConfig.ck file could pick the one(s) you need and write only them into the temp file.

I’ve done this for PLOrk pieces, to figure out if laptops have accelerometers, and what orientation those are.

prc

from MyiPhone

On Mar 27, 2020, at 9:00 AM, chuck-users-request@lists.cs.princeton.edu wrote:

Send chuck-users mailing list submissions to
   chuck-users@lists.cs.princeton.edu

To subscribe or unsubscribe via the World Wide Web, visit
   https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
or, via email, send a message with subject or body 'help' to
   chuck-users-request@lists.cs.princeton.edu

You can reach the person managing the list at
   chuck-users-owner@lists.cs.princeton.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of chuck-users digest..."


Today's Topics:

  1. Closing MIDI ports (mario buoninfante)


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Mar 2020 19:51:41 +0000
From: mario buoninfante <mario.buoninfante@gmail.com>
To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] Closing MIDI ports
Message-ID: <dc574e2e-9f93-cb07-c743-38f88fa575e9@gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi,


Is it possible to close a MIDI port?

I'm working on a MIDI class, and to print all the available ports, I
open them one at the time and get the name. Then I end up with tons of
open MIDI ports I'm not actually using.

Apart from this, another user case could be a live set where different
scripts are launched and each of them wants to talk to a specific MIDI
port. Doing so one ends up with a lot of /leftovers/.


Cheers,

Mario

--
electronic musician, sound artist, creative coder, QA engineer
https://vimeo.com/creativecodingsalerno
http://mbuoninfante.tumblr.com/
https://github.com/mariobuoninfante
https://bitbucket.org/mariobuoninfante/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200326/75ed2599/attachment-0001.html>;

------------------------------

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


End of chuck-users Digest, Vol 175, Issue 15
********************************************