Skip to content

Instantly share code, notes, and snippets.

Christian Fillion cfillion

Block or report user

Report or block cfillion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cfillion
cfillion / orignal-poster.user.js
Last active Apr 25, 2019
Show an indicator beside an original poster's post on the REAPER forums https://i.imgur.com/oxUj5Ws.png
View orignal-poster.user.js
// ==UserScript==
// @name Original poster indicator
// @namespace https://cfillion.ca
// @version 1.1
// @author cfillion
// @include https://forum.cockos.com/showthread.php*
// ==/UserScript==
function getPosters(doc)
{
@cfillion
cfillion / reascript_vararg.hpp
Last active Apr 22, 2019
Compile-time ReaScript API vararg wrapper generator for REAPER extensions (C++17)
View reascript_vararg.hpp
// Extracted from ReaPack's source code (LGPL v3)
/* Usage example:
static int HelloWorld(int foo, int bar) { return foo * bar; }
extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
REAPER_PLUGIN_HINSTANCE instance, reaper_plugin_info_t *rec)
{
// ...
// API_HelloWorld and APIdef_HelloWorld must also be registered as usual
@cfillion
cfillion / reaper_square.cpp
Last active Mar 18, 2019
A REAPER extension that draws a red square on the arrange view.
View reaper_square.cpp
#include <memory>
#ifdef _WIN32
# include <windows.h>
#else
# include <swell/swell.h>
# include <wdltypes.h> // GWLP_WNDPROC
#endif
#define REAPERAPI_IMPLEMENT
View reaper-keyboard-intercept.cpp
// Demo REAPER extension to intercept keyboard input
// https://i.imgur.com/xMSrqRr.gif
#include <cstdio>
#include <reaper_plugin.h>
static int (*plugin_register)(const char *name, void *infostruct);
static int HandleKey(MSG *, accelerator_register_t *);
static accelerator_register_t g_accel{HandleKey, true};
View Check whether js_ReascriptAPI is installed.lua
function checkJSAPI(requiredVersion)
if reaper.JS_ReaScriptAPI_Version and reaper.JS_ReaScriptAPI_Version() >= requiredVersion then
return true
end
local button = reaper.MB(string.format([[
This script requires js_ReaScriptAPI %s or newer. Do you want to install it now?
Choose [Yes] to open ReaPack's package browser.
]], requiredVersion), "js_ReaScriptAPI not found", 4)
@cfillion
cfillion / wav-parser.lua
Last active Oct 17, 2018
Lua WAV file reader (chunk parser)
View wav-parser.lua
-- http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
-- usage example at the end
local WavReader = {}
WavReader.__index = WavReader
function WavReader.new(fn)
local self = setmetatable({}, WavReader)
self.file, err = io.open(fn)
@cfillion
cfillion / fctest.cpp
Last active Aug 16, 2018
Font family matching with FontConfig demo
View fctest.cpp
// c++ -lfontconfig fctest.cpp
// ./a.out 'DejaVu Sans Mono' monospace 'Andale Mono' 'Ubuntu Mono' Lato
#include <cstdio>
#include <fontconfig/fontconfig.h>
class FontConfig {
public:
FontConfig() : m_config(FcInitLoadConfigAndFonts()) {}
FontConfig(const FontConfig &) = delete;
View github-releases-file-dl-shares.rb
require 'json'
files = {}
d = File.open "test", &JSON.method(:load)
d.each {|r|
r['assets'].each {|a|
files[a['name']] ||= 0
files[a['name']] += a['download_count']
}
View cfillion_Compare tracks 1 and 2 for 20 seconds.lua
-- https://forum.cockos.com/showthread.php?t=200086
function solo(trackIndex)
local track = reaper.GetTrack(0, trackIndex)
if not track then return false end
reaper.PreventUIRefresh(1)
reaper.SoloAllTracks(0)
reaper.SetMediaTrackInfo_Value(track, 'I_SOLO', 1)
@cfillion
cfillion / load-reaper-api.cpp
Last active Aug 28, 2018
Loader for the REAPER C++ API
View load-reaper-api.cpp
// Usage:
// if(rec->caller_version != REAPER_PLUGIN_VERSION || !loadAPI(rec->GetFunc))
// return 0;
// See also (bare-bone REAPER extension):
// https://gist.github.com/cfillion/f32b04e75e84e03cc463abb1eda41400
#define REQUIRED_API(name) {(void **)&name, #name, true}
#define OPTIONAL_API(name) {(void **)&name, #name, false}
static bool loadAPI(void *(*getFunc)(const char *))
You can’t perform that action at this time.