Skip to content

Instantly share code, notes, and snippets.

@cfillion
cfillion / reaper_60fps.cpp
Last active December 27, 2023 19:38
Make REAPER scripts go brrr
// Set REAPER misc timer interval to 60 Hz
//
// 1. Grab reaper_plugin.h from https://github.com/justinfrankel/reaper-sdk/raw/main/sdk/reaper_plugin.h
// 2. Grab reaper_plugin_functions.h by running the REAPER action "[developer] Write C++ API functions header"
// 3. Grab WDL: git clone https://github.com/justinfrankel/WDL.git
// 4. Build then copy or link the binary file into <REAPER resource directory>/UserPlugins
//
// Linux
// =====
//
// ConfigVar Layout
//
// 1. Grab reaper_plugin.h from https://landoleet.org/dev/reaper_plugin.h
// 2. Grab reaper_plugin_functions.h by running the REAPER action "[developer] Write C++ API functions header"
// 3. Grab WDL: git clone https://github.com/justinfrankel/WDL.git
// 4. Build then copy or link the binary file into <REAPER resource directory>/UserPlugins
//
// Linux
// =====
//
-- @version 0.2beta
-- @author cfillion
local RECURSIVE = false
local NESTED_RULES = {
['folder level 1'] = {
['folder level 2'] = {
'track to select',
},
},
@cfillion
cfillion / main.cpp
Last active October 12, 2022 02:43
Proof of concept: Add prevent UI refresh to REAPER native custom actions
#include <cstring>
#define REAPERAPI_IMPLEMENT
#include <reaper_plugin_functions.h>
const char *(*__localizeFunc)(const char *str, const char *subctx, int flags);
static bool IsCustomAction(KbdSectionInfo *section, const int id)
{
// logic from SWS's IsMacroOrScript
@cfillion
cfillion / reaper_gmem.cpp
Last active May 2, 2023 21:35
Proof of concept for accessing gmem data from REAPER extensions using eel_gmem_attach
#include "reaper_plugin.h"
#define EEL_F_SIZE WDL_FFT_REALSIZE
#include "WDL/WDL/eel2/nseel-ram.c"
EEL_F *** (*eel_gmem_attach)(const char *nm, bool is_alloc);
void (*eel_enter_mutex)();
void (*eel_leave_mutex)();
void NSEEL_HOSTSTUB_EnterMutex() { eel_enter_mutex(); }
@cfillion
cfillion / index.php
Last active December 3, 2019 02:07
File listing script for SWS bleeding edge builds
<?php
function file_info($file)
{
$icons = [
'dmg' => 'apple',
'exe' => 'windows',
'xz' => 'linux',
];
return [
@cfillion
cfillion / TLC591x_R-EXT.rb
Last active September 24, 2019 03:12
Calculate valid output current ranges for given R-EXT values [TLC5916/TLC5917 8-Channel Constant-Current LED Sink Driver]
#!/bin/env ruby
#
# TLC5916/TLC5917 8-Channel Constant-Current LED Sink Driver
# Calculate valid output current ranges for given R-EXT values
#
# Run with no arguments to print all valid ranges for common E12 and E96 values
# See ./TLC591x_R-EXT.rb --help for usage instructions and supported options.
#
# Example 1: ./TLC591x_R-EXT.rb 360 720
# Rext= 360Ω Imin= 4.375mA Imax= 52.090mA IΔ= 47.715mA
@cfillion
cfillion / mpasmx
Created September 21, 2019 21:59
Wrapper to make mpasmx output errors to stderr and fail with a proper exit code
#!/bin/sh
errfile="$(mktemp)"
exit=0
/opt/microchip/mplabx/v*.*/mpasmx/mpasmx -e"$errfile" "$@"
if [ -s "$errfile" ]; then
cat "$errfile" >&2
exit=1
-- @version 1.0beta
-- @author cfillion
local EXT_SECTION = 'cfillion_project_list'
local function makeKey(i)
return string.format('project%d', i)
end
local function enumOpenedProjects()
@cfillion
cfillion / orignal-poster.user.js
Last active May 11, 2023 21:22
Show an indicator beside an original poster's post on the REAPER forums https://i.imgur.com/oxUj5Ws.png
// ==UserScript==
// @name Original poster indicator
// @namespace https://cfillion.ca
// @version 1.2
// @author cfillion
// @include https://forum.cockos.com/showthread.php*
// ==/UserScript==
// See also: syntax-highlighting.user.js https://gist.github.com/cfillion/7fd2bfe13465a8a37d28a9f0fd60b13b