Skip to content

Commit

Permalink
feat: check return type of musly_track_analyze_pcm
Browse files Browse the repository at this point in the history
- underlying method returns >0 when it encounters an issue
  • Loading branch information
andban committed Nov 2, 2024
1 parent 8c864aa commit 24f0df6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/pymusly/MuslyJukebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ MuslyTrack* MuslyJukebox::track_from_audiofile(const char* filename, int length,
throw musly_error("could not allocate track");
}

if (musly_track_analyze_audiofile(m_jukebox, filename, length, start, track) < 0) {
if (musly_track_analyze_audiofile(m_jukebox, filename, length, start, track) != 0) {
std::string message("could not load track from audio file: ");
message += filename;

Expand All @@ -111,7 +111,7 @@ MuslyTrack* MuslyJukebox::track_from_audiodata(const std::vector<float>& pcm_dat
throw musly_error("could not allocate track");
}

if (musly_track_analyze_pcm(m_jukebox, const_cast<float*>(pcm_data.data()), pcm_data.size(), track) < 0) {
if (musly_track_analyze_pcm(m_jukebox, const_cast<float*>(pcm_data.data()), pcm_data.size(), track) != 0) {
throw musly_error("could not load track from pcm");
}

Expand Down

0 comments on commit 24f0df6

Please sign in to comment.