Giter VIP home page Giter VIP logo

Comments (2)

devongovett avatar devongovett commented on July 1, 2024

Are there errors compiling or is does it compile without errors, but it's just missing the encoding functions? Sounds like the latter.

Emscripten strips out functions that aren't used, so you have to explicitly tell it what functions to include. In my compile script for vorbis, I set EXPORTED_FUNCTIONS to the list of functions in the vorbis.c wrapper that I wrote. This in turn includes any functions I use from libvorbis.

There are two ways to go about what you want to do. The first is to extend the wrapper to include a VorbisEncode function in C-land, which wraps the vorbis library. The second way is to use the vorbis functions directly from JavaScript. I chose the first way for decoding, and found it much simpler especially with all the pointers that need to get thrown around, which is just not easy in JS/Emscripten land.

So to summarize, I suggest you write a VorbisEncode function in the vorbis.c wrapper to do the actual encoding of some input data that you pass via JavaScript (see vorbis.js for examples), and include it in EXPORTED_FUNCTIONS in the compile script. Let me know if you get it working, would be cool to see a demo. Good luck!

from ogg.js.

shovon avatar shovon commented on July 1, 2024

So to summarize, I suggest you write a VorbisEncode function in the vorbis.c wrapper to do the actual encoding of some input data that you pass via JavaScript (see vorbis.js for examples), and include it in EXPORTED_FUNCTIONS in the compile script.

That's what I did, but it didn't work. In fact, your solution would have only solved the fact that Emscripten can't figure out which subroutine to access when the JavaScript consumer of the API requests it.

My error is different. The compiler only had the declaration (i.e. the function prototype in the .h files), but never did it have the definition of the function (i.e. the function signature and function body in .c files).

However, I did find a solution. I had to tell the compiler which .c file has our missing function definition. This gets rid of our "missing function" error.

But I'm now left with another error. I'm not sure if it's the compiler that isn't able to link the right code, or is it my bad coding skills.

The only thing left for me to do, is take baby steps. For this one project of mine, I was too ambitious, to a point where I have no clue what errors are coming from where.

So anyways, I'm closing this issue, but don't think for a second that I am not interested in figuring out how to encode audio. Especially, if you are also very enthusiastic about finding a solution, then I encourage you to keep posting in this thread.

I just wanted to have a public space to discuss about a potential solution for an audio encoder. GitHub issues seem to be ideal, regardless of the status of a thread (be it open or closed).

Anyways, thanks for your response.

from ogg.js.

Related Issues (11)

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.