Created
March 25, 2014 16:18
-
-
Save lossius/9765374 to your computer and use it in GitHub Desktop.
Reaper JSFX gfx_arc issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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