Forum Discussion

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

Need help with audio

I'm supposed to store incoming audio, and I found this code used working with the "meida computer". Exactely where is the incoming data stored? Here is the code:

A fragment of C code that uses the audio port is shown in Figure 28. The code checks to see when the depth of either

the left or right Read FIFO has exceeded 75% full, and then moves the data from these FIFOs into a memory buffer.

This code is part of a larger program that is distributed as part of the Altera Monitor Program. The source code can

be found under the heading sample programs, and is identified by the name Media.

volatile int * audio_ptr = (int *) 0x10003040; // 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

}

}

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Obviously in left_buffer and right_buffer, which can be expected to exist in NIOS RAM space.