diff options
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/tracker.cc | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/audio/tracker.cc b/src/audio/tracker.cc index 333a337..7ce96fc 100644 --- a/src/audio/tracker.cc +++ b/src/audio/tracker.cc @@ -44,15 +44,6 @@ static bool g_cache_initialized = false; // Forward declarations static int get_free_pool_slot(); -// Returns true if the asset blob looks like an MP3 file. -static bool is_mp3_asset(const uint8_t* data, size_t size) { - if (!data || size < 3) return false; - // ID3v2 tag prefix - if (data[0] == 'I' && data[1] == 'D' && data[2] == '3') return true; - // Raw MP3 sync word: 0xFF followed by 0xE0-0xFF - if (size >= 2 && data[0] == 0xFF && (data[1] & 0xE0) == 0xE0) return true; - return false; -} #if !defined(STRIP_ALL) // Decode an in-memory MP3 blob to a heap-allocated spectrogram (caller owns). @@ -147,7 +138,7 @@ void tracker_init() { size_t size; const uint8_t* data = GetAsset(aid, &size); #if !defined(STRIP_ALL) - if (data && size > 0 && is_mp3_asset(data, size)) { + if (data && size > 0 && GetAssetType(aid) == AssetType::MP3) { int num_frames = 0; float* spec_data = convert_mp3_to_spectrogram(data, size, &num_frames); @@ -165,7 +156,7 @@ void tracker_init() { } } else #else - FATAL_CHECK(data == nullptr || !is_mp3_asset(data, size), + FATAL_CHECK(data == nullptr || GetAssetType(aid) != AssetType::MP3, "MP3 assets not supported in STRIP_ALL builds\n"); #endif if (data && size >= sizeof(SpecHeader)) { |
