I'm currently working on a larger project, but I'll break down my question into a simple example
I have a 2-dimensional array of integers that stores data on what volume level to play at certain points in time.
One of the dimensions stores a time in milliseconds, and the other dimension stores the volume level.
I loop through this array, checking when each change in volume should occur.
All of that is done.
My goal is to visualize this in a horizontal timeline, similar to a channel on a sequencer like this:
I'd display the volume at each point in time. I'd also want to be able to click on the points so I could trigger some other code I have to change the value.
I know it would be too large (horizontally) for my screen, so I'd have to come up with a scroll bar and maybe some way to pre-buffer the data.
Has anyone done anything like this and have any tips?
I've been searching all over online on how to shift data out to a shiftregister from within Processing. I've read that Firmata supports it now, but can't find any examples. Has anyone here done this before and can provide any feedback?
I'm trying to nest a class within a class. The reason is I need to store a series of pieces of information (an integer, and a boolean value) multiple times within the main class. In C++ i'd use a struct, but it doesn't seem that java has the same option.
I've been getting a Null Pointer Exception error and searched all over the internet about how to handle nested classes when we need
multiple instances of the inside one , but didn't have much luck. Line 25 is where the error is occuring. I tried multiple versions, and this is just the latest one that I have after stumbling through different examples.
I may be doing this all wrong. Is there a better way I can store pairs of variables (such as a milliseconds as an integer, and a true/false value as a boolean) and easily iterate through them? I originally used 2 arrays (one for time, and one for the true/false value) but it didn't work as well as I'd like. When I look through I want to get the integer value from smallest to largest, regardless of whether it has a true or false value. I'm thinking I could also try encoding the boolean value into a single integer along with the other integer value but that seems like too much of a hack.
(On a side note, I know that I'll need to have code to expand the number of instances. I haven't researched that part yet since this part has me stumped.
Thanks
class LedChannel {
private int pin;
private boolean alreadycounted;
private int lastused;
private Timeline[] timing;
public LedChannel(int xpin) {
this.pin = xpin;
this.alreadycounted = false;
this.lastused = 0;
Timeline[] timing = new Timeline[1];
timing[0] = new Timeline();
}
public class Timeline() {
public int currtime;
public boolean ledstatus;
}
public void addvalue(int tmptime, boolean tmpstatus ) {
// The line below this errors with a NULL POINTER EXCEPTION