// Initialize UART for extended-audio void AUDIO_Init() { if (Transmitter.audio_player == AUDIO_DISABLED) { // Reload hardware.ini if audio_player had been temporarily disabled CONFIG_LoadHardware(); } printf("Voice: Initializing UART for extended-audio\n"); #if HAS_AUDIO_UART5 if (Transmitter.audio_uart5) { printf("Voice: UART5 already initialized\n"); return; } #endif #ifndef _DEVO12_TARGET_H_ if ( PPMin_Mode() || Model.protocol == PROTOCOL_PPM ) { printf("Voice: Cannot initialize UART for extended-audio, PPM in use\n"); UART_SetDataRate(0); } else { #endif // _DEVO12_TARGET_H_ printf("Voice: Setting up UART for extended-audio\n"); UART_SetDataRate(9600); #ifndef _DEVO12_TARGET_H_ } #endif // _DEVO12_TARGET_H_ AUDIO_SetVolume(); }
void PAGE_SplashEvent() { static unsigned int time=0; #if HAS_EXTENDED_AUDIO static unsigned int time_startup_msg; #endif if(GUI_IsModal()) return; // u8 step = 5; if ( 0 == time ) { time = CLOCK_getms() + Transmitter.splash_delay * 100; #if HAS_EXTENDED_AUDIO time_startup_msg = CLOCK_getms() + 5 * 100; // Dealy 0.5 second to play startup audio #endif } #if HAS_EXTENDED_AUDIO if (time_startup_msg && (CLOCK_getms() > time_startup_msg) ) { AUDIO_SetVolume(); MUSIC_Play(MUSIC_STARTUP); time_startup_msg = 0; } #endif if ( CLOCK_getms() > time ) PAGE_ChangeByID(PAGEID_MAIN,0); /* if ( offset > 0 ) { offset -= step; GUI_ChangeImage(&gui->splash_image,SPLASH_FILE,offset,0); GUI_Redraw(&gui->splash_image); }*/ }
void defaite() { // Il manque a faire le fichier jaiperdu AUDIO_SetVolume(90); /*AUDIO_PlayFile("jaiperdu.mp3");*/ tourner(180, GAUCHE); THREAD_MSleep(3000); tourner(180, DROITE); }
void victoire() { AUDIO_SetVolume(100); AUDIO_PlayFile("jaigagner.mp3"); tourner(45, GAUCHE); tourner(90, DROITE); tourner(90, GAUCHE); tourner(90, DROITE); tourner(360, GAUCHE); tourner(360, DROITE); tourner(45, GAUCHE); }
void freePlay() { AllLED(VERT); AUDIO_PlayFile(VOIX_FREE); LCD_ClearAndPrint("Je t'ecoute!\n"); LCD_ClearAndPrint("Appuie sur un des trois boutons pour revenir au menu.\n"); THREAD_MSleep(3000); PianoStream stream; stream.size = PIANO_SIZE; stream.streamID = -1; stream.currentNote = -1; Note notes[PIANO_SIZE] = {{false, true, VAL_DO1}, {false, true, VAL_RE}, {false, true, VAL_MI}, {false, true, VAL_FA}, {false, true, VAL_SOL}, {false, true, VAL_LA}, {false, true, VAL_SI}, {false, true, VAL_DO2}}; stream.notes = notes; AUDIO_SetVolume(50); //Infinite loop until the buttons call break while(1) { CheckPressedKeys(&stream); PlayAndStopNotes(&stream); THREAD_MSleep(10); if(ButtonStatus(1) == 1 || ButtonStatus(2) == 1 || ButtonStatus(3) == 1) break; } //Assure the piano has stopped playing sounds ResetStream(&stream); PlayAndStopNotes(&stream); }
void repeat(const char * path) { PianoStream stream; stream.size = PIANO_SIZE; stream.streamID = -1; stream.currentNote = -1; Note notes[PIANO_SIZE] = {{false, true, VAL_DO1}, {false, true, VAL_RE}, {false, true, VAL_MI}, {false, true, VAL_FA}, {false, true, VAL_SOL}, {false, true, VAL_LA}, {false, true, VAL_SI}, {false, true, VAL_DO2}}; stream.notes = notes; AUDIO_SetVolume(50); SongSequenceData song = readSongFile(path); //Song which is a representation of the song to play char readValue; //Mux read value for the piano notes float noteStartTime; //Represents the start of the note to keep up with time for(int i = 0; i < song.size; i++) { OpenLEDForNotes(song.noteSequences[i].note); noteStartTime = SYSTEM_ReadTimerMSeconds(); while(noteStartTime + song.noteSequences[i].delay > SYSTEM_ReadTimerMSeconds()) { CheckPressedKeys(&stream); PlayAndStopNotes(&stream); } } ResetStream(&stream); PlayAndStopNotes(&stream); }
static void _change_volumn(int _volumn) { AUDIO_SetVolume(_volumn); }
int main() { Init(); #ifndef ENABLE_MODULAR //Banner(); #endif if(PWR_CheckPowerSwitch()) PWR_Shutdown(); LCD_Clear(0x0000); #ifdef TEST_ADC ADC_ScanChannels(); while(1); #endif u32 buttons = ScanButtons(); if (CHAN_ButtonIsPressed(buttons, BUT_ENTER) || !FS_Init()) { LCD_DrawUSBLogo(LCD_WIDTH, LCD_HEIGHT); USB_Connect(); LCD_Clear(0x0000); FS_Init(); } CONFIG_LoadTx(); SPI_ProtoInit(); CONFIG_ReadDisplay(); CONFIG_ReadModel(CONFIG_GetCurrentModel()); CONFIG_ReadLang(Transmitter.language); BACKLIGHT_Brightness(Transmitter.backlight); LCD_Contrast(Transmitter.contrast); LCD_SetFont(DEFAULT_FONT.font); LCD_SetFontColor(DEFAULT_FONT.font_color); GUI_HandleButtons(1); MIXER_Init(); PAGE_Init(); CLOCK_StartWatchdog(); #if HAS_DATALOG DATALOG_Init(); #endif priority_ready = 0; CLOCK_SetMsecCallback(LOW_PRIORITY, LOW_PRIORITY_MSEC); CLOCK_SetMsecCallback(MEDIUM_PRIORITY, MEDIUM_PRIORITY_MSEC); // We need to wait until we've actually measured the ADC before proceeding while(! (priority_ready & (1 << LOW_PRIORITY))) PWR_Sleep(); //Only do this after we've initialized all channel data so the saftey works PROTOCOL_InitModules(); GUI_DrawScreen(); // Add startup delay to make sure audio player is initialized // AUDIO_Init() has already been called by CONFIG_ReadModel() #if HAS_EXTENDED_AUDIO audio_queue_time = CLOCK_getms() + 1500; num_audio=1; next_audio=1; #if (LCD_WIDTH == 480) || (LCD_WIDTH == 320) if(Display.background.drawn_background) while(CLOCK_getms() < audio_queue_time - 1200); #endif AUDIO_SetVolume(); // Initial setting of voice volume #endif MUSIC_Play(MUSIC_STARTUP); #ifdef HAS_EVENT_LOOP start_event_loop(); #else while(1) { if(priority_ready) { EventLoop(); } //This does not appear to have any impact on power //and has been disabled in common/devo/power.c //but it helps a huge amount for the emulator PWR_Sleep(); } #endif }