Old 12-09-2007, 11:51 PM   #1
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 12,571
Default New updated REAPER/JS programming documentation

...is available here:

http://reaper.fm/sdk/js/

-Justin
Justin is online now   Reply With Quote
Old 12-11-2007, 07:51 AM   #2
LOSER
Human being with feelings
 
Join Date: May 2006
Posts: 2,373
Default

Nice, so a menu to instantly reach "Basic Code", "advanced functions", "Special Variables" on every page would be nice. Also "advanced functions" is all in small letters on the buttom of this page http://reaper.fm/sdk/js/basiccode.php while on all other pages it has capital (as all other page references (like Basic Code ...) have).
LOSER is offline   Reply With Quote
Old 02-15-2008, 07:00 AM   #3
Till
Human being with feelings
 
Till's Avatar
 
Join Date: Sep 2006
Location: Germany's California
Posts: 1,541
Default

Quote:
freembuf(top)
The freembuf() function provides a facility for you to notify the memory manager that you are no longer using a portion of the local memory buffer.

For example, if the user changed a parameter on your effect halving your memory requirements, you should use the lowest indices possible, and call this function with the highest index you are using plus 1, i.e. if you are using 128,000 items, you should call freembuf(128001); If you are no longer using any memory, you should call freembuf(0);
if you are using 128,000 items the highest index is 127,999, so you should call freembuf(128000).

am i going nuts or did somebody at cockos make a mistake here?

//EDIT: i'm gonna be nice and use this function but just in case i AM going nuts, i'll use highest index + 2
__________________
Intel Core 2 Quad Q6600 / 2 GB / WinXP Pro SP2 / EMU 0404 USB

"Recording is God's way of telling you that you suck." - Bob Brozman

My Jesusonic FX - Xenakios' Extension

REAPER FR Tracker - what is that?

The "How Stuff works in REAPER": video blog

Last edited by Till; 02-15-2008 at 07:02 AM.
Till is offline   Reply With Quote
Old 05-28-2008, 01:02 PM   #4
Aedus
Human being with feelings
 
Aedus's Avatar
 
Join Date: May 2008
Posts: 11
Default JS programming in windows help format

Hi,
I've compiled the js documentation in a chm / windows help format for my comfort. If someone find it useful I gladly share it.



Aedus

Updated 5 30 2008.
Attached Files
File Type: zip reaper_js_guide.zip (63.2 KB, 1377 views)

Last edited by Aedus; 07-23-2008 at 01:43 AM.
Aedus is offline   Reply With Quote
Old 08-18-2008, 08:39 PM   #5
Guod3
Human being with feelings
 
Guod3's Avatar
 
Join Date: Jan 2008
Posts: 506
Default

I cant stand letting a robot have the last say!
Guod3 is offline   Reply With Quote
Old 12-02-2008, 08:18 AM   #6
Joystick
Human being with feelings
 
Joystick's Avatar
 
Join Date: Jul 2008
Location: Athens / Greece
Posts: 447
Default

Thanks Aedus, that's very helpful!

Take care,

Panoz
__________________
Animating the air with sound. Using science, art, design, engineering and intuition.
www.soundfellas.com
Joystick is offline   Reply With Quote
Old 07-04-2009, 02:21 PM   #7
MisterToast
Human being with feelings
 
Join Date: Jul 2009
Posts: 10
Default

Quote:
Originally Posted by Justin View Post
...is available here:

http://reaper.fm/sdk/js/

-Justin
One thing I missed as a newbie (just started a thread about it)--there should probably be a section about the format of the sample data I'll be seeing. What is the range? Always stereo? Do I have a pointer to it? Is it an array to me in JS?

Maybe one little fully commented simple filter plug would suffice.

Edit: On second reading, I found a mention of the range in the Special Variables" section. I must have glossed over that section in my fist reading.

Maybe what I'm looking for is a tutorial. I suppose I could write one as I make my way. :-)

Last edited by MisterToast; 07-05-2009 at 09:16 AM.
MisterToast is offline   Reply With Quote
Old 10-25-2010, 02:56 AM   #8
Reflected
Human being with feelings
 
Reflected's Avatar
 
Join Date: Jul 2009
Posts: 2,190
Default

Can someone update it?

ps- middle button and mousewheel available in js already?
__________________
Thanks devs for adding the abillity to use single click to change a single velocity And single right click to remove a single note without dragging.
much appreciated.
Reflected is offline   Reply With Quote
Old 11-11-2010, 10:58 AM   #9
Bernstraw
Human being with feelings
 
Join Date: Sep 2010
Posts: 388
Default

Here's what I found was missing or wasn't clear enough for me in the doc - for the sake of future JS users :

1) Sliders.

a. You can define up to 64 sliders from slider1 to slider64.
b. Slider values can also be accessed with a variable index : slider(1), slider(2), ... slider(variable).
Code:
i=1; loop(64, x+=slider(i) ; i+=1);
c. You can make sliders invisible in the default interface by adding "- " before their name :
Code:
@slider

slider1:0<0,127,1>control change
slider2:0<0,127,1>- X coordinate
slider3:0<0,127,1>- Y coordinate

// Only the first slider will be visible in the default interface.
// You can create your own graphical user interface to use slider2 and slider3.
***

2) Arrays.

There is only one array available, its index goes from 0 to 8388607.
You have to define in @init where your sub-arrays will be located (their offset) in this big array.

Code:
0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 ... 8388607
\____ Xcoord ____/\____ Ycoord ____/\_____ next_array _____/
* Xcoord[...] starts at index 0 and has 6 slots.
* Ycoord[...] will have to start at index 6 and is also 6 slots long.
* next_array[...] (8 slots) starts at 12.

Here's how to do it :
Code:
@init

Xcoord = 0 ;
Ycoord = 6 ;
next_array = 12 ; // offset is given by the size of previous arrays.


@ block

// You can now use them like normal arrays.

i = 0 ;
loop(6,
     Xcoord[i] = 16*i ;
     Ycoord[i] = rand(128) ;
     i+=1 ;
);
next_array[0] = rand(16);
More in these threads :
js arrays
Can anyone explain this code to me?
a memory allocation question

***

3) @gfx glitches.

For loops (and other situations) never use the same index/variable in @gfx and @sample (or @block).

Example : this code will result in graphical glitches :
Code:
@block // audio processing

i=0;
loop(32, x[i]=spl(i); i+=1);

@gfx // graphic processing

i=0;
loop(16, gfx_drawnumber(my_data[i],0); i+=1);
It is stated in the doc that the @gfx section runs in a separate thread from @block and @sample so the variable i can be modified in @block and in @gfx concurrently.
You have to use 2 different variables, i and ii for example :

Code:
@block // audio processing

i=0;
loop(32, x[i]=spl(i); i+=1);

@gfx // graphic processing

ii=0;
loop(16, gfx_drawnumber( my_data[ii] , 0); ii+=1);
Read this thread :
Help : graphical glitches in my JS

***

4) Mouse clicks.

List of all possible values for mouse_cap :



***

5) JS font.

List of all available characters :



***
Bernstraw is offline   Reply With Quote
Old 11-11-2010, 11:20 AM   #10
mabian
Human being with feelings
 
mabian's Avatar
 
Join Date: Aug 2007
Location: Italy
Posts: 3,609
Default

WOW; thanks a lot, this is unvaluable info!!!!!

- Mario
__________________
My DAW: Intel i7700k @4.2GHz / 16GB RAM / RME Fireface UC / 250GB SSD / 2x2TB HD / Win10x64
My Music: http://www.reverbnation.com/errepici - http://www.errepici.it/web/contents.asp?sec=4
mabian is offline   Reply With Quote
Old 02-07-2011, 07:10 PM   #11
danielz
Human being with feelings
 
Join Date: Feb 2011
Posts: 2
Default Does js file structure still work as described in the doc??

Hi

I used the built in script editor of Reaper ("edit" button clicked in FX window) to change an existing js Midi effect. My changed version of "midi_note_filter" now filters away the unwanted "All Notes Off" messages generated by my Roland D50 keyboard.

Instead of changing an existing effect I'd prefer to create a copy and edit the copy. However this does not work. If I add a new effect file into the Reaper sub-directory C:\Programs\REAPER\InstallData\Effects\MIDI and restart reaper the new effect does not appear in the "add fx to" screen. What did I miss? I am clueless.. any hints would be very much appreciated!

best regards
daniel
danielz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.