First time here? Check out the FAQ!

Is it possible to create VCS label lists via smalltalk?

+2 votes
Is it possible to create "Tick Lables" via SmallTalk code? For example I would like to create  a list of tick marks  from an collection of filenames in an directory  or a list of markers in a sample file for example?

All the best

asked Oct 15, 2015 in Capytalk & Smalltalk by christian-schloesser (Adept) (2,890 points)
edited Oct 15, 2015 by christian-schloesser

1 Answer

+2 votes
Unlock the VCS and double click the widget to edit it.

From the Options menu of the Virtual Control Surface Editor select Set tic marks and labels.

Where it says "Select a labeling scheme" select "Code".

Click Edit for a window shere you can enter a Smalltalk expression that evaluates to an OrderedCollection of strings.  The default example is

0 to: 4 collect: [:n | 'label' & n]
answered Oct 15, 2015 by ssc (Savant) (121,920 points)

Thank you SSC for your quick answer!
I use the "code" labelling scheme option a lot for creating custom Tick Marks & Labels.

But i never could figured out how to get a list from a file directory in the VCS until i tried to come up with an example today to demonstrate my problem... but Eureka! Now it works!

It seams that that my OrderedCollections did not had the exact size as i set the Max value (Min/Max/Grid) ) before entering the code!

The only problem is now that have to know the amount of files and set the size of "Max" Value before i enter the VCS Editor options, otherwise the code is not accepted (and it does not give an error like 'not in range' for exampe...)

Is it possible to set the Value of (Min/Max/Grid) of an element in the VCS also by code? (maybe by sending a message to the !HotValue?)

Some !HotValues seam to have "default ranges". So i thought maybe there is a message i could send to a !HotValue to set the Max value without entering it in the VCS Editor?

Thanks for all your help!

P.S: For those who are interessted in labeling VCS elements by code here is a short example to get a list of samplesFile names:

In the VCS Editor put your code into the 'Tick marks & Labels' "code labelling scheme" :

| oneSourceFile sourceFileNames |

oneSourceFile := 'YOUR FILE PATH:YOUR FILENAME.WAV' asSamplesFile.

sourceFileNames := oneSourceFile fileName fileNamesOfSameTypeInSameFolder.
sourceFileNames:= sourceFileNames collect: [:sFile | (Filename named: sFile) tail].

Thanks for the code snippet Chris. Nice to see it again ;)  I agree, we need to be able to pass a variable such as the Size of a filename collection, or a collection of filename strings, in order to dynamically build labelled faders for any folder of files, like the Autolabel feature in the Multisample, or InterpolatePresets.
Alternatively in the code, you could use displayTailWithoutFileExtension to make the display name even neater. If you encounter syntax errors, you might need to cast the String as a filename to manipulate it with displayTail or file manipulation messages which can only be sent to Filename types.

For example:

| filenames |

filenames :=  ('01 In (2015 Remaster) - Cristian Vogel.wav' fileNamesOfSameTypeInSameFolder).

(filenames at: 1) asFilename displayTailWithoutFileExtension

..would give you

 '01 In (2015 Remaster) - Cristian Vogel'
For some reason I couldn't find the "ask a related question" link earlier. Oops. Anyway, I've asked a related question here (