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/
/*.log
/javadoc/
/log/

View File

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

View File

@ -1,25 +1,66 @@
package com.danitheskunk.skunkworks;
import com.danitheskunk.skunkworks.audio.Samplei;
import com.danitheskunk.skunkworks.gfx.Color;
import com.danitheskunk.skunkworks.gfx.IRenderContext;
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 {
private Terminal term;
public Test() {
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) {
new Test().run();
var voices = mary.getAvailableVoices();
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
protected void init() {
var format = audio.getFormat();
//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)" +
"\\Steam\\steamapps\\common\\Unreal " +
"Tournament\\System\\UnrealTournament.ini";
var data = engine.loadDataWatched(path);
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
protected void render(IRenderContext rc) {
rc.drawTerminal(term);