From d03751db520faeb80d97f273dc7bc896886c33ca Mon Sep 17 00:00:00 2001 From: Jaromil Date: Sat, 3 May 2008 14:12:41 +0200 Subject: [PATCH] documentation of GoomLayer, new example script using ImageLayer, Vertigo filter and AudioJack, --- doc/scripting/AudioCollector.js | 7 ++- doc/scripting/FreejScripting.js | 8 ++- doc/scripting/GoomLayer.js | 104 ++++++++++++++++++++++++++++++++ doc/scripting/makefile | 3 +- scripts/freej_equalizer.js | 54 +++++++++++++++++ 5 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 doc/scripting/GoomLayer.js create mode 100644 scripts/freej_equalizer.js diff --git a/doc/scripting/AudioCollector.js b/doc/scripting/AudioCollector.js index 11a03444..41fd805a 100644 --- a/doc/scripting/AudioCollector.js +++ b/doc/scripting/AudioCollector.js @@ -5,13 +5,17 @@ nor is it intended to fulfill any specific purpose apart from generating documentation @author Jaromil - @version 1.0 + @version $Id: $ */ /////////////////////////////////////////////////// /////// AUDIO COLLECTOR /** + This constructor instantiates an AudioJack collector for Jack + + @class The Audio Jack class collects audio and analizes it for use in parameters +
This object collects audio from a Jack source, it can be used to @@ -55,7 +59,6 @@ }
- @class The Audio Jack class collects audio and analizes it for use in parameters @author Dave Griffiths, Jaromil @constructor @param {string} jack_port an input name like "alsa_pcm:input_1", see jack connections diff --git a/doc/scripting/FreejScripting.js b/doc/scripting/FreejScripting.js index e7e738f8..e40e2f17 100644 --- a/doc/scripting/FreejScripting.js +++ b/doc/scripting/FreejScripting.js @@ -118,7 +118,7 @@ ImageLayer.prototype.open = open; /** The Particle Generator constructor is used to create new instances of this layer - @class The Particle Generator will compute and display shiny and moving particles + @class The Particle Generator will compute and display shiny moving particles @author Jaromil @constructor @returns a new allocated Particle Generator Layer @@ -200,6 +200,8 @@ TextLayer.prototype.size = size; function calculate_size(string) { }; TextLayer.prototype.calculate_size = calculate_size; + + /////////////////////////////////////////////////// // MOVIE LAYER @@ -213,10 +215,14 @@ TextLayer.prototype.calculate_size = calculate_size; function MovieLayer() { }; MovieLayer.prototype = new Layer(); +/////////////////////////////////////////////////// +// FLASH LAYER function FlashLayer() { }; FlashLayer.prototype = new Layer(); +/////////////////////////////////////////////////// +// CAMERA LAYER function CamLayer() { }; CamLayer.prototype = new Layer(); diff --git a/doc/scripting/GoomLayer.js b/doc/scripting/GoomLayer.js new file mode 100644 index 00000000..255cfd9f --- /dev/null +++ b/doc/scripting/GoomLayer.js @@ -0,0 +1,104 @@ +/** This file is intended solely for being parsed by JSDoc + to produce documentation for the FreeJ's Javascript API + it is not a script you can run into FreeJ + it is not intended to be an example of good JavaScript OO-programming, + nor is it intended to fulfill any specific purpose apart from generating documentation + + @author Jaromil + @version $Id: $ +*/ + +/////////////////////////////////////////////////// +// GOOM LAYER + +/** The Goom Layer constructor is user to create a new instance of Goom + @class The GoomLayer is drawing a trippy oscilloscope that reacts + to the sound output of an Audio collector, the result can be + controlled via various parameters. + +
Example: + // create the audio collector + // args: jack_port, samplesize, samplerate + audio = new AudioJack("xine:out_l", 2048, 44100); + + // create the Goom layer + goom = new GoomLayer(); + + // connect the audio output to the goom layer + audio.add_output(goom); + + // as goom starts, it will call AudioCollector::fft() internally at + // every new frame + goom.start(); + + // add the layer to the screen + add_layer(goom); +
+ + This layer needs more documentation: the methods below are not + fully tested, if you use it please contribute a better description + for the behaviour of each method. + + @author Jean-Christophe Hoelt (ios-software), Jaromil + @constructor + @returns a new allocated Goom Layer +*/ +function GoomLayer() { }; + +/** + Change the Goom mode + @param {int} modenum mode number */ +function mode(modenum) { }; +GoomLayer.prototype.mode = mode; + +/** + Set the middle point + @param x horizontal coordinate + @param y vertical coordinate +*/ +function middle(x,y) { }; +GoomLayer.prototype.middle = middle; + +/** + Reverse the Goom + @param n reverse number +*/ +function reverse(n) { }; +GoomLayer.prototype.reverse = reverse; + +/** + Change Goom speed + @param speed speed value +*/ +function speed(speed) { }; +GoomLayer.prototype.speed = speed; + +/** + Shift the Goom plane + @param x horizontal coordinate + @param y vertical coordinate +*/ +function plane(x,y) { }; +GoomLayer.prototype.plane = plane; + +/** + Set the Goom wave + @param waveval value of wave height +*/ +function wave(waveval) { }; +GoomLayer.prototype.wave = wave; + +/** + Set the Goom hypercosine value + @param hyperval value for the hypercosine transformations +*/ +function hypercos(hyperval) { }; +GoomLayer.prototype.hypercos = hypercos; + +/** + Set the level of noise in Goom + @param noiselevel level of noise in Goom +*/ +function noise(noiselevel) { }; +GoomLayer.prototype.noise = noise; + diff --git a/doc/scripting/makefile b/doc/scripting/makefile index 395e4e85..e42b290f 100644 --- a/doc/scripting/makefile +++ b/doc/scripting/makefile @@ -7,7 +7,8 @@ all: GeometryLayer.js \ Controller.js \ VideoEncoder.js \ - AudioCollector.js + AudioCollector.js \ + GoomLayer.js \ cp -a images html clean: diff --git a/scripts/freej_equalizer.js b/scripts/freej_equalizer.js new file mode 100644 index 00000000..b7a02e9a --- /dev/null +++ b/scripts/freej_equalizer.js @@ -0,0 +1,54 @@ +// simple audio test reading out harmonics +// make sure jack is running and have a look at the connections +// also check the values (samplesize and samplerate) to match your conf +// -jrml + +//set_resolution(W,H); + +audio = new AudioJack("xine/out_1", 2048, 44100); + +img = new ImageLayer(); +img.open("../doc/ipernav.png"); +img.activate(true); +img.set_fps(); +img.start(); +add_layer(img); +vtg = new Filter("vertigo"); +img.add_filter(vtg); + +kbd = new KeyboardController(); +register_controller(kbd); +kbd.released_q = function() { quit(); } +kbd.released_r = function() { + if(reset("freej_equalizer.js")) { + rem_controller(this); + echo("reset ok"); + } + return true; +} + +bang = new TriggerController(); +bang.frame = function() { + + audio.fft(); + + flash = 0; + phase = (((audio.get_harmonic(8) + + audio.get_harmonic(1) ) + / 2 ) + * 3 ) / 128; + if(phase<1) phase = 0; + zoom = (((audio.get_harmonic(8) + + audio.get_harmonic(16) ) + / 2 ) + * 3 ) / 64; + zoom = (audio.get_harmonic(16)*3)/64; + if(zoom<1) zoom = 1; + vtg.set_parameter("PhaseIncrement", phase); + vtg.set_parameter("ZoomRate", zoom); +} + + +register_controller(bang); + +gc();