Giter Site home page Giter Site logo

Comments (6)

sbooth avatar sbooth commented on May 20, 2024

I recently changed the default behavior so that decoders are no longer automatically opened when they are created. There is a static method in AudioDecoder that can be used to set whether or not decoders should be automatically opened, or they can be opened by calling Open() directly. I think that your first problem scenario could be resolved by calling Open() before you enqueue the decoder.

I'll have to investigate the second scenario a little bit more.

from sfbaudioengine.

indragiek avatar indragiek commented on May 20, 2024

Thanks for the reply. Calling AudioDecoder::SetAutomaticallyOpenDecoders(true); seems to have fixed both issues for the most part, but I'm still experiencing some (random) playback issues where if I enqueue a decoder and immediately call Play(), there is no audio and I have to call Play() a second time.

from sfbaudioengine.

sbooth avatar sbooth commented on May 20, 2024

This is not totally unexpected behavior, because if the decoding thread hasn't had time to begin decoding before you call Play() the player will automatically stop itself. This behavior is not ideal, but since I don't want to lock the player for an indeterminate amount of time in Enqueue() it's the compromise I made. One way around this is to add a decoding started callback to your decoder, and call Play() when that callback is invoked. This will ensure that the player will have audio and that it won't stop itself.

from sfbaudioengine.

indragiek avatar indragiek commented on May 20, 2024

This does work, but there's a minor problem. The rendering started callback is actually never called unless Play() is called first. To work around this, I call Play() immediately after enqueueing, and then I call it again in the renderingStarted callback for good measure. It might be nice to add another callback for when the data has begun decoding and is ready to play, but hasn't actually started playing yet.

EDIT: After further testing, it seems that the issue is still there even with this workaround

from sfbaudioengine.

sbooth avatar sbooth commented on May 20, 2024

You need to add a decoding started callback. The decoding started callback is called once the decoding thread begins decoding the audio. It will be called regardless of the player's state after a track has been enqueued.

from sfbaudioengine.

indragiek avatar indragiek commented on May 20, 2024

Thanks Stephen, I got mixed up between the rendering and decoding callbacks. This works great, thank you.

from sfbaudioengine.

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.