Giter Site home page Giter Site logo

Factory for SoundBuffer? about labsound HOT 3 CLOSED

labsound avatar labsound commented on May 22, 2024
Factory for SoundBuffer?

from labsound.

Comments (3)

ddiakopoulos avatar ddiakopoulos commented on May 22, 2024

SoundBuffer is a real outlier to the rest of the codebase. I think it reveals an underlying problem there's no concept of an asset. To this end, I agree about the principled use of an asset loader / factory that owns and loans out the underlying resource: a library!

There might be a hybrid approach here. Assuming the use of a string id as a handle:

static std::map<std::string, std::shared_ptr<audio_asset>> asset_library;

I started thinking about this for another project and have a half-working impl here: https://github.com/ddiakopoulos/sandbox/blob/master/virtual-reality/assets.hpp ... I would then add a loader lambda that produces an underlying AudioBuffer instead of the simplistic register_asset(...) that uses an rvalue reference. In theory get_asset(...) could call the lamba to even enable lazy loading (although this is probably not that desirable in the context of realtime audio!)

The asset_library could even be templated on input type (ogg, wav, etc). This would make it maximally-platform independent and even libnyquist could be considered a non-core dependency.

from labsound.

meshula avatar meshula commented on May 22, 2024

That's promising. Your approach is very similar to Pixar's.

https://github.com/PixarAnimationStudios/USD/blob/master/pxr/usd/lib/ar/resolver.h

A resolver class like this could work cleanly with an asset library.

from labsound.

meshula avatar meshula commented on May 22, 2024

This issue is obsoleted by 501ef6c

from labsound.

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.