| 34 | static const char* g_whisper_prompt = get_transcribe_prompt(); |
| 35 | |
| 36 | static std::vector<float> parse_float_array(const std::string& json, const std::string& key) { |
| 37 | std::vector<float> values; |
| 38 | std::string search = "\"" + key + "\":["; |
| 39 | size_t start = json.find(search); |
| 40 | if (start == std::string::npos) return values; |
| 41 | start += search.size(); |
| 42 | size_t end = json.find("]", start); |
| 43 | if (end == std::string::npos) return values; |
| 44 | const char* p = json.c_str() + start; |
| 45 | const char* end_p = json.c_str() + end; |
| 46 | while (p < end_p) { |
| 47 | char* next; |
| 48 | float v = strtof(p, &next); |
| 49 | if (next == p) break; |
| 50 | values.push_back(v); |
| 51 | p = next; |
| 52 | while (p < end_p && (*p == ',' || *p == ' ')) ++p; |
| 53 | } |
| 54 | return values; |
| 55 | } |
| 56 | |
| 57 | bool test_audio_processor() { |
| 58 | std::cout << "\n╔══════════════════════════════════════════╗\n" |
no test coverage detected