package com.danitheskunk.skunkworks;

import com.danitheskunk.skunkworks.audio.AudioEngine;
import com.danitheskunk.skunkworks.audio.nodes.Mixer;
import com.danitheskunk.skunkworks.audio.nodes.Node;
import com.danitheskunk.skunkworks.audio.nodes.SamplePlayer;
import com.danitheskunk.skunkworks.audio.nodes.Sine;

@SuppressWarnings("ALL")
public class TestSound {
	public static void main(String[] args) throws InterruptedException {
		var engine = new AudioEngine(44100, 256, 16);
		var mix = new Mixer(engine, 4);
		var sin1 = new Sine(engine, 440);
		var sin2 = new Sine(engine, 659.25);
		var sin3 = new Sine(engine, 523.25);
		engine.setNode(mix);
		//Node.connect(sin1, 0, mix, 0);
		Node.connect(sin3, 0, mix, 1);
		//Node.connect(sin2, 0, mix, 2);

		var loop = engine.loadSample("C:\\Users\\dani\\Downloads\\AKWF" +
			"\\AKWF_bw_sin\\AKWF_sin_0001.wav");
		var sample = engine.loadSample("C:\\Users\\dani\\Downloads\\Untitled" +
			".wav");
		var kick = engine.loadSample("C:\\samples\\drum\\legowelt\\BASEDRUMS" +
			"\\Legowelt Basedrum 007.wav");
		var player = new SamplePlayer(engine);
		Node.connect(player, 0, mix, 0);

		player.play(loop, true);
		for(int j = 0; j < 10; ++j) {
			player.play(kick);
			for(int i = 0; i < 50; ++i) {
				engine.refill();
				Thread.sleep(20);
			}
		}
	}
}
