Coder Social home page Coder Social logo

Comments (6)

mcslee avatar mcslee commented on August 23, 2024

Done here: b04cadf

I also just made the setInputStream() methods public, so if you want to use an InputStream programmatically to play audio, you can.

Just note that it won't be saved in the project file.

from lx.

mcslee avatar mcslee commented on August 23, 2024

Also, FYI, you can get the mediaPath from your P3LX / LXStudio instance:
https://github.com/heronarts/P3LX/blob/master/src/heronarts/p3lx/P3LX.java#L112

What you really want is applet.sketchPath - but the design pattern here uses setMediaPath() on the LXAudioOutput so that the LX library can be 100% free of dependencies upon P3LX.

I should perhaps consider cleaning this up so that there is a mediaPath on the root LX object, and then P3LX could just override that... something to think about.

But this should sort you out for the time being.

from lx.

ssilverman avatar ssilverman commented on August 23, 2024

How will looping work with InputStream play? I'm guessing I'd still have to manage that myself?

from lx.

mcslee avatar mcslee commented on August 23, 2024

Can't 100% guarantee you what will happen there. Depends upon the type of input stream.

This is what will be attempted:

Trigger will be set to true
https://github.com/heronarts/LX/blob/master/src/heronarts/lx/audio/LXAudioOutput.java#L131

Then the InputStream will try to be reset()
https://github.com/heronarts/LX/blob/master/src/heronarts/lx/audio/LXAudioOutput.java#L114

If your input stream doesn't support marking and reseting, it won't work and will print an error.

Just curious - what are you doing here? What is the input stream that you're reading from? Or are you generating one? It sounded like originally you were reading it into a File for playback, which suggested the stream was already available in its entirety (from somewhere). Or were you also writing the file in real-time while playing it back?

from lx.

ssilverman avatar ssilverman commented on August 23, 2024

I'm using resources from the project's pre-compiled JAR. The project doesn't run from a directory. Because LXAudioOutput only uses a File as input, I had to copy the audio file into a temporary file.

In fact, I have to take this approach anywhere a File is assumed in the API.

from lx.

mcslee avatar mcslee commented on August 23, 2024

Ah gotcha - that makes sense. You can see if the InputStream method works, but copying into a temp file seems like a reasonable enough solution as well.

Let me know if other File spots are really annoying - the only other one I can think of is loading project files.

from lx.

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.