diff --git a/README.md b/README.md index 0c8a297..f933823 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ The exported video is compressed using the h264 codec. This codec does not allow ## change log +* 0.1.8 - April 17th, 2017 + * Switch server url to https (attempt to solve broken installation inside the IDE) * 0.1.7 - April 1st, 2017 * Setting are now saved in the libray folder. Using the Java Preferences was giving errors on some Windows versions. diff --git a/examples/withAudioViz/withAudioViz.pde b/examples/withAudioViz/withAudioViz.pde index ebb52a1..8a1b877 100644 --- a/examples/withAudioViz/withAudioViz.pde +++ b/examples/withAudioViz/withAudioViz.pde @@ -5,10 +5,11 @@ import ddf.minim.spi.*; VideoExport videoExport; +String audioFilePath = "jingle.mp3"; + String SEP = "|"; float movieFPS = 30; float frameDuration = 1 / movieFPS; -float movieTime = 0; BufferedReader reader; void setup() { @@ -24,15 +25,15 @@ void setup() { // experimentation. Otherwise every time you // run this program it re-generates the FFT // analysis. - audioToTextFile("jingle.mp3"); + audioToTextFile(audioFilePath); // Open the text file we just created for reading - reader = createReader("jingle.mp3.txt"); + reader = createReader(audioFilePath + ".txt"); // Set up the video exporting videoExport = new VideoExport(this); videoExport.setFrameRate(movieFPS); - videoExport.setAudioFileName("jingle.mp3"); + videoExport.setAudioFileName(audioFilePath); videoExport.startMovie(); } void draw() { @@ -66,7 +67,7 @@ void draw() { // I added an offset of half frame duration, // but I'm not sure if it's useful nor what // would be the ideal value. Please experiment :) - while (movieTime < soundTime + frameDuration * 0.5) { + while (videoExport.getCurrentTime() < soundTime + frameDuration * 0.5) { background(0); noStroke(); // Iterate over all our data points (different @@ -91,10 +92,6 @@ void draw() { popMatrix(); } videoExport.saveFrame(); - // Manually increment the movie time. - // In future versions I should add - // something like videoExport.getTime() instead. - movieTime += 1 / movieFPS; } } } diff --git a/resources/build.properties b/resources/build.properties index a7363ed..4d00b71 100644 --- a/resources/build.properties +++ b/resources/build.properties @@ -87,7 +87,7 @@ author.url=http://hamoid.com # Set the web page for your Library. # This is NOT a direct link to where to download it. -library.url=http://funprogramming.org/VideoExport-for-Processing +library.url=https://funprogramming.org/VideoExport-for-Processing # Set the category (or categories) of your Library from the following list: @@ -132,12 +132,12 @@ source.repository=https://github.com/hamoid/VideoExport-for-Processing.git # This is used to compare different versions of the same Library, and check if # an update is available. -library.version=17 +library.version=18 # The version as the user will see it. -library.prettyVersion=0.1.7 +library.prettyVersion=0.1.8 # The min and max revision of Processing compatible with your Library. @@ -155,7 +155,7 @@ compatible.maxRevision=0 # against. This information is only used in the generated webpage. tested.platform=osx,linux,windows -tested.processingVersion=3.2.3 +tested.processingVersion=3.3.0 # Additional information for the generated webpage. diff --git a/src/com/hamoid/VideoExport.java b/src/com/hamoid/VideoExport.java index cd7642f..f640816 100644 --- a/src/com/hamoid/VideoExport.java +++ b/src/com/hamoid/VideoExport.java @@ -355,6 +355,33 @@ protected void initialize() { } } + /** + * Call this function to figure out how many frames your movie has so far. + * + * @return the number of frames added to the movie so far + */ + public int getCurrentFrame() { + return frameCount; + } + + /** + * You could use the returned value to display a time counter, a progress + * bar or to create periodic motion, for instance by feeding + * the returned value into the sin() function, and using the result to drive + * the position of an object. + * + * @return the duration of the movie (so far) in seconds + */ + public float getCurrentTime() { + return frameCount / ffmpegFrameRate; + } + + /** + * Call this if you need to figure out the path to the ffmpeg program + * (advanced). + * + * @return the path to the ffmpeg program as a String + */ public String getFfmpegPath() { return settings.getString(SETTINGS_FFMPEG_PATH, FFMPEG_PATH_UNSET); }