Skip to content

Commit

Permalink
track total_length in frames
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Jan 19, 2024
1 parent fdcecaf commit 969d59f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SDL_sound_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ typedef struct __SOUND_SAMPLEINTERNAL__
Uint32 buffer_size;
void *decoder_private;
Sint32 total_time;
Uint32 total_length;
Uint32 mix_position;
MixFunc mix;
} Sound_SampleInternal;
Expand Down
1 change: 1 addition & 0 deletions src/SDL_sound_vorbis.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ static int VORBIS_open(Sound_Sample *sample, const char *ext)
const unsigned int rate = stb->sample_rate;
internal->total_time = (num_frames / rate) * 1000;
internal->total_time += (num_frames % rate) * 1000 / rate;
internal->total_length = num_frames;
} /* else */

return 1; /* we'll handle this data. */
Expand Down

0 comments on commit 969d59f

Please sign in to comment.