Hotfix for reading song data for FT.
This commit is contained in:
parent
a1c5618b12
commit
ade1efb5b5
BIN
image.png
BIN
image.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
@ -240,27 +240,52 @@ public class Controller {
|
||||
float lowestMatching = Integer.MAX_VALUE;
|
||||
SongData matchingSong = null;
|
||||
//There are 2304 pixels total. Once 2188 match, we'll call it good.
|
||||
for (SongData song : DemoApplication.songs) {
|
||||
float matching = 0;
|
||||
for (int y=0;y<288;y++) {
|
||||
for (int x=0;x<8;x++) {
|
||||
Color p2 = song.data[(y*8)+x];
|
||||
Color p1 = new Color(img.getRGB(x+352, y+288));
|
||||
matching+=ImageUtils.distanceToColor(p2,p1);
|
||||
if (MyRobot.FUTURETONE) {
|
||||
for (SongData song : DemoApplication.songs) {
|
||||
float matching = 0;
|
||||
for (int y=0;y<288;y++) {
|
||||
for (int x=0;x<8;x++) {
|
||||
Color p2 = song.data[(y*8)+x];
|
||||
Color p1 = new Color(img.getRGB(x+352, y+288));
|
||||
matching+=ImageUtils.distanceToColor(p2,p1);
|
||||
}
|
||||
}
|
||||
if (matching<lowestMatching) {
|
||||
lowestMatching=matching;
|
||||
matchingSong = song;
|
||||
}
|
||||
}
|
||||
if (matching<lowestMatching) {
|
||||
lowestMatching=matching;
|
||||
matchingSong = song;
|
||||
}
|
||||
|
||||
/*try {
|
||||
PrintStream out = new PrintStream(System.out, true, "UTF-8");
|
||||
out.println("Comparing to "+song.song+": "+matching);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
/*try {
|
||||
PrintStream out = new PrintStream(System.out, true, "UTF-8");
|
||||
out.println("Comparing to "+song.song+": "+matching);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
}
|
||||
} else {
|
||||
for (SongData song : DemoApplication.FTsongs) {
|
||||
float matching = 0;
|
||||
for (int y=0;y<288;y++) {
|
||||
for (int x=0;x<8;x++) {
|
||||
Color p2 = song.data[(y*8)+x];
|
||||
Color p1 = new Color(img.getRGB(x+352, y+288));
|
||||
matching+=ImageUtils.distanceToColor(p2,p1);
|
||||
}
|
||||
}
|
||||
if (matching<lowestMatching) {
|
||||
lowestMatching=matching;
|
||||
matchingSong = song;
|
||||
}
|
||||
|
||||
/*try {
|
||||
PrintStream out = new PrintStream(System.out, true, "UTF-8");
|
||||
out.println("Comparing to "+song.song+": "+matching);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
//System.out.println("Lowest: "+lowestMatching);
|
||||
return matchingSong.song;
|
||||
|
Loading…
x
Reference in New Issue
Block a user