#include "testApp.h"


void testApp::setup(){ 

	ofBackground(255,0,0);
	
	
	output=new SndRTIO(2, SND_OUTPUT, 512);
	
	table1=new HarmTable(2500, SINE,1); //SIN
	table2=new HarmTable(2500, BUZZ,1);
	
	oscilL=new Oscili(table2, 1.f, 100.0f);
	//oscilR=new Oscili(table1, 200.f, 10000.f, 0, oscilL);  // AM
	oscilR=new Oscili(table1, 200.f, 10000.f, oscilL); // FM 
	
	output->SetOutput(1, oscilR);
	output->SetOutput(2, oscilR);
	
	sndthread.AddObj(&audio);
	sndthread.AddObj(oscilL);
	sndthread.AddObj(oscilR);
	sndthread.AddObj(output, SNDIO_OUT);
	sndthread.ProcOn();
	ofSetFrameRate(30); 
	
}

void testApp::update(){

	oscilL->SetFreq(mouseX);
	oscilR->SetFreq(mouseY);

		
}

void testApp::draw(){
	glClearColor(0.1,0,0,0); 
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
}

void testApp::exit(){
	delete table1;
	delete output;
}

void testApp::mouseReleased(){
	
}















