@@ -374,23 +374,14 @@ static size_t load_audio() {
374374 return audio_bytes.size ();
375375 }
376376
377- // these are configured in the CMakeLists.txt file
378- extern const char wav_start[] asm (" _binary_click_wav_start" ); // cppcheck-suppress syntaxError
379- extern const char wav_end[] asm (" _binary_click_wav_end" ); // cppcheck-suppress syntaxError
380-
381- // -1 due to the size being 1 byte too large, I think because end is the byte
382- // immediately after the last byte in the memory but I'm not sure - cmm 2022-08-20
383- //
384- // Suppression as these are linker symbols and cppcheck doesn't know how to ensure
385- // they are the same object
386- // cppcheck-suppress comparePointers
387- size_t wav_size = (wav_end - wav_start) - 1 ;
388- FILE *fp = fmemopen ((void *)wav_start, wav_size, " rb" );
389- // read the file into the audio_bytes vector
390- audio_bytes.resize (wav_size);
391- fread (audio_bytes.data (), 1 , wav_size, fp);
392- fclose (fp);
393- return wav_size;
377+ // load the audio data. these are configured in the CMakeLists.txt file
378+
379+ // cppcheck-suppress syntaxError
380+ extern const uint8_t click_wav_start[] asm (" _binary_click_wav_start" );
381+ // cppcheck-suppress syntaxError
382+ extern const uint8_t click_wav_end[] asm (" _binary_click_wav_end" );
383+ audio_bytes = std::vector<uint8_t >(click_wav_start, click_wav_end);
384+ return audio_bytes.size ();
394385}
395386
396387static void play_click (espp::EspBox &box) {
0 commit comments