this repo has no description
0
fork

Configure Feed

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

use FFT_DebugLog

alice 9bbda6dc 01e76fba

+31 -29
+23 -23
src/ext/fft.c
··· 26 26 (void)userData; 27 27 switch (level) { 28 28 case MA_LOG_LEVEL_DEBUG: 29 - printf( "[FFT] DEBUG log: %s", message ); 29 + printf( "[MA DEBUG]: %s", message ); 30 30 break; 31 31 case MA_LOG_LEVEL_INFO: 32 - printf( "[FFT] INFO log: %s", message ); 32 + printf( "[MA INFO]: %s", message ); 33 33 break; 34 34 case MA_LOG_LEVEL_WARNING: 35 - printf( "[FFT] WARNING log: %s", message ); 35 + printf( "[MA WARNING]: %s", message ); 36 36 break; 37 37 case MA_LOG_LEVEL_ERROR: 38 - printf( "[FFT] ERROR log: %s", message ); 38 + printf( "[MA ERROR]: %s", message ); 39 39 break; 40 40 } 41 41 ··· 72 72 ma_result result = ma_context_init(NULL, 0, &context_config, &context); 73 73 if (result != MA_SUCCESS) 74 74 { 75 - printf("[FFT] Failed to initialize context: %s", ma_result_description(result)); 75 + FFT_DebugLog(FFT_LOG_ERROR, "[FFT] Failed to initialize context: %s", ma_result_description(result)); 76 76 return; 77 77 } 78 78 79 - printf( "[FFT] MAL context initialized, backend is '%s'\n", ma_get_backend_name( context.backend ) ); 79 + FFT_DebugLog(FFT_LOG_INFO, "MAL context initialized, backend is '%s'\n", ma_get_backend_name( context.backend ) ); 80 80 81 81 ma_device_info* pPlaybackDeviceInfos; 82 82 ma_uint32 playbackDeviceCount; ··· 84 84 ma_uint32 captureDeviceCount; 85 85 result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); 86 86 if (result != MA_SUCCESS) { 87 - printf("Failed to retrieve device information.\n"); 88 - printf("Error: %s\n", ma_result_description(result)); 87 + FFT_DebugLog(FFT_LOG_ERROR, "Failed to retrieve device information.\n"); 88 + FFT_DebugLog(FFT_LOG_ERROR, "Error: %s\n", ma_result_description(result)); 89 89 return; 90 90 } 91 91 92 - printf("Playback Devices\n"); 92 + FFT_DebugLog(FFT_LOG_INFO, "Playback Devices\n"); 93 93 for (ma_uint32 iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) { 94 - printf(" %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); 94 + FFT_DebugLog(FFT_LOG_INFO, " %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); 95 95 } 96 96 97 97 printf("\n"); 98 98 99 - printf("Capture Devices\n"); 99 + FFT_DebugLog(FFT_LOG_INFO, "Capture Devices\n"); 100 100 for (ma_uint32 iDevice = 0; iDevice < captureDeviceCount; ++iDevice) { 101 - printf(" %u: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); 101 + FFT_DebugLog(FFT_LOG_INFO, " %u: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); 102 102 } 103 103 104 104 printf("\n"); ··· 122 122 ma_result result = ma_context_init( NULL, 0, &context_config, &context ); 123 123 if ( result != MA_SUCCESS ) 124 124 { 125 - printf( "[FFT] Failed to initialize context: %d", result ); 125 + FFT_DebugLog(FFT_LOG_ERROR, "Failed to initialize context: %d", result ); 126 126 return false; 127 127 } 128 128 129 - printf( "[FFT] MAL context initialized, backend is '%s'\n", ma_get_backend_name( context.backend ) ); 129 + FFT_DebugLog(FFT_LOG_INFO, "MAL context initialized, backend is '%s'\n", ma_get_backend_name( context.backend ) ); 130 130 131 131 ma_device_id* TargetDevice = NULL; 132 132 ··· 136 136 ma_uint32 captureDeviceCount; 137 137 result = ma_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); 138 138 if (result != MA_SUCCESS) { 139 - printf("Failed to retrieve device information.\n"); 139 + FFT_DebugLog(FFT_LOG_ERROR, "Failed to retrieve device information.\n"); 140 140 return false; 141 141 } 142 142 143 - printf("Playback Devices\n"); 143 + FFT_DebugLog(FFT_LOG_INFO, "Playback Devices\n"); 144 144 for (ma_uint32 iDevice = 0; iDevice < playbackDeviceCount; ++iDevice) { 145 - printf(" %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); 145 + FFT_DebugLog(FFT_LOG_INFO, " %u: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); 146 146 } 147 147 148 148 printf("\n"); 149 149 150 - printf("Capture Devices\n"); 150 + FFT_DebugLog(FFT_LOG_INFO, "Capture Devices\n"); 151 151 for (ma_uint32 iDevice = 0; iDevice < captureDeviceCount; ++iDevice) { 152 - printf(" %u: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); 152 + FFT_DebugLog(FFT_LOG_INFO, " %u: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); 153 153 } 154 154 155 155 printf("\n"); 156 156 157 157 bool useLoopback = (ma_is_loopback_supported(context.backend) && CapturePlaybackDevices); 158 - printf("[FFT] Loopback support: %s, Use loopback: %s\n", ma_is_loopback_supported(context.backend) ? "Yes" : "No", useLoopback ? "Yes" : "No"); 158 + FFT_DebugLog(FFT_LOG_INFO, "Loopback support: %s, Use loopback: %s\n", ma_is_loopback_supported(context.backend) ? "Yes" : "No", useLoopback ? "Yes" : "No"); 159 159 160 160 if(CaptureDeviceSearchString && strlen(CaptureDeviceSearchString) > 0) { 161 161 if(useLoopback) { ··· 189 189 if ( result != MA_SUCCESS ) 190 190 { 191 191 ma_context_uninit( &context ); 192 - printf( "[FFT] Failed to initialize capture device: %d\n", result ); 192 + FFT_DebugLog(FFT_LOG_ERROR, "Failed to initialize capture device: %d\n", result ); 193 193 return false; 194 194 } 195 195 ··· 198 198 { 199 199 ma_device_uninit( &captureDevice ); 200 200 ma_context_uninit( &context ); 201 - printf( "[FFT] Failed to start capture device: %d\n", result ); 201 + FFT_DebugLog(FFT_LOG_ERROR, "Failed to start capture device: %d\n", result ); 202 202 return false; 203 203 } 204 204 205 - printf( "[FFT] Capturing %s\n", captureDevice.capture.name ); 205 + FFT_DebugLog(FFT_LOG_INFO, "Capturing %s\n", captureDevice.capture.name ); 206 206 207 207 return true; 208 208 }
+8 -6
src/fftdata.c
··· 12 12 #ifdef FFT_DEBUG 13 13 if (level <= g_currentLogLevel) { 14 14 // Get current time 15 - time_t now = time(NULL); 16 - struct tm *tm_now = localtime(&now); 17 - char time_str[20]; // ISO 8601 format requires 19 characters + null terminator 18 - strftime(time_str, sizeof(time_str), "%Y-%m-%dT%H:%M:%S", tm_now); 15 + if (level == FFT_LOG_TRACE) { 16 + time_t now = time(NULL); 17 + struct tm *tm_now = localtime(&now); 18 + char time_str[20]; // ISO 8601 format requires 19 characters + null terminator 19 + strftime(time_str, sizeof(time_str), "%Y-%m-%dT%H:%M:%S", tm_now); 19 20 20 - // Print time and log level 21 - printf("%s ", time_str); // Print the time 21 + // Print time and log level 22 + printf("%s ", time_str); // Print the time 23 + } 22 24 va_list args; 23 25 va_start(args, format); 24 26 switch(level) {