this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cleanup; add hide fft behind the --fft CLI flag

alice cd9f8999 611a0223

+32 -41
+2 -18
src/ext/fft.c
··· 75 75 void miniaudioLogCallback(void *userData, ma_uint32 level, const char *message) 76 76 { 77 77 (void)userData; 78 - printf("[FFT] [miniaudio:%p]\n %s", userData, message); 78 + return; 79 + // printf("[FFT] [miniaudio:%p]\n %s", userData, message); 79 80 // switch (level) 80 81 // { 81 82 // case MA_LOG_LEVEL_DEBUG: { ··· 175 176 176 177 return true; 177 178 } 178 - bool FFT_GetFFT(float* _samples) 179 - { 180 - if (!bCreated) 181 - { 182 - return false; 183 - } 184 179 185 - kiss_fft_cpx out[FFT_SIZE + 1]; 186 - kiss_fftr(fftcfg, sampleBuf, out); 187 - 188 - for (int i = 0; i < FFT_SIZE; i++) 189 - { 190 - static const float scaling = 1.0f / (float)FFT_SIZE; 191 - _samples[i] = 2.0 * sqrtf(out[i].r * out[i].r + out[i].i * out[i].i) * scaling; 192 - } 193 - 194 - return true; 195 - } 196 180 void FFT_Close() 197 181 { 198 182 if (!bCreated)
+4 -3
src/studio/studio.c
··· 2392 2392 #define CMD_PARAMS_DEF(name, ctype, type, post, help) OPT_##type('\0', #name, &args.name, help), 2393 2393 CMD_PARAMS_LIST(CMD_PARAMS_DEF) 2394 2394 #undef CMD_PARAMS_DEF 2395 - OPT_BOOLEAN('o', "fftlist", &args.fftlist, "list FFT devices"), 2396 - OPT_STRING('p', "fftdevice", &args.fftdevice, "name of the device to use with FFT"), 2395 + OPT_BOOLEAN('\0', "fft", &args.fft, "enable FFT support"), 2396 + OPT_BOOLEAN('\0', "fftlist", &args.fftlist, "list FFT devices"), 2397 + OPT_STRING('\0', "fftdevice", &args.fftdevice, "name of the device to use with FFT"), 2397 2398 OPT_END(), 2398 2399 }; 2399 2400 ··· 2594 2595 FFT_EnumerateDevices(print_fft_devices, NULL); 2595 2596 exit(0); 2596 2597 } 2597 - 2598 + studio->config->data.fft = args.fft; 2598 2599 studio->config->data.fftdevice = args.fftdevice; 2599 2600 #endif 2600 2601
+1
src/studio/studio.h
··· 95 95 CMD_PARAMS_LIST(CMD_PARAMS_DEF) 96 96 #undef CMD_PARAMS_DEF 97 97 98 + bool fft; 98 99 s32 fftlist; 99 100 const char *fftdevice; 100 101 } StartArgs;
+1
src/studio/system.h
··· 145 145 146 146 s32 uiScale; 147 147 148 + bool fft; 148 149 const char *fftdevice; 149 150 } StudioConfig; 150 151
+24 -20
src/system/sdl/main.c
··· 328 328 .samples = 1024, 329 329 }; 330 330 331 - FFT_Create(); 332 - 333 - FFT_Settings fftSettings; 334 - fftSettings.bUseRecordingDevice = false; 335 - fftSettings.pDeviceID = NULL; 336 - 337 - if (studio_config(platform.studio)->fftdevice != NULL) 331 + if (studio_config(platform.studio)->fft) 338 332 { 339 - FFT_EnumerateDevices(find_fft_device_by_id, NULL); 340 - if (deviceId != NULL) 341 - { 342 - fftSettings.pDeviceID = deviceId; 343 - } 344 - else 333 + FFT_Create(); 334 + FFT_Settings fftSettings; 335 + fftSettings.bUseRecordingDevice = false; 336 + fftSettings.pDeviceID = NULL; 337 + 338 + if (studio_config(platform.studio)->fftdevice != NULL) 345 339 { 346 - printf("Selected device was not found"); 347 - exit(1); 340 + FFT_EnumerateDevices(find_fft_device_by_id, NULL); 341 + if (deviceId != NULL) 342 + { 343 + fftSettings.pDeviceID = deviceId; 344 + } 345 + else 346 + { 347 + printf("Selected device was not found"); 348 + exit(1); 349 + } 348 350 } 349 - } 350 351 351 - FFT_Open(&fftSettings); 352 + FFT_Open(&fftSettings); 353 + } 352 354 353 355 platform.audio.device = SDL_OpenAudioDevice(NULL, 0, &want, &platform.audio.spec, 0); 354 356 } ··· 1988 1990 1989 1991 SDL_DestroyWindow(platform.window); 1990 1992 SDL_CloseAudioDevice(platform.audio.device); 1991 - 1992 - FFT_Close(); 1993 - FFT_Destroy(); 1993 + if (studio_config(platform.studio)->fft) 1994 + { 1995 + FFT_Close(); 1996 + FFT_Destroy(); 1997 + } 1994 1998 } 1995 1999 1996 2000 SDL_DestroyMutex(platform.audio.mutex);