Run in P2D mode. Much more efficient using OpenGL.

This commit is contained in:
litter 2019-10-29 10:35:54 -04:00
parent 259a7a2157
commit e3ab7134d4
4 changed files with 6 additions and 5 deletions

View File

@ -11,9 +11,10 @@ String pitch = "long"; //whether the film is "long" or "sh
boolean positive = true; //whether the film is positive or negative boolean positive = true; //whether the film is positive or negative
void setup() { void setup() {
size(213, 620); //this will perfectly fill the frame with the soundtrack @ 2400DPI size(213, 620, P2D); //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 frameRate(24); //this will playback at realtime speed
soundtrack = new SoundtrackOptical(this, soundtrackFile, dpi, volume, type, pitch, positive); soundtrack = new SoundtrackOptical(this, soundtrackFile, dpi, volume, type, pitch, positive);
} }

View File

@ -12,12 +12,12 @@ String pitch = "long";
boolean positive = true; boolean positive = true;
void setup() { void setup() {
size(213, 620); size(213, 620, P2D);
frameRate(24); frameRate(24);
soundtrack = new SoundtrackOptical(this, soundtrackFile, dpi, volume, type, pitch, positive); soundtrack = new SoundtrackOptical(this, soundtrackFile, dpi, volume, type, pitch, positive);
playback = new SoundFile(this, soundtrackFile); playback = new SoundFile(this, soundtrackFile);
playback.play(); playback.play(); //playback alongside image
} }
void draw () { void draw () {

Binary file not shown.

View File

@ -63,7 +63,7 @@ public class SoundtrackOptical {
FRAMES = (int) Math.ceil(soundfile.frames() / RAW_FRAME_H); FRAMES = (int) Math.ceil(soundfile.frames() / RAW_FRAME_H);
frameSample = new float[RAW_FRAME_H]; frameSample = new float[RAW_FRAME_H];
raw = parent.createGraphics(RAW_FRAME_W, RAW_FRAME_H); raw = parent.createGraphics(RAW_FRAME_W, RAW_FRAME_H, parent.P2D);
for (int x = 0; x < soundfile.frames(); x++) { for (int x = 0; x < soundfile.frames(); x++) {