various cleanup

This commit is contained in:
DaniTheSkunk 2022-11-27 07:02:06 +00:00
parent 2d0bf1257d
commit eb9671a51a
3 changed files with 54 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
/out/ /out/
/*.log /*.log
/javadoc/
/log/

View File

@ -77,6 +77,7 @@ public class Engine {
public void tick() { public void tick() {
WatchKey key; WatchKey key;
//todo: check why it's not working after 2 times...
while((key = watchService.poll()) != null) { while((key = watchService.poll()) != null) {
for(var event : key.pollEvents()) { for(var event : key.pollEvents()) {
@SuppressWarnings("unchecked") var path = @SuppressWarnings("unchecked") var path =

View File

@ -1,25 +1,66 @@
package com.danitheskunk.skunkworks; package com.danitheskunk.skunkworks;
import com.danitheskunk.skunkworks.audio.Samplei;
import com.danitheskunk.skunkworks.gfx.Color; import com.danitheskunk.skunkworks.gfx.Color;
import com.danitheskunk.skunkworks.gfx.IRenderContext; import com.danitheskunk.skunkworks.gfx.IRenderContext;
import com.danitheskunk.skunkworks.gfx.vt.Terminal; import com.danitheskunk.skunkworks.gfx.vt.Terminal;
import marytts.LocalMaryInterface;
import marytts.exceptions.MaryConfigurationException;
import marytts.exceptions.SynthesisException;
import marytts.util.data.audio.MaryAudioUtils;
import javax.sound.sampled.AudioInputStream;
import java.util.concurrent.atomic.AtomicReference;
public class Test extends BaseGame { public class Test extends BaseGame {
private Terminal term; private Terminal term;
public Test() { public Test() {
super(new Vec2i(40 * 12, 22 * 12), "Skunkworks"); super(new Vec2i(40 * 12, 22 * 12), "Skunkworks");
LocalMaryInterface mary;
try {
mary = new LocalMaryInterface();
} catch(MaryConfigurationException e) {
throw new RuntimeException(e);
} }
public static void main(String[] args) { var voices = mary.getAvailableVoices();
new Test().run();
var text = "Welcome to the world of speech synthesis!";
AudioInputStream audio = null;
try {
audio = mary.generateAudio(text);
Util.time(() -> {
try {
mary.generateAudio(text);
} catch(SynthesisException e) {
throw new RuntimeException(e);
}
});
} catch(SynthesisException e) {
throw new RuntimeException(e);
} }
@Override var format = audio.getFormat();
protected void init() { //var aa = MaryAudioUtils.getSamplesAsDoubleArray(audio);
var ds = MaryAudioUtils.getSamplesAsDoubleArray(audio);
//var sample = audioEngine.loadSample(audio);
var sample = Samplei.fromMonoDoubleArray(ds);
System.out.println(sample.getLength());
//System.out.println(aa.length);
samplePlayer.play(sample, false);
var path = "C:\\Program Files (x86)" + var path = "C:\\Program Files (x86)" +
"\\Steam\\steamapps\\common\\Unreal " + "\\Steam\\steamapps\\common\\Unreal " +
"Tournament\\System\\UnrealTournament.ini"; "Tournament\\System\\UnrealTournament.ini";
var data = engine.loadDataWatched(path); var data = engine.loadDataWatched(path);
data.onReload(() -> System.out.println(data.get("URL", "Host"))); data.onReload(() -> System.out.println(data.get("URL", "Host")));
@ -60,6 +101,10 @@ public class Test extends BaseGame {
} }
public static void main(String[] args) {
new Test().run();
}
@Override @Override
protected void render(IRenderContext rc) { protected void render(IRenderContext rc) {
rc.drawTerminal(term); rc.drawTerminal(term);