Skip to content

Commit

Permalink
A true fix of the VOC_EXTENDED channels number reading
Browse files Browse the repository at this point in the history
#35
Regarding to this specification https://wiki.multimedia.cx/index.php?title=Creative_Voice#Block_type_0x08:_Extra_info
A count of channels stored in the file is a value with 1 subtracted
  • Loading branch information
Wohlstand committed Mar 25, 2020
1 parent e8198d6 commit 3f9096f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/codecs/load_voc.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,13 @@ static int voc_get_block(SDL_RWops *src, vs_t *v, SDL_AudioSpec *spec)
if (SDL_RWread(src, &uc, sizeof (uc), 1) != 1)
return 0;

spec->channels = uc ? 2 /* Stereo */: 1; /* Mono */
if (uc == 255)
{
SDL_SetError("VOC Extended has an invalid channels number");
return 0;
}

spec->channels = uc + 1; /* 0 - Mono, 1 - Stereo*/

/* Needed number of channels before finishing
compute for rate */
Expand Down

0 comments on commit 3f9096f

Please sign in to comment.