Comments (6)
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.
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.
How will looping work with InputStream play? I'm guessing I'd still have to manage that myself?
from lx.
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.
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.
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)
- Request: Convert build to Maven or Gradle HOT 3
- Feature request: Add visual aid to heronarts.lx.color.ColorParameter HOT 8
- Delete Channel undo selection state HOT 1
- APC40 out of sync on channel add/delete HOT 1
- Tempo bug with OSC clocksource HOT 4
- LXMasterBus has an empty model, breaking effects on the master bus HOT 3
- tempoLocked Click will never .click() HOT 1
- Colloquial way to link LX build w/ LXStudio HOT 11
- Setting OSC address for parameters? HOT 4
- Preferred way to build a model programmatically these days? HOT 4
- LXChannel.transitionTimeSecs has lowest level of 100ms HOT 1
- Storing more than 5 clips in a channel? HOT 3
- How to wait until mixer setup is complete? (LXMixer & LXChannels) HOT 1
- DDP packet size HOT 6
- Gradients using HSV2 blendMode can get jumpy when combined with oscillating colors HOT 3
- Intermittent LXAudioInput bug: 'Cannot enter synchronized block because "this.inputThread" is null' HOT 7
- /lx/tempo/beat OSC messages sending when OSC output is disabled HOT 1
- Bug in Accumulator modulator: goes infinite loop when velocity is zero HOT 2
- Views created in UI aren't saved to LXP file (disappear next time project is opened) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lx.