Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Read Audio De1 soc

I am starting to using audio functions in DE1 soc. I run the media.c from Monitor Program without any problems. My doubt is that now I am going to integrate with my source code to identify isolated words and all my functions was designed to deal with double data. And in exemple, the data from audio buffer is an int:

volatile int * audio_ptr = (int *) 0xFF203040; // audio port address

int fifospace, int buffer_index = 0;

int left_buffer[BUF_SIZE];

int right_buffer[BUF_SIZE];

...

fifospace = *(audio_ptr + 1); // read the audio port fifospace register

if ( (fifospace & 0x000000FF) > 96) // check RARC, for > 75% full

{

/* store data until the audio-in FIFO is empty or the memory buffer is full */

while ( (fifospace & 0x000000FF) && (buffer_index < BUF_SIZE) )

{

left_buffer[buffer_index] = *(audio_ptr + 2); //Leftdata

right_buffer[buffer_index] = *(audio_ptr + 3); //Rightdata

++buffer_index;

fifospace = *(audio_ptr + 1); // read the audio port fifospace register

}

}

I am not sure what I need to do to convert this data to double to integrate properly with my code
No RepliesBe the first to reply