Major API change, use `draw()` in place of `frame()`
This commit is contained in:
parent
a86d622da8
commit
f03766dbd2
13
README.md
13
README.md
|
@ -36,6 +36,17 @@ void setup() {
|
|||
}
|
||||
|
||||
void draw () {
|
||||
soundtrack.frame(0, 0);
|
||||
soundtrack.draw(0, 0);
|
||||
}
|
||||
```
|
||||
|
||||
### Alternate usage
|
||||
|
||||
Use the `frame(int x, int y, int frameNumber)` method to draw specific frames--used for laying out multiple frames of soundtrack on a single screen.
|
||||
|
||||
```java
|
||||
void draw () {
|
||||
soundtrack.frame(0, 0, frameCount);
|
||||
}
|
||||
|
||||
```
|
||||
|
|
|
@ -19,7 +19,7 @@ void setup() {
|
|||
|
||||
void draw () {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
soundtracks[i].frame(i * 213, 0);
|
||||
soundtracks[i].draw(i * 213, 0);
|
||||
}
|
||||
|
||||
stroke(255, 0, 0);
|
||||
|
|
|
@ -11,7 +11,7 @@ String pitch = "long"; //whether the film is "long" or "sh
|
|||
boolean positive = true; //whether the film is positive or negative
|
||||
|
||||
void setup() {
|
||||
size(213, 620, P2D); //this will perfectly fill the frame with the soundtrack @ 2400DPI
|
||||
size(213, 620); //this will perfectly fill the frame with the soundtrack @ 2400DPI
|
||||
//must run in P2D or P2D (acheives realtime playback easier)
|
||||
|
||||
frameRate(24); //this will playback at realtime speed
|
||||
|
@ -19,5 +19,5 @@ void setup() {
|
|||
}
|
||||
|
||||
void draw () {
|
||||
soundtrack.frame(0, 0);
|
||||
soundtrack.draw(0, 0);
|
||||
}
|
|
@ -21,5 +21,5 @@ void setup() {
|
|||
}
|
||||
|
||||
void draw () {
|
||||
soundtrack.frame(0, 0);
|
||||
soundtrack.draw(0, 0);
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
name = SoundtrackOptical
|
||||
authors = [Matthew McWilliams](https://sixteenmillimeter.com)
|
||||
url = https://github.com/sixteenmillimeter/optical_soundtrack_processing
|
||||
url = https://github.com/sixteenmillimeter/SoundtrackOptical
|
||||
categories = "Animation,Sound,Video & Vision"
|
||||
sentence = Framework for generating 16mm optical soundtracks from a digital audio file.
|
||||
paragraph = Create optical soundtracks in different styles to be used in super16 film-out
|
||||
version = 1
|
||||
prettyVersion = 0.01a
|
||||
#minRevision = 0
|
||||
#maxRevision = 1
|
||||
version = 2
|
||||
prettyVersion = 0.02a
|
||||
minRevision = 2
|
||||
#maxRevision = 2
|
||||
|
|
Binary file not shown.
|
@ -39,6 +39,19 @@ public class SoundtrackOptical {
|
|||
PGraphics raw;
|
||||
PApplet parent;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
*
|
||||
* @param parent {PApplet} Parent process (usually this)
|
||||
* @param soundtrackFile {String} Path to soundtrackFile
|
||||
* @param dpi {Integer} Target DPI of printer
|
||||
* @param volume {Float} Volume of output soundtrack, 0 to 1.0
|
||||
* @param type {String} Type of soundtrack either "unilateral", "variable area", "dual variable area", "multiple variable area", "variable density"
|
||||
* @param pitch {String} Pitch of the film, either "long" for projection or "short" for camera stock
|
||||
* @param positive {Boolean} Whether or not soundtrack is positive or negative
|
||||
*/
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public SoundtrackOptical (PApplet parent, String soundtrackFile, int dpi, float volume, String type, String pitch, boolean positive ) {
|
||||
this.parent = parent;
|
||||
|
@ -62,7 +75,7 @@ public class SoundtrackOptical {
|
|||
FRAMES = (int) Math.ceil(soundfile.frames() / RAW_FRAME_H);
|
||||
|
||||
frameSample = new float[RAW_FRAME_H];
|
||||
raw = parent.createGraphics(RAW_FRAME_W, RAW_FRAME_H, parent.P2D);
|
||||
raw = parent.createGraphics(RAW_FRAME_W, RAW_FRAME_H);//mode option?
|
||||
|
||||
|
||||
for (int x = 0; x < soundfile.frames(); x++) {
|
||||
|
@ -75,8 +88,16 @@ public class SoundtrackOptical {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void draw (int X, int Y) {
|
||||
frame(X, Y, parent.frameCount);
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void frame(int X, int Y) {
|
||||
public void frame(int X, int Y, int frameNumber) {
|
||||
if (frameNumber != -1) {
|
||||
i = frameNumber;
|
||||
}
|
||||
if (i >= FRAMES) {
|
||||
return;
|
||||
}
|
||||
|
@ -122,7 +143,9 @@ public class SoundtrackOptical {
|
|||
}
|
||||
raw.endDraw();
|
||||
parent.image(raw, X, Y, DEPTH, FRAME_H_PIXELS);
|
||||
i++;
|
||||
if (frameNumber == -1) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
private void unilateral (int y, int LINE_W) {
|
||||
|
@ -146,7 +169,7 @@ public class SoundtrackOptical {
|
|||
raw.line(LEFT + ((x * RAW_FRAME_W) / 8), y, LEFT + ((x * RAW_FRAME_W) / 8) + (LINE_W / 8), y);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
private void variableDensity(int y) {
|
||||
DENSITY = parent.map(frameSample[y], min, max, (float) 0, 255 * VOLUME);
|
||||
if (POSITIVE) {
|
||||
|
|
Loading…
Reference in New Issue