Skip to content

Instantly share code, notes, and snippets.

@lossius
Created March 25, 2014 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lossius/9765374 to your computer and use it in GitHub Desktop.
Save lossius/9765374 to your computer and use it in GitHub Desktop.
Reaper JSFX gfx_arc issue
desc: Cicle arc issue
slider1:180<0,180,1>Spread (mouse)
in_pin:L
in_pin:R
out_pin:L
out_pin:R
/**********************************************************
Updated slider value:
**********************************************************/
@slider
mAzimuth = 0.5 * slider1 * $pi / 180.;
mCosAzi = cos(mAzimuth);
mSinAzi = sin(mAzimuth);
/**********************************************************
Custom graphic interface
**********************************************************/
@gfx 500 500
gCenterX = gfx_w * 0.5;
gCenterY = gfx_h * 0.5;
gCenterX < gCenterY ? gRadius = gCenterX : gRadius = gCenterY;
gRadius = gRadius - 10;
gInverseRadius = 1. / gRadius;
mPosX = gCenterX;
mPosY = gCenterY - 2 * gRadius * mAzimuth / $pi;
gfx_a = 1.;
gfx_r = 1.;
gfx_g = 1.;
gfx_b = 1.;
// Draw arc indicating spread
gfx_arc(gCenterX, gCenterY, gRadius, mAzimuth, -mAzimuth, 1);
gfx_line(gCenterX, gCenterY, gCenterX-mSinAzi*gRadius, gCenterY-mCosAzi*gRadius, 1);
gfx_line(gCenterX, gCenterY, gCenterX+mSinAzi*gRadius, gCenterY-mCosAzi*gRadius, 1);
/**********************************************************
Calculate audio sample
**********************************************************/
@sample
// Just pass through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment