void av_config_setup() { bool once = true; alt_up_av_config_dev * av_config = alt_up_av_config_open_dev(AV_CONFIG); while(!alt_up_av_config_read_ready(av_config)) { if(once) { printf("Error, audio not configured.\n"); once = false; } } }
void av_config_setup(){ printf("Configuring audio and video.\n"); alt_up_av_config_dev * av_config = alt_up_av_config_open_dev("/dev/audio_and_video_config_0"); while (!alt_up_av_config_read_ready(av_config)); printf("Opening audio device.\n"); audio = alt_up_audio_open_dev("/dev/audio_0"); alt_up_audio_reset_audio_core(audio); }
/* * Overview: This configures the audio and video. * */ void av_config_setup() { alt_up_av_config_dev * av_config = alt_up_av_config_open_dev("/dev/audio_video_config"); if(av_config == NULL) { //printf("Configuration failed\n"); } while (!alt_up_av_config_read_ready(av_config)){} //printf("Audio video configuration complete\n"); }
int initAVConfig(alt_up_av_config_dev* av_config) { if (av_config == NULL) { return AUDIO_ERROR; } alt_up_av_config_reset(av_config); /* if (alt_up_av_config_enable_interrupt(av_config) == 0) { printf("Config interrupt enabled\n"); } */ while (!alt_up_av_config_read_ready(av_config)) { } return 0; }
int main(void) { device_reference = alt_up_sd_card_open_dev("/dev/SD_Card"); if (device_reference != NULL) { while(1) { if ((connected == 0) && (alt_up_sd_card_is_Present())) { printf("Card connected.\n"); if (alt_up_sd_card_is_FAT16()) { printf("FAT16 file system detected.\n"); //Print out the list in the sd card handler = alt_up_sd_card_find_first("", buffer_name); printf("%s \n", buffer_name); //Read a file in SD card -needs to speed up(10 sec?) - needs array of int sd_fileh = alt_up_sd_card_fopen("TEST.WAV", false); if (sd_fileh < 0) printf("Problem reading file. Error %i\n", sd_fileh); else { printf("Reading file...\n"); audio_dev = alt_up_audio_open_dev (AUDIO_NAME); if ( audio_dev == NULL){ return; } av_config = alt_up_av_config_open_dev(AUDIO_AND_VIDEO_CONFIG_NAME); while(!alt_up_av_config_read_ready(av_config)); alt_up_audio_disable_read_interrupt(audio_dev); alt_up_audio_enable_write_interrupt(audio_dev); /* // Get information of number of channels //count = 0; char a, b; int d; short c; int index = 0; while (buffer_name[index] != "\0"){ a = alt_up_sd_card_read(sd_fileh); b = alt_up_sd_card_read(sd_fileh); c = ((unsigned char) a <<8) | (unsigned char) b; d = c; d = alt_up_audio_write_fifo(device_reference,d,) index++; } */ /* // printf("NumChannels "); byte1 = 0;byte2 = 0;total = 0; byte1 = alt_up_sd_card_read(sd_fileh); byte2 = alt_up_sd_card_read(sd_fileh); total = (byte1 & 0x00ff) | (byte2 << 8); NumChannels = total; // printf("%d\n",total); // printf("SampleRate "); byte1 = 0;byte2 = 0;byte3 = 0;byte4 = 0;long_total = 0; byte1 = alt_up_sd_card_read(sd_fileh); byte2 = alt_up_sd_card_read(sd_fileh); byte3 = alt_up_sd_card_read(sd_fileh); byte4 = alt_up_sd_card_read(sd_fileh); long_total = (byte4 << 24) | (byte3 << 16) | (byte2 << 8) | ( byte1 & 0x000000ff); sampleRate = long_total; // printf("%ld\n",long_total); */ /* count = 0; while (count < 16) // 44-byte header { alt_up_sd_card_read(sd_fileh); count++; } */ } //find next file while ((handler = alt_up_sd_card_find_next(buffer_name)) != -1) printf("%s \n", buffer_name); }else{ printf("Unknown file system.\n"); } connected = 1; } else if ((connected == 1) && (alt_up_sd_card_is_Present() == false)) { printf("Card disconnected.\n"); connected = 0; } } } return 0; }
/** * Mandatory setup function in order for audio to function */ void av_config_setup() { alt_up_av_config_dev * av_config = alt_up_av_config_open_dev(AUDIO_AND_VIDEO_CONFIG_0_NAME); while (!alt_up_av_config_read_ready(av_config)); }