Skip to content

Commit

Permalink
Merge v3 from develop (#12)
Browse files Browse the repository at this point in the history
.
  • Loading branch information
micsthepick authored Feb 29, 2024
1 parent 3d6edf6 commit 15d8bc9
Show file tree
Hide file tree
Showing 18 changed files with 3,126 additions and 471 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report--will-not-load-.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If applicable, add screenshots to help explain your problem.
- Device: [e.g. Samsung Galaxy S 22 Note Plus]
- OS: [e.g. Android 13]
- Host [e.g. RootlessJamesDSP]
- Play store used [e.g. Google Play Store, F-Droid]
- Play store used [e.g. Google Play Store, F-Droid]
- Plugin Version [e.g. 1.0.0]

**Additional context**
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test JSFX

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: ilammy/setup-nasm@v1
- uses: actions/checkout@v4
name: Check out repository code
with:
# Fetches all submodules recursively
submodules: 'recursive'

- name: Compile EEL2 with NO_GFX
run: |
./compile_wdl.sh
- name: Run Tests
run: |
./test_eel.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,6 @@ MigrationBackup/

# Fody - auto-generated XML schema
FodyWeavers.xsd

*.test.eel2
*.test
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "WDL"]
path = WDL
url = https://github.com/justinfrankel/WDL.git
ignore = all
2 changes: 2 additions & 0 deletions EXPERIMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# welcome to experiments
this is where I'm keeping some alternate versions of the plugin.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ It can isolate or attenuate the vocals (center panned audio) in a mix, and as su
### Reaper
Reaper supports JSFX natively, just copy vocalrediso.jsfx to `%AppData%\REAPER\Effects` (In a subfolder if preferred)

### VST compatible DAW (Instructions for windows)
### VST compatible DAW

#### Instructions for windows
JSFX can usually be run in a vst through [ReaPlugs by Cocos](https://www.reaper.fm/reaplugs/).
Download and install ReaPlugs, and pay attention to where it installs.
If you have Reaper installed, ReaPlugs should detect that `%AppData%\REAPER` exists and use that to load JSFX from %AppData%\REAPER\Effects instead of the local copy.
Expand All @@ -19,6 +21,12 @@ Otherwise, ReaPlugs will load effects from `...\ReaPlugs\JS` at the install loca

where \path\to\custom\folder\JS is the path to the JS folder that contains the ColorThemes, Data, Effects and presets folders that you would like ReaJs to use. (For example I run Equalizer APO and when reaper is installed, the audio service tries to load plugins from %AppData%\REAPER\Effects but is denied because of permissions)

#### Other:
try this fork of [ysfx](https://github.com/JoepVanlier/ysfx/).

### JamesDSP
simply load the eel instead of the JSFX. (not eel2)


## Using the effect:

Expand Down
1 change: 1 addition & 0 deletions WDL
Submodule WDL added at 805967
5 changes: 5 additions & 0 deletions compile_wdl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if [ ! -z "$PREFIX" ] && [ "$PREFIX" = "/data/data/com.termux/files/usr" ]; then
# quick hack to enable testing in termux
export CPPFLAGS='-Dpthread_mutexattr_setprotocol(a,b)={} -Wno-unused-but-set-variable'
fi
make -C WDL/WDL/eel2 NO_GFX=1
16 changes: 16 additions & 0 deletions process_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function process_eel_script {
local input_script="$1"
local output_script="$2"
local replace_str="$3" # New argument for the replacement

# Process the second script and append its contents to the output script
sed -r -e "s/\/\/IF${replace_str}|\/\*IF${replace_str}\{|\}IF${replace_str}\*\///" \
"$input_script" > "$output_script"
}

process_eel_script vocalrediso.jsfx-template vocalrediso.test TEST
process_eel_script vocalrediso.jsfx-template vocalrediso.eel EEL
process_eel_script vocalrediso.jsfx-template vocalrediso.jsfx JSFX
process_eel_script vocalredisoBlurry.jsfx-template vocalredisoBlurry.test TEST
process_eel_script vocalredisoBlurry.jsfx-template vocalredisoBlurry.eel EEL
process_eel_script vocalredisoBlurry.jsfx-template vocalredisoBlurry.jsfx JSFX
32 changes: 32 additions & 0 deletions test_eel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ensure latest testing script is available
./process_scripts.sh

# add defines to head of test script
cat testing_defines.eel2 vocalrediso.test > vocalrediso.test.eel2

function run_test {
local test_script="$1"
local test_output

echo "TESTING $1"

# Ensure latest testing script is available
./process_scripts.sh

# Add defines to head of test script
cat testing_defines.eel2 "$test_script" > "${test_script}.eel2"

# Run the test and capture output
test_output=$(./WDL/WDL/eel2/loose_eel "./${test_script}.eel2" 2>&1)
echo "$test_output"

# Get the last line of the output and check for failure
if echo "$test_output" | tail -n 1 | grep -q "^FAILURE"; then
echo "Failed Test Cases, will return -1!"
exit -1
fi
}

# Run tests for each script
run_test vocalrediso.test
run_test vocalredisoBlurry.test
122 changes: 122 additions & 0 deletions testing_defines.eel2
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@

// Helper functions to check for positive infinity, negative infinity, and nan
function is_pos_inf(x) (
(x * 2 == x) && x > 0;
);
function is_neg_inf(x) (
is_pos_inf(-x);
);
function is_nan(x) local(z1, z2) (
z2 = x;
z1 = x + 1;
z2 == 0 && z1 == 0;
);

function assert_equal_exact(expected, actual, message) global(failed_asserts, successful_asserts) (
is_nan(expected) && is_nan(actual) ? successful_asserts += 1 :
(is_pos_inf(expected) && is_pos_inf(actual)) || (is_neg_inf(expected) && is_neg_inf(actual)) ? successful_asserts += 1 :
expected !== actual ? (
fprintf(3, "\033[0;31mexpected: %g, was: %g. %s\033[0m\n", expected, actual, message);
failed_asserts += 1;
) : successful_asserts += 1;
);

function assert_equal_exact(expected, actual) global() (
assert_equal_exact(expected, actual, "values differ!")
);

function assert_near_equal(expected, tolerance, actual, message) global(failed_asserts, successful_asserts) (
is_nan(expected) || is_nan(actual) || is_nan(tolerance) ? successful_asserts += 1 :
(is_pos_inf(expected) || is_neg_inf(expected)) && (is_pos_inf(actual) || is_neg_inf(actual)) ? successful_asserts += 1 :
abs(expected - actual) > tolerance ? (
fprintf(3, "\033[0;31mexpected: %g (±%g), was: %g. %s\033[0m\n", expected, tolerance, actual, message);
failed_asserts += 1;
) : successful_asserts += 1;
);

function assert_near_equal(expected, tolerance, actual) global() (
assert_near_equal(expected, tolerance, actual, "values are not equal within tolerance!")
);

function assert_true(boolean, message) global(failed_asserts, successful_asserts) (
(!boolean) ? (
fprintf(3, "\033[0;31mexpected: true, was: false. %s\033[0m\n", message);
failed_asserts += 1;
) : successful_asserts += 1;
);

function assert_false(boolean, message) global(failed_asserts, successful_asserts) (
boolean ? (
fprintf(3, "\033[0;31mexpected: false, was: true. %s\033[0m\n", message);
failed_asserts += 1;
) : successful_asserts += 1;
);

function assert_true(boolean) global() (
assert_true(boolean, "");
);

function assert_false(boolean) global() (
assert_false(boolean, "");
);

function test_summary() global(failed_asserts successful_asserts) local(total) (
total = failed_asserts + successful_asserts;
failed_asserts === 0 ? fprintf(3, "\033[0;32mAll %d asserts succeeded.\033[0m\n", total) : (
successful_asserts > 0 ? printf("\033[0;34m%d of %d asserts succeeded.\033[0m\n", successful_asserts, total);
failed_asserts > 0 ? (
printf("\033[0;31m%d of %d asserts failed.\nFAILURE, see above!\033[0m\n", failed_asserts, total);
)
)
);

/*
pif = 0;
pif = 1/pif;
nif = 0;
nif = -1/nif;
lg = 2^64;

printf("z/z=%g, pif=%g, nif=%g\n", z/z, pif, nif);

assert_true( is_pos_inf(pif), " +1/0 is +inf");
assert_false(is_neg_inf(pif), " +1/0 is -inf");
assert_false( is_nan(pif), " +1/0 is nan");
assert_false(is_pos_inf(nif), " -1/0 is +inf");
assert_true( is_neg_inf(nif), " -1/0 is -inf");
assert_false( is_nan(nif), " -1/0 is nan");
assert_false(is_pos_inf(z/z), " z/z is +inf");
assert_false(is_neg_inf(z/z), " z/z is -inf");
assert_true( is_nan(z/z), " z/z is nan");
assert_false(is_pos_inf( 0), " 0 is +inf");
assert_false(is_neg_inf( 0), " 0 is -inf");
assert_false( is_nan( 0), " 0 is nan");
assert_false(is_pos_inf( lg), " 2^64 is +inf");
assert_false(is_neg_inf( lg), " 2^64 is -inf");
assert_false( is_nan( lg), " 2^64 is nan");
assert_false(is_pos_inf(-lg), "-2^64 is +inf");
assert_false(is_neg_inf(-lg), "-2^64 is -inf");
assert_false( is_nan(-lg), "-2^64 is nan");
*/

// drop in for spl(channel)
// function spl(channel) (
// 0 == channel ? spl0 :
// 1 == channel ? spl1 :
// 2 == channel ? spl2 :
// 3 == channel ? spl3 :
// 4 == channel ? spl4 :
// 5 == channel ? spl5 :
// 6 == channel ? spl6 :
// 7 == channel ? spl7 :
// 8 == channel ? spl8 :
// 9 == channel ? spl9 :
// 10 == channel ? spl10 :
// 11 == channel ? spl11 :
// 12 == channel ? spl12 :
// 13 == channel ? spl13 :
// 14 == channel ? spl14 :
// 15 == channel ? spl15 :
// 0;
// );
// does not work for writes!
Loading

0 comments on commit 15d8bc9

Please sign in to comment.