aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--src/main/java/soundchan/AudioPlayerSendHandler.java9
-rw-r--r--src/main/java/soundchan/LocalAudioManager.java13
3 files changed, 9 insertions, 15 deletions
diff --git a/build.gradle b/build.gradle
index c780e8b..b0636bc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,7 +9,7 @@ repositories {
dependencies {
compile 'net.dv8tion:JDA:4.0.0_39'
- compile 'com.sedmelluq:lavaplayer:1.3.22'
+ compile 'com.sedmelluq:lavaplayer:1.3.32'
runtime 'ch.qos.logback:logback-classic:1.2.3'
}
diff --git a/src/main/java/soundchan/AudioPlayerSendHandler.java b/src/main/java/soundchan/AudioPlayerSendHandler.java
index fdd9774..43b1c75 100644
--- a/src/main/java/soundchan/AudioPlayerSendHandler.java
+++ b/src/main/java/soundchan/AudioPlayerSendHandler.java
@@ -24,19 +24,12 @@ public class AudioPlayerSendHandler implements AudioSendHandler {
@Override
public boolean canProvide() {
- if (lastFrame == null) {
- lastFrame = audioPlayer.provide();
- }
-
+ lastFrame = audioPlayer.provide();
return lastFrame != null;
}
@Override
public ByteBuffer provide20MsAudio() {
- if (lastFrame == null) {
- lastFrame = audioPlayer.provide();
- }
-
return ByteBuffer.wrap(lastFrame.getData());
}
diff --git a/src/main/java/soundchan/LocalAudioManager.java b/src/main/java/soundchan/LocalAudioManager.java
index 4db7010..b34c8f4 100644
--- a/src/main/java/soundchan/LocalAudioManager.java
+++ b/src/main/java/soundchan/LocalAudioManager.java
@@ -112,14 +112,15 @@ public class LocalAudioManager {
*/
private Map<String, String> PopulateFiles(){
File folder = new File(filepath);
- File[] listOfFiles = folder.listFiles();
-
Map<String, String> fileDict = new HashMap<>();
+ if(folder.exists() && folder.isDirectory()) {
+ File[] listOfFiles = folder.listFiles();
- for (File file : listOfFiles) {
- if (file.isFile()) {
- String filename = file.getName();
- fileDict.put(filename.substring(0, filename.indexOf('.')), filename);
+ for (File file : listOfFiles) {
+ if (file.isFile()) {
+ String filename = file.getName();
+ fileDict.put(filename.substring(0, filename.indexOf('.')), filename);
+ }
}
}
return fileDict;