Skip to content

Instantly share code, notes, and snippets.

@GlaireDaggers
GlaireDaggers / GD_AudioReverb.js
Last active March 5, 2024 07:59
Global audio reverb effect plugin for RPG Maker MZ
//=============================================================================
// GlaireDaggers Audio Reverb v1.1
// by Hazel Stagner
// Date: 3/2/2024
// License: MIT
//=============================================================================
//=============================================================================
/* CHANGELOG
* v1.1 - 3/4/2024
@GlaireDaggers
GlaireDaggers / AudioManager.cs
Created April 16, 2023 19:21
Audio manager class from unfinished FNA game using FMOD
using System.Diagnostics;
using System.Runtime.InteropServices;
public class AudioManager
{
public readonly VESGame game;
private FMOD.Studio.System _studioSystem;
private FMOD.Studio.Bank _master;
private FMOD.Studio.Bank _master_strings;
@GlaireDaggers
GlaireDaggers / Export Game Animation.lua
Created December 13, 2022 07:59
Aseprite game animation export tool
-------------------------------
-- Game animation export script
-- By Hazel Stagner
-------------------------------
-- WARNING: This script was hacked together super quickly and does absolutely zero error handling
-- I'll fix it later. Probably.
-- NOTE: script expects .utils/json.lua to be present in Aseprite script folder
@GlaireDaggers
GlaireDaggers / gist:0d37e3b624456a7ed2a958478801d37c
Created June 19, 2022 05:09
C# algorithm for encoding a UTF32 codepoint to UTF8 bytes
private const int SURROGATE_LOW_BITS = 0x7FF;
private const int MAX_SURROGATE = 0xDFFF;
private const int MAX_FOUR_BYTE = 0x10FFFF;
private const int ONE_BYTE_BITS = 7;
private const int TWO_BYTE_BITS = 11;
private const int TWO_BYTE_PREFIX = 0xC0;
private const int THREE_BYTE_BITS = 16;
private const int THREE_BYTE_PREFIX = 0xE0;
private const int FOUR_BYTE_PREFIX = 0xF0;
private const int CONTINUATION_BYTE = 0x80;
@GlaireDaggers
GlaireDaggers / Synth.cs
Last active August 27, 2021 22:52
Psuedo code for a tracker-style synth engine in C#
using System;
class Voice
{
public void Mix(float[] target, int offset, int length)
{
// TODO: mix channel into target
Array.Clear(target, offset, length);
}
}
@GlaireDaggers
GlaireDaggers / vhs.gmic
Last active August 3, 2023 08:50
VHS style filter for G'MIC
#@gui VHS filter: vhs_filter_command, vhs_filter_command
#@gui : note = note("Filter for applying VHS effect over image")
#@gui : sep = separator()
#@gui : Chromatic aberration = float(3,0,100)
#@gui : Noise = float(15,0,100)
#@gui : Chroma blur = float(20,0,100)
#@gui : Luma blur = float(5,0,100)
#@gui : Sharpen = float(1,0,1)
vhs_filter_command :
-split c
@GlaireDaggers
GlaireDaggers / ByteArrayReaderWriter.cs
Last active August 3, 2017 05:16
A simple interface to allow for quick in-line and non-allocating reading and writing with byte arrays.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace JetFistGames.Utils.IO
{
/// <summary>
/// Helper class for a quick non-allocating way to read or write from/to temporary byte arrays as streams
@GlaireDaggers
GlaireDaggers / CelestialBody.cs
Created May 31, 2017 19:05
Celestial Body Class
/// <summary>
/// A celestial body that exists in a solar system
/// See http://www.stjarnhimlen.se/comp/ppcomp.html
/// </summary>
public abstract class CelestialBody
{
/// <summary>
/// The day number
/// </summary>
public static float d;