- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi altera forum.
Could i ask you about Audio port operation? ---------------------------------------------------------------------------------# include "address_map_nios2.h"# include "stdlib.h"# include "stdio.h" # define BUF_SIZE 500000 # define AUDIO_SUBSYSTEM_AUDIO_BASE 0xFF203040; volatile int * audio_ptr = (int *) AUDIO_SUBSYSTEM_AUDIO_BASE; // audio port address int fifospace = 0; int buffer_index=0; int left_buffer[BUF_SIZE]; int right_buffer[BUF_SIZE]; int main(void) { volatile int *audio_ptr = (int *) AUDIO_SUBSYSTEM_AUDIO_BASE; // audio port address *audio_ptr = 0x03; int wi=0; FILE * fpi1 = fopen("01_explosion.raw", "rb"); // get file at project file while(1){ wi = ((*audio_ptr)&0x200)>>9; // WI fread((void*)left_buffer,172000,sizeof(float),fpi1); // read file and store to left_buf, file size 172KB if(wi==1) { buffer_index=0; while(buffer_index < BUF_SIZE) { *(audio_ptr + 3) = left_buffer[buffer_index]; *(audio_ptr + 2) = left_buffer[buffer_index]; ++buffer_index; wi=(((*audio_ptr)&0x200)>>9); if(wi==0) //wait until next sampling { while(wi==0){wi=(((*audio_ptr)&0x200)>>9);} } } } } } -------------------------------------------------------------- i'm trying to get audio file from project file and to play through the speaker with monitor program. but it is not play correctly, but sounds like radio signaling sound. my raw file is 32-bit, mono, format=raw, and 48K sampling. what should i do?Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page