Giter Site home page Giter Site logo

Comments (12)

Wohlstand avatar Wohlstand commented on June 3, 2024

Okay, just now I made a fix, it should work fine ๐ŸฆŠ (at my end it now works ๐Ÿค”)
@sezero , can you verify this? Is this a good fix?
e8198d6

from sdl-mixer-x.

sezero avatar sezero commented on June 3, 2024

If spec->channels is zero without this (didn't follow the code much), then the fix seems correct.

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

After a small digging of the code, the spec begins at here:
https://github.com/WohlSoft/SDL-Mixer-X/blob/master/src/mixer.c#L715
And it seems uninitialized.

Next time it gets be initialized with zeros:
https://github.com/WohlSoft/SDL-Mixer-X/blob/master/src/codecs/load_voc.c#L390

Then I see an attempt to initialize it:
https://github.com/WohlSoft/SDL-Mixer-X/blob/master/src/codecs/load_voc.c#L401-L402

However, as we can see, when VOC file does use of VOC_EXTENDED, it gives a zero value, lemme debug that to confirm...

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

Aha! I see https://github.com/WohlSoft/SDL-Mixer-X/blob/master/src/codecs/load_voc.c#L392-L393
The reason why is zero - because VOC_EXTENDED gets be read before spec->channels will be initialized.
However, the channels number should be here "uc + 1" regaring to this spec:
https://wiki.multimedia.cx/index.php?title=Creative_Voice#Block_type_0x08:_Extra_info

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

@sezero, I did a new fix, it should be better now.

from sdl-mixer-x.

sezero avatar sezero commented on June 3, 2024

@sezero, I did a new fix, it should be better now.

It is overdoing it: are there really voc files with more than 2 chans?
(I don't think so.) The first fix seems more simple / straightforward,
it is what https://bugzilla.libsdl.org/show_bug.cgi?id=4604 recommends
too.

from sdl-mixer-x.

sezero avatar sezero commented on June 3, 2024

I plan on doing something limke the following in mainstream

diff --git a/src/codecs/load_voc.c b/src/codecs/load_voc.c
--- a/src/codecs/load_voc.c
+++ b/src/codecs/load_voc.c
@@ -289,6 +289,7 @@ static int voc_get_block(SDL_RWops *src,
 
                 if (uc)
                     spec->channels = 2;  /* Stereo */
+                else spec->channels = 1; /* VOC_EXTENDED may be read before spec->channels is initialized */
                 /* Needed number of channels before finishing
                    compute for rate */
                 spec->freq = (256000000L/(65536L - v->rate))/spec->channels;

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

It is overdoing it: are there really voc files with more than 2 chans?

Idk, however, the specification of VOC allows that. Just for a case, I would like to follow the specification to don't return this question if some multichannel VOC files will be found and the "multichannel VOC files playing incorrectly" issue will be reported in the future. However, a small tune and making of necessary comments would be good ๐ŸฆŠ

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

btw, VLC does the same as me: https://github.com/videolan/vlc/blob/master/modules/demux/voc.c#L313
however, it does invalidating of VOC files when channels count is more than 32.

from sdl-mixer-x.

sezero avatar sezero commented on June 3, 2024

From the spec, top paragraph:
The VOC file format was created by Creative and is generally associated with their 8-bit line of cards (Sound Blaster, Sound Blaster Pro). While initially limited to unsigned 8-bit PCM and ADPCM data, the VOC format was eventually expanded to handle 16-bit formats with the introduction of Creative's 16-bit cards, as well as a-law and u-law companded formats.

Obviously, multichannel voc files should not have been in mind at the time. So, I am not comfortable with your second solution.

btw, VLC does the same as me: https://github.com/videolan/vlc/blob/master/modules/demux/voc.c#L313
however, it does invalidating of VOC files when channels count is more than 32.

Can it be that 32 is the max number of channels vlc allows globally for anything?? (don't know vlc internals.)

from sdl-mixer-x.

Wohlstand avatar Wohlstand commented on June 3, 2024

Can it be that 32 is the max number of channels vlc allows globally for anything?? (don't know vlc internals.)

By the first look, it can output 6/8 channels maximum, but depend on the output API. I guess if that globally, the macro or global variable should be referred, however, here is a local magic number.

Obviously, multichannel voc files should not have been in mind at the time.

However, yeah if that. The first solution is fine.

from sdl-mixer-x.

sezero avatar sezero commented on June 3, 2024

Fixed in mainstream by http://hg.libsdl.org/SDL_mixer/rev/037c22bc945d

from sdl-mixer-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.