void MUSIC_Play(u16 music) { #if HAS_EXTENDED_AUDIO // Play audio for switch if ( music > MUSIC_TOTAL ) { if (AUDIO_VoiceAvailable()) AUDIO_AddQueue(music); return; } playback_device = AUDDEV_UNDEF; #endif vibrate = 1; // Haptic sensor set to on as default /* NOTE: We need to do all this even if volume is zero, because the haptic sensor may be enabled */ if (MUSIC_GetSound(music)) return; #if HAS_EXTENDED_AUDIO if ( !(playback_device == AUDDEV_BUZZER) ) { if ( AUDIO_VoiceAvailable() && AUDIO_AddQueue(music) ) { if ((playback_device == AUDDEV_EXTAUDIO) || (playback_device == AUDDEV_UNDEF)) { Volume = 0; return; } } } #endif if(! num_notes) return; SOUND_SetFrequency(note_map[Notes[0].note].note, Volume); SOUND_Start((u16)Notes[0].duration * 10, next_note_cb, vibrate); }
void MUSIC_Play(enum Music music) { /* NOTE: We need to do all this even if volume is zero, because the haptic sensor may be enabled */ num_notes = 0; next_note = 1; Volume = Transmitter.volume * 10; char filename[] = "media/sound.ini\0\0\0"; // placeholder for longer folder name #ifdef _DEVO12_TARGET_H_ static u8 checked; if(!checked) { FILE *fh; fh = fopen("mymedia/sound.ini", "r"); if(fh) { sprintf(filename, "mymedia/sound.ini"); fclose(fh); } checked = 1; } #endif if(CONFIG_IniParse(filename, ini_handler, (void *)sections[music])) { printf("ERROR: Could not read %s\n", filename); return; } if(! num_notes) return; SOUND_SetFrequency(note_map[Notes[0].note].note, Volume); SOUND_Start((u16)Notes[0].duration * 10, next_note_cb); }
void MUSIC_Beep(char* note, u16 duration, u16 interval, u8 count) { vibrate = 1; // Haptic sensor set to on as default u8 tone=0,i; next_note = 1; Volume = Transmitter.volume * 10; if(! count) return; if(count > sizeof(Notes)/2) count = sizeof(Notes)/2; for(i = 0; i < NUM_NOTES; i++) { if(strcasecmp(note_map[i].str, note) == 0) { tone = i; break; } } num_notes = count*2; for(i=0; i<count; i++) { Notes[i*2].note = tone; Notes[i*2].duration = duration / 10; Notes[(i*2)+1].note = 0; Notes[(i*2)+1].duration = interval / 10; } SOUND_SetFrequency(note_map[Notes[0].note].note, Volume); SOUND_Start((u16)Notes[0].duration * 10, next_note_cb, vibrate); }