First time here? Check out the FAQ!
x

How do you create a fader labelled with a changeable list of filenames?

0 votes
311 views

This question has been alluded to here and here before. Reading the answers and comments I can't seem to get anything to work complete.

I can successfully create a fader with filenames using the "code" option in "Set tick marks & labels" like so:

('balloon.aiff' sampleFileNamesInSameFolder) collect: [:file |
    file asFilename displayTailWithoutFileExtension ].

But the problem I then have is how do I automatically set the range of the fader? I've tried using a MIDIMapper Sound as suggested here. I get two issues with that. Firstly I can't work out how to set the max size of the fader based on the number of files in the directory. I've tried this code in the Map parameter but I get an error when it runs:

| noFiles |
noFiles := ('balloon.aiff' sampleFileNamesInSameFolder) size.

!Selection is: ((`Selection min: 1 max: noFiles grid: 1) displayAs: #fader).

which just says "Error in Map".

The second problem I get, which seems to be a more general issue with the MIDIMapper, is if I edit the Map parameter none of the VCS controls change. For instance if I enter this in the Map field:

!Selection is: ((`Selection min: 1 max: 5 grid: 1) displayAs: #fader).

it will create a fader with a range from 1 to 5 the first time the Sound is run. But if I change my mind and edit the max to 6, the VCS won't change. I would have to rename the !HotValue to get a new VCS control to be created.

Is it possible to create a fader or "select from list" that shows filenames where the number of files might change?

 

asked Jul 9, 2018 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)

Please log in or register to answer this question.

...