diff --git a/pom.xml b/pom.xml
index f83c06a..244e87d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
sh.ball
osci-render
- 1.16.1
+ 1.16.2
osci-render
diff --git a/src/main/java/sh/ball/audio/ShapeAudioPlayer.java b/src/main/java/sh/ball/audio/ShapeAudioPlayer.java
index 3f41e41..24259c1 100644
--- a/src/main/java/sh/ball/audio/ShapeAudioPlayer.java
+++ b/src/main/java/sh/ball/audio/ShapeAudioPlayer.java
@@ -112,11 +112,17 @@ public class ShapeAudioPlayer implements AudioPlayer> {
count = 0;
}
- if (shapeDrawn > length) {
- // We do -= length here rather than resetting to 0 since it is correct
- // to skip a small bit of the next shape, in line with the length increment
+ // Need to skip all shapes that the lengthIncrement draws over.
+ // This is especially an issue when there are lots of small lines being
+ // drawn.
+ while (shapeDrawn > length) {
shapeDrawn -= length;
currentShape++;
+ // otherwise, index out of bounds
+ if (currentShape >= frame.size()) {
+ break;
+ }
+ length = getCurrentShape().getLength();
}
double proportionalLength = trace * frameLength;
diff --git a/src/main/java/sh/ball/gui/Controller.java b/src/main/java/sh/ball/gui/Controller.java
index 114c762..43f9419 100644
--- a/src/main/java/sh/ball/gui/Controller.java
+++ b/src/main/java/sh/ball/gui/Controller.java
@@ -89,8 +89,8 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
// frames
private static final InputStream DEFAULT_OBJ = Controller.class.getResourceAsStream("/models/cube.obj");
private final ExecutorService executor = Executors.newSingleThreadExecutor();
- private final List openFiles = new ArrayList<>();
- private final List frameSourcePaths = new ArrayList<>();
+ private List openFiles = new ArrayList<>();
+ private List frameSourcePaths = new ArrayList<>();
private List>> frameSources = new ArrayList<>();
private FrameProducer> producer;
private int currentFrameSource;
@@ -669,23 +669,27 @@ public class Controller implements Initializable, FrequencyListener, MidiListene
}
private void updateFiles(List files, List names) throws IOException, ParserConfigurationException, SAXException {
- List>> oldFrameSources = frameSources;
- frameSources = new ArrayList<>();
- frameSourcePaths.clear();
- openFiles.clear();
- jkLabel.setVisible(files.size() > 1);
- framesPlaying = framesPlaying && files.size() > 1;
+ List>> newFrameSources = new ArrayList<>();
+ List newFrameSourcePaths = new ArrayList<>();
+ List newOpenFiles = new ArrayList<>();
for (int i = 0; i < files.size(); i++) {
try {
- frameSources.add(ParserFactory.getParser(names.get(i), files.get(i)).parse());
- frameSourcePaths.add(names.get(i));
- openFiles.add(files.get(i));
+ newFrameSources.add(ParserFactory.getParser(names.get(i), files.get(i)).parse());
+ newFrameSourcePaths.add(names.get(i));
+ newOpenFiles.add(files.get(i));
} catch (IOException ignored) {}
}
- oldFrameSources.forEach(FrameSource::disable);
- changeFrameSource(0);
+ if (newFrameSources.size() > 0) {
+ jkLabel.setVisible(newFrameSources.size() > 1);
+ framesPlaying = framesPlaying && newFrameSources.size() > 1;
+ frameSources.forEach(FrameSource::disable);
+ frameSources = newFrameSources;
+ frameSourcePaths = newFrameSourcePaths;
+ openFiles = newOpenFiles;
+ changeFrameSource(0);
+ }
}
// selects a new file or folder for files to be rendered from
diff --git a/src/main/java/sh/ball/parser/svg/MoveTo.java b/src/main/java/sh/ball/parser/svg/MoveTo.java
index 58e3bf4..11d22fa 100644
--- a/src/main/java/sh/ball/parser/svg/MoveTo.java
+++ b/src/main/java/sh/ball/parser/svg/MoveTo.java
@@ -11,7 +11,10 @@ class MoveTo {
// Parses moveto commands (M and m commands)
private static List parseMoveTo(SvgState state, List args, boolean isAbsolute) {
if (args.size() % 2 != 0 || args.size() < 2) {
- throw new IllegalArgumentException("SVG moveto command has incorrect number of arguments.");
+ for (Float arg : args) {
+ System.out.println(arg);
+ }
+ throw new IllegalArgumentException("SVG moveto command has incorrect number of arguments.\n");
}
Vector2 vec = new Vector2(args.get(0), args.get(1));
diff --git a/src/main/java/sh/ball/parser/svg/SvgParser.java b/src/main/java/sh/ball/parser/svg/SvgParser.java
index 8ca5ab1..c31c70d 100644
--- a/src/main/java/sh/ball/parser/svg/SvgParser.java
+++ b/src/main/java/sh/ball/parser/svg/SvgParser.java
@@ -77,7 +77,7 @@ public class SvgParser extends FileParser>> {
private String[] preProcessPath(String path) throws IllegalArgumentException {
// Replace all commas with spaces and then remove unnecessary whitespace
path = path.replace(',', ' ');
- path = path.replace("-", " -");
+ path = path.replaceAll("(?>> {
}
}
} catch (Exception e) {
+ e.printStackTrace();
System.out.println(Arrays.toString(decimalSplit));
System.out.println(command);
}