fixed: crash from invalid buffer positioning, error from shutting thread

down before instantiation; removed old code;
This commit is contained in:
2018-08-29 22:32:44 -05:00
parent b84a3d6280
commit 97afc449b2
6 changed files with 18 additions and 26 deletions

View File

@@ -33,12 +33,6 @@ public class MP3Metadata implements AudioMetadata {
try {
MP3File mp3file = (MP3File) AudioFileIO.read(fileHandle.file());
ID3v23Tag tag;
if (mp3file.hasID3v1Tag()) {
mp3file.setID3v2Tag(mp3file.getID3v1Tag());
mp3file.setID3v1Tag(null);
mp3file.commit();
tag = (ID3v23Tag) mp3file.getTagAndConvertOrCreateAndSetDefault();
}
tag = (ID3v23Tag) mp3file.getTagAndConvertOrCreateAndSetDefault();
@@ -53,7 +47,7 @@ public class MP3Metadata implements AudioMetadata {
if (title.isEmpty()) {
title = fileHandle.nameWithoutExtension().replace('_', ' ');
}
} catch (IOException | CannotWriteException | CannotReadException | TagException | ReadOnlyFileException | InvalidAudioFrameException e) {
} catch (IOException | CannotReadException | TagException | ReadOnlyFileException | InvalidAudioFrameException e) {
Gdx.app.error("MP3Metadata", "Failed to read metadata of file: " + fileHandle.name());
}
}

View File

@@ -28,7 +28,8 @@ public class DoubleHorizontalVisualizer implements Disposable {
private float barChangeRate = 6.5f;
private int smoothRange = 2;
private int binsToInclude = 120;
private Color color = new Color(0.5f, 0.6f, 0.8f, 0.46f);
private Color colorBegin = new Color(0.5f, 0.6f, 0.8f, 0.46f);
private Color colorEnd = new Color();
/**
*
* @param barCount amount of bars this visualizer should have.
@@ -98,7 +99,6 @@ public class DoubleHorizontalVisualizer implements Disposable {
public void draw(Batch batch, float parentAlpha) {
batch.end();
Gdx.gl.glEnable(GL20.GL_BLEND);
shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
@@ -109,7 +109,7 @@ public class DoubleHorizontalVisualizer implements Disposable {
}
for (int bar = 0; bar < barCount; bar++) {
shapeRenderer.setColor(color);
shapeRenderer.setColor(colorBegin);
shapeRenderer.rect(offset + (spaceBetweenBars+barWidth)*bar, y+height, barWidth, barHeights[bar]);
shapeRenderer.rect(offset + (spaceBetweenBars+barWidth)*bar, y, barWidth, -barHeights[barHeights.length - 1 - bar]);
}