Example #1
0
File: main.c Project: mewashin/SPH
/**
 * main method
 * contains main run loop
 */
int main() {
	//prototype for linear assembly convolution function
	extern int convolve_as_func(int x[], int w[], int x_idx, int w_length);
	
	DSK6713_init();
	hCodec = DSK6713_AIC23_openCodec(0,&config);
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ);

	// enable interrupts
	IRQ_globalEnable();
	IRQ_enable(IRQ_EVT_RINT1);
	IRQ_enable(IRQ_EVT_XINT1);
	
	reset();	// init the input buffer to zeros

	// get the time to make a clock() funciton call; used only for profiling
	/*
	start = clock();
	end = clock();
	diff = end - start;
	*/

	// the first write is needed to trigger the transmit interrupt
	while(!DSK6713_AIC23_write(hCodec, 0));
	in_channel_flag = 1;
	out_channel_flag = 1;

	while(1) {
		if(input_ready) {
			//process sample when input is ready
			sig_error = process_sample(in_left, in_right);
			input_ready = 0;
		}

		// set output when ready
		if(output_ready) {
			out_left = in_left;
			out_right = sig_error;
			output_ready = 0;
		}
	};
	

	/* The program will never exit this loop */
	/* However, if you _do_ exit the loop (say, using a break
	 * statement) close the D/A converter properly */
	DSK6713_AIC23_closeCodec(hCodec);
	exit();
}
void main(){
    DSK6713_AIC23_CodecHandle hCodec;

	int i;

    /* Initialize the board support library, must be called first */
    DSK6713_init();

    /* Start the codec, set sample rate to 8kHz */
    hCodec = DSK6713_AIC23_openCodec(0, &config);
	DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ);

	/* Output all the notes 2 times */
	for(i=0;i<2;i++){
		//#include "sequence.h"
	}
	//play Deck the Halls, based on the notes the DSK identified
	#include "sequence_deck.h"

    /* Close the codec */
    DSK6713_AIC23_closeCodec(hCodec);
}