void setup() { soloud = Soloud_create(); speech = Speech_create(); Speech_setText(speech, "1 2 3 A B C Doooooo Reeeeee Miiiiii Faaaaaa Soooooo Laaaaaa Tiiiiii Doooooo!"); Soloud_initEx(soloud,SOLOUD_CLIP_ROUNDOFF | SOLOUD_ENABLE_VISUALIZATION, SOLOUD_AUTO, SOLOUD_AUTO, SOLOUD_AUTO); Soloud_setGlobalVolume(soloud, 4); Soloud_play(soloud, speech); printf("Playing..\n"); }
int main(int parc, char ** pars) { int i = 0; Soloud *soloud = Soloud_create(); Speech *speech = Speech_create(); Speech_setText(speech, "1 2 3 A B C Doooooo Reeeeee Miiiiii Faaaaaa Soooooo Laaaaaa Tiiiiii Doooooo!"); #ifdef _WIN32 Soloud_winmm_initEx(soloud, SOLOUD_CLIP_ROUNDOFF | SOLOUD_ENABLE_VISUALIZATION, 44100, 4096); #else Soloud_portaudio_initEx(soloud, SOLOUD_CLIP_ROUNDOFF | SOLOUD_ENABLE_VISUALIZATION, 44100, 4096); #endif Soloud_setGlobalVolume(soloud, 4); Soloud_play(soloud, speech); printf("Playing..\n"); while (Soloud_getActiveVoiceCount(soloud) > 0) { float * v = Soloud_calcFFT(soloud); int p = (int)(v[10] * 30); if (p > 59) p = 59; for (i = 0; i < p; i++) printf("="); for (i = p; i < 60; i++) printf(" "); printf("\r"); printf("%c\r", "|\\-/"[i&3]); i++; } printf("\nFinished.\n"); Soloud_deinit(soloud); Speech_destroy(speech); Soloud_destroy(soloud); printf("Cleanup done.\n"); return 0; }
int main(int parc, char ** pars) { int i = 0, spin = 0; Soloud *soloud = Soloud_create(); Speech *speech = Speech_create(); Speech_setText(speech, "1 2 3 A B C Doooooo Reeeeee Miiiiii Faaaaaa Soooooo Laaaaaa Tiiiiii Doooooo!"); Soloud_initEx(soloud,SOLOUD_CLIP_ROUNDOFF | SOLOUD_ENABLE_VISUALIZATION, SOLOUD_AUTO, SOLOUD_AUTO, SOLOUD_AUTO, SOLOUD_AUTO); Soloud_setGlobalVolume(soloud, 4); Soloud_play(soloud, speech); printf("Playing..\n"); while (Soloud_getVoiceCount(soloud) > 0) { int p; float * v = Soloud_calcFFT(soloud); printf("\r%c ", (int)("|\\-/"[spin & 3])); spin++; p = (int)(v[10] * 30); if (p > 59) p = 59; for (i = 0; i < p; i++) printf("="); for (i = p; i < 60; i++) printf(" "); } printf("\nFinished.\n"); Soloud_deinit(soloud); Speech_destroy(speech); Soloud_destroy(soloud); printf("Cleanup done.\n"); return 0; }