Downloader: link preferred bitrate to JDA requested format.

jda-v5
Nekojimi 2 years ago
parent ae7fe8cc7b
commit b0415b0324
  1. 3
      src/main/java/moe/nekojimi/chords/Downloader.java

@ -28,6 +28,7 @@ import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonReader;
import moe.nekojimi.chords.Downloader.DownloadTask;
import net.dv8tion.jda.api.audio.AudioSendHandler;
/**
*
@ -40,7 +41,7 @@ public class Downloader implements Consumer<DownloadTask>
private static final int INFO_TIMEOUT = 10;
private static final int FORMAT_TIMEOUT = 5;
private static final int BITRATE_TARGET = 64_000;
private static final int BITRATE_TARGET = (int) AudioSendHandler.INPUT_FORMAT.getSampleRate();
private static final Pattern FORMAT_PATTERN = Pattern.compile("^([\\w]+)\\s+([\\w]+)\\s+(\\w+ ?\\w*)\\s+(.*)$");
public static final Pattern DESTINATION_PATTERN = Pattern.compile("Destination: (.*\\.wav)");

Loading…
Cancel
Save