Hallo all around the OF-Community!
Despite I´m very new to programming it seems to me that OF allows to get into it
quite intuitively and holds many wonderfull opportunities. I´ve read through the
forum many times and made my journey through some examples trying to modify
them.
Unfortunately I´m stuck now with a certain problem and need some help. I wanted
to use the matrix of ofxGui (credits to Bilderbuchi!) to control an array of sounds,
so that if I click a matrix cell a certain sound from the array starts playing. My
project includes ofXmlSettings, ofxGui and ofxDirList. I tried to make an array of
soundfiles and load them like this:
nSounds = DIR.listDir("sounds");
sounds = new ofSoundPlayer[nSounds];
for(int i = 0; i < nSounds; i++){
sounds[i].loadSound(DIR.getPath(i));}
Now I want to pass the soundfiles to the buttons of the matrix in ofxGui. So i did
something like:
for(int i=0;i<nSounds; i++){
for(int i = 0; i < mYGrid; i++)
{
for(int j = 0; j < mXGrid; j++)
{
nSounds = kofxGui_Matrix_Set;
}
}
}
…and to get them playing I tried to type in this in ofxGuiMatrix.cpp:
testApp::handleGui(int parameterId, int task, void* data, int length){
switch(parameterId){
case matrix:
if (task == kofxGui_Set_Cell){
sounds[0].play();}
…but that (and some similar ideas) didn’t work. ?Maybe I have to declare a
gridarray first like
int gridarray[mYGrid][mxGrid] // ??
But that didn`t work either. I also tried calling:
gui->update(matrix, kofxGui_Set_Cell, &sounds, sizeof(float*));
Well, what I do here might seem quite naive. :roll: Obviously I`m reaching the
limits of “intuitive coding” at this point. I´m seriously motivated to work some
ideas out, so I just started to get deaper into C++, but the complexitiy of ofxGui
isn´t easy to understand.
I don´t know how to solve this problem. Maybe some of you have ideas and could take a minute to explain how to work this out?
Thanks in advance and greetings all around the world from Berlin!
Ron