-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HybridBuffer and use it to handle 8/16-bit conversion in LXLayere…
…dComponent.
- Loading branch information
Showing
4 changed files
with
226 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package heronarts.lx; | ||
|
||
public interface LXBuffer16 { | ||
public long[] getArray(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package heronarts.lx; | ||
|
||
import heronarts.lx.model.LXModel; | ||
|
||
public class ModelBuffer16 implements LXBuffer16 { | ||
private long[] array; | ||
|
||
public ModelBuffer16(LX lx) { | ||
initArray(lx.model); | ||
|
||
lx.addListener(new LX.Listener() { | ||
@Override | ||
public void modelChanged(LX lx, LXModel model) { | ||
initArray(model); | ||
} | ||
}); | ||
} | ||
|
||
private void initArray(LXModel model) { | ||
this.array = new long[model.size]; // initialized to 0 by Java | ||
} | ||
|
||
public long[] getArray() { | ||
return this.array; | ||
} | ||
} |