Forráskód Böngészése

writing a file per preset

Willie 6 éve
szülő
commit
0b269904b8

+ 108 - 0
SPSEmulator-service/Pop.hex

@@ -0,0 +1,108 @@
+:08000000506F700000000000C9
+:080008000000000000000145AA
+:0800100051310000000000F076
+:08001800447276310000000083
+:08002000C343687231000000C7
+:0800280000CC62746E335F6EC0
+:080030006E000062746E345F83
+:080038006E6E000062746E356B
+:080040005F6E6E00003D000040
+:080048000000000000000000B0
+:080050000000000000000000A8
+:080058000000000000000000A0
+:08006000000000000000000098
+:08006800000000000000000090
+:08007000000000000000000088
+:08007800000000000000000080
+:08008000000000000000000078
+:08008800000000000000000070
+:08009000000000000000000068
+:08009800000000000000000060
+:0800A000000000000000000058
+:0800A800000000000000000050
+:0800B000000000000000000048
+:0800B800000000000000000040
+:0800C000000000000000000038
+:0800C800000000000000000030
+:0800D000000000000000000028
+:0800D800000000000000000020
+:0800E000000000000000000018
+:0800E800000000000000000010
+:0800F000000000000000000008
+:0800F800000000000000000000
+:080100000000000000000000F7
+:080108000000000000000000EF
+:080110000000000000000000E7
+:080118000000000000000000DF
+:080120000000000000000000D7
+:080128000000000000000000CF
+:080130000000000000000000C7
+:080138000000000000000000BF
+:080140000000000000000000B7
+:080148000000000000000000AF
+:080150000000000000000000A7
+:0801580000000000000000009F
+:08016000000000000000000097
+:0801680000000000000000008F
+:08017000000000000000000087
+:0801780000000000000000007F
+:08018000000000000000000077
+:0801880000000000000000006F
+:08019000000000000000000067
+:0801980000000000000000005F
+:0801A000000000000000000057
+:0801A80000000000000000004F
+:0801B000000000000000000047
+:0801B80000000000000000003F
+:0801C000000000000000000037
+:0801C80000000000000000002F
+:0801D000000000000000000027
+:0801D80000000000000000001F
+:0801E000000000000000000017
+:0801E80000000000000000000F
+:0801F000000000000000000007
+:0801F8000000000000000000FF
+:080200000000000000000000F6
+:080208000000000000000000EE
+:080210000000000000000000E6
+:080218000000000000000000DE
+:080220000000000000000000D6
+:080228000000000000000000CE
+:080230000000000000000000C6
+:080238000000000000000000BE
+:080240000000000000000000B6
+:080248000000000000000000AE
+:080250000000000000000000A6
+:0802580000000000000000009E
+:08026000000000000000000096
+:0802680000000000000000008E
+:08027000000000000000000086
+:0802780000000000000000007E
+:08028000000000000000000076
+:0802880000000000000000006E
+:08029000000000000000000066
+:0802980000000000000000005E
+:0802A000000000000000000056
+:0802A80000000000000000004E
+:0802B000000000000000000046
+:0802B80000000000000000003E
+:0802C000000000000000000036
+:0802C80000000000000000002E
+:0802D000000000000000000026
+:0802D80000000000000000001E
+:0802E000000000000000000016
+:0802E80000000000000000000E
+:0802F000000000000000000006
+:0802F8000000000000000000FE
+:080300000000000000000000F5
+:080308000000000000000000ED
+:080310000000000000000000E5
+:080318000000000000000000DD
+:080320000000000000000000D5
+:080328000000000000000000CD
+:080330000000000000000000C5
+:080338000000000000000000BD
+:080340000000000000000000B5
+:080348000000000000000000AD
+:07035000000000000000FFA7
+:00000001FF

+ 108 - 0
SPSEmulator-service/Rock.hex

@@ -0,0 +1,108 @@
+:08000000526F636B0000000069
+:08000800000000006400014546
+:0800100051300000000000C3A4
+:08001800447276300000000084
+:08002000CC43687230000000BF
+:0800280000F043687231000092
+:080030000000F0436872320089
+:08003800000000F04368723380
+:0800400000000000F01200B006
+:080048000801B00902B00B032E
+:080050000000000000000000A8
+:080058000000000000000000A0
+:08006000000000000000000098
+:08006800000000000000000090
+:08007000000000000000001474
+:08007800B1097FB10B0000008B
+:08008000000000000000000078
+:08008800000000000000000070
+:08009000000000000000000068
+:08009800000000000000000060
+:0800A000000000000000000058
+:0800A80022B1097FB10B000039
+:0800B000000000000000000048
+:0800B800000000000000000040
+:0800C000000000000000000038
+:0800C800000000000000000030
+:0800D000000000000000000028
+:0800D8000044D100000000000B
+:0800E000000000000000000018
+:0800E800000000000000000010
+:0800F000000000000000000008
+:0800F800000000000000000000
+:080100000000000000000000F7
+:08010800000054D000000000CB
+:080110000000000000000000E7
+:080118000000000000000000DF
+:080120000000000000000000D7
+:080128000000000000000000CF
+:080130000000000000000000C7
+:0801380000000077B11E7FB149
+:080140001F8000000000000018
+:080148000000000000000000AF
+:080150000000000000000000A7
+:0801580000000000000000009F
+:08016000000000000000000097
+:0801680000000000000000008F
+:08017000000000000000000087
+:0801780000000000000000007F
+:08018000000000000000000077
+:0801880000000000000000006F
+:08019000000000000000000067
+:0801980000000000000000005F
+:0801A000000000000000000057
+:0801A80000000000000000004F
+:0801B000000000000000000047
+:0801B80000000000000000003F
+:0801C000000000000000000037
+:0801C80000000000000000002F
+:0801D000000000000000000027
+:0801D80000000000000000001F
+:0801E000000000000000000017
+:0801E80000000000000000000F
+:0801F000000000000000000007
+:0801F8000000000000000000FF
+:080200000000000000000000F6
+:080208000000000000000000EE
+:080210000000000000000000E6
+:080218000000000000000000DE
+:080220000000000000000000D6
+:080228000000000000000000CE
+:080230000000000000000000C6
+:080238000000000000000000BE
+:080240000000000000000000B6
+:080248000000000000000000AE
+:080250000000000000000000A6
+:0802580000000000000000009E
+:08026000000000000000000096
+:0802680000000000000000008E
+:08027000000000000000000086
+:0802780000000000000000007E
+:08028000000000000000000076
+:0802880000000000000000006E
+:08029000000000000000000066
+:0802980000000000000000005E
+:0802A000000000000000000056
+:0802A80000000000000000004E
+:0802B000000000000000000046
+:0802B80000000000000000003E
+:0802C000000000000000000036
+:0802C80000000000000000002E
+:0802D000000000000000000026
+:0802D80000000000000000001E
+:0802E000000000000000000016
+:0802E80000000000000000000E
+:0802F000000000000000000006
+:0802F8000000000000000000FE
+:080300000000000000000000F5
+:080308000000000000000000ED
+:080310000000000000000000E5
+:080318000000000000000000DD
+:080320000000000000000000D5
+:080328000000000000000000CD
+:080330000000000000000000C5
+:080338000000000000000000BD
+:080340000000000000000000B5
+:080348000000000000000000AD
+:07035000000000000000FFA7
+:00000001FF

+ 108 - 0
SPSEmulator-service/Soul.hex

@@ -0,0 +1,108 @@
+:08000000536F756C0000000055
+:0800080000000000FF000145AB
+:0800100051320000000000CC99
+:08001800447276320000000082
+:08002000F04368723200000099
+:0800280000C362746E335F6EC9
+:080030006E000062746E345F83
+:080038006E6E000062746E356B
+:080040005F6E6E00003E00003F
+:080048000000000000000000B0
+:080050000000000000000000A8
+:080058000000000000000000A0
+:08006000000000000000000098
+:08006800000000000000000090
+:08007000000000000000000088
+:08007800000000000000000080
+:08008000000000000000000078
+:08008800000000000000000070
+:08009000000000000000000068
+:08009800000000000000000060
+:0800A000000000000000000058
+:0800A800000000000000000050
+:0800B000000000000000000048
+:0800B800000000000000000040
+:0800C000000000000000000038
+:0800C800000000000000000030
+:0800D000000000000000000028
+:0800D800000000000000000020
+:0800E000000000000000000018
+:0800E800000000000000000010
+:0800F000000000000000000008
+:0800F800000000000000000000
+:080100000000000000000000F7
+:080108000000000000000000EF
+:080110000000000000000000E7
+:080118000000000000000000DF
+:080120000000000000000000D7
+:080128000000000000000000CF
+:080130000000000000000000C7
+:080138000000000000000000BF
+:080140000000000000000000B7
+:080148000000000000000000AF
+:080150000000000000000000A7
+:0801580000000000000000009F
+:08016000000000000000000097
+:0801680000000000000000008F
+:08017000000000000000000087
+:0801780000000000000000007F
+:08018000000000000000000077
+:0801880000000000000000006F
+:08019000000000000000000067
+:0801980000000000000000005F
+:0801A000000000000000000057
+:0801A80000000000000000004F
+:0801B000000000000000000047
+:0801B80000000000000000003F
+:0801C000000000000000000037
+:0801C80000000000000000002F
+:0801D000000000000000000027
+:0801D80000000000000000001F
+:0801E000000000000000000017
+:0801E80000000000000000000F
+:0801F000000000000000000007
+:0801F8000000000000000000FF
+:080200000000000000000000F6
+:080208000000000000000000EE
+:080210000000000000000000E6
+:080218000000000000000000DE
+:080220000000000000000000D6
+:080228000000000000000000CE
+:080230000000000000000000C6
+:080238000000000000000000BE
+:080240000000000000000000B6
+:080248000000000000000000AE
+:080250000000000000000000A6
+:0802580000000000000000009E
+:08026000000000000000000096
+:0802680000000000000000008E
+:08027000000000000000000086
+:0802780000000000000000007E
+:08028000000000000000000076
+:0802880000000000000000006E
+:08029000000000000000000066
+:0802980000000000000000005E
+:0802A000000000000000000056
+:0802A80000000000000000004E
+:0802B000000000000000000046
+:0802B80000000000000000003E
+:0802C000000000000000000036
+:0802C80000000000000000002E
+:0802D000000000000000000026
+:0802D80000000000000000001E
+:0802E000000000000000000016
+:0802E80000000000000000000E
+:0802F000000000000000000006
+:0802F8000000000000000000FE
+:080300000000000000000000F5
+:080308000000000000000000ED
+:080310000000000000000000E5
+:080318000000000000000000DD
+:080320000000000000000000D5
+:080328000000000000000000CD
+:080330000000000000000000C5
+:080338000000000000000000BD
+:080340000000000000000000B5
+:080348000000000000000000AD
+:07035000000000000000FFA7
+:00000001FF

+ 11 - 37
SPSEmulator-service/src/main/java/de/mcs/tools/midicontroller/ConvertJsonData2Hex.java

@@ -37,7 +37,6 @@ import de.mcs.tools.midicontroller.data.ProgramData;
 import de.mcs.tools.midicontroller.data.Programs;
 import de.mcs.tools.midicontroller.data.SequenceData;
 import de.mcs.tools.sps.utils.IntelHex;
-import de.mcs.utils.Files;
 import de.mcs.utils.JacksonUtils;
 
 /**
@@ -58,10 +57,10 @@ public class ConvertJsonData2Hex {
     InputStream source = ClassLoader.getSystemResourceAsStream("programdata.json");
     Programs programs = JacksonUtils.getJsonMapper().readValue(source, Programs.class);
     int saveSize = 0;
-    try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
-      out.write((byte) programs.getVersion());
 
-      for (ProgramData programData : programs.getPrograms()) {
+    for (ProgramData programData : programs.getPrograms()) {
+      try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+        // out.write((byte) programs.getVersion());
         saveSize = out.size();
         System.out.println(programData.toString());
         byte[] name = copyInto(getEmptyByteArray(12), getStringAsByte(programData.getName(), 12));
@@ -80,43 +79,18 @@ public class ConvertJsonData2Hex {
 
         // end identifier
         out.write(0xFF);
-        System.out.println(String.format("actual size: %d", out.size() - saveSize));
-      }
-      out.close();
-      byte[] outBytes = out.toByteArray();
-      StringBuilder b1 = new StringBuilder();
-      StringBuilder b2 = new StringBuilder();
-      StringBuilder b3 = new StringBuilder();
-      for (int i = 0; i < outBytes.length; i++) {
-        byte myByte = outBytes[i];
-        if ((myByte & 0xFF) == 0xFF) {
-          b1.append(String.format("    ", (char) myByte));
-        } else {
-          b1.append(String.format("  %1s ", (char) myByte));
-        }
-        b2.append(String.format(" %2x,", myByte));
-        if (((i + 1) % 8) == 0) {
-          b3.append(b1.toString());
-          b3.append("\r\n");
-          b3.append(b2.toString());
-          b3.append("\r\n");
-          b1 = new StringBuilder();
-          b2 = new StringBuilder();
-        }
-      }
-      System.out.println(b3.toString());
-      File text = new File("programData.txt");
-      Files.writeStringToFile(text, b3.toString());
+        out.close();
 
-      System.out.printf("The file has %d bytes.\r\n", outBytes.length);
+        File dest = new File(String.format("%s.hex", programData.getName()));
+        System.out.printf("preset data written to file: %s\r\n", dest.getName());
+        try (BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(dest))) {
+          IntelHex intelHex = new IntelHex();
+          intelHex.writeHexStream(output, out.toByteArray());
+        }
 
-      File dest = new File("programData.hex");
-      try (BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(dest))) {
-        IntelHex intelHex = new IntelHex();
-        intelHex.writeHexStream(output, outBytes);
+        System.out.println(String.format("actual size: %d", out.size() - saveSize));
       }
     }
-
   }
 
   private static void buildSequenzes(ByteArrayOutputStream out, ProgramData programData) throws Exception, IOException {