Actually i am trying browse some directory, display list of files and load it.
I can do all these things if i use system with mouse. But i want to do same with percussa device with encoders.
So, which is the best way to display list of files, scroll/highlight, load that files.
I search many things for it like use Listbox to add such parametrs.
So should i use “FileListComponent” class, or “DirectoryContentsList” class for this or take a Listbox will be better.
I’d assume you can use things like selectRow() to move around the listbox (etc), this has the option to scroll the listbox iirc.
my approach, so far, has been to just use the graphics primitives, and create my own SSP Components… so, if i needed a list box, id create a specific SSP listbox.
( idea is eventually, id have collection of SSP controls that i can use on different vsts)
but it’ll be interesting to see how using the Juce versions look n’ feel on the SSP. iirc, the Juce versions are pretty flexible so should be able to look pretty good - and for sure, it’d be faster to use these than creating your own SSP versions
In the example QVCA plugin code you can can find the setParameter() function which is called each time you turn one of the encoders. The switch in this function handles the different encoder events, Percussa::sspEnc1… so you can add code to that switch statement to handle the encoder events. The newValue argument of setParameter() contains a positive/negative value depending on the direction of turning. So what you can do is use these events to increase/decrease a variable which can then determine the current selection in the Listbox in your PluginEditor. The Listbox class and derived classes in Juce have methods to scroll to a certain location.
I looked at FileChooser in the juce docs, and this creates a popup dialog box for selecting files I think, on top of your PluginEditor window. This might not be a good choice because it doesn’t seem to have methods to manipulate the selection of files and it’s probably written with mouse or keyboard interaction in mind. What I actually do on the SSP, in modules like the Granular, is create a listbox in my editor window class, scan files myself, add the filenames/paths to the listbox, and let the user choose files from the listbox, and then load files after the user selects the file and pushes the encoder.
Keep in mind that setParameter() might be called from the audio thread. So you need a way to notify the GUI about the encoder change. You cannot call functions in the GUI from setParameter directly or you risk blocking the audio thread which results in cracks and pops. One simple way to solve this problem is to derive PluginEditor also from Timer and then implement the timerCallback() function to read your encoder variables, and then update the selection from that function. For example use a timer interval of 30ms. This is fast enough for GUI updates and works if your variables can be read atomically, like if you use a float or int. You can also use lock-free techniques to pass data between the threads instead of using this timer trick. Have a look in the juce forum, best to post any general juce-specific questions in their forum and post specific SSP SDK questions here.