Skip to content

Instantly share code, notes, and snippets.

View moebiussurfing's full-sized avatar

moebiusSurfing moebiussurfing

View GitHub Profile
moebiussurfing / ofApp.cpp
Created January 16, 2024 01:00
ofParameterGroup callback lambda new api
ofParameterGroup parameters;
ofEventListener listenerParameters;
parameters.add(param1.set("p1", 1.f, 0.f, 10.f));
parameters.add(param2.set("p2", 10.f, 1.f, 50.f));
parameters.add(param3.set("p3", 5, 0, 10));
listenerParameters = parameters.parameterChangedE().newListener([this](ofAbstractParameter& e){
string n = e.getName();
ofLogNotice("ofApp") << "Changed " << n << ": " << e;
moebiussurfing / .cpp
Last active November 21, 2023 22:18
ofApp.cpp grouped callbacks pattern
// ofApp.h
ofParameterGroup params{"Params"};
void Changed_Params(ofAbstractParameter &e);
ofParameter<bool> bAnimate;
ofParameter<void> bRefresh;
ofParameter<float> size;
moebiussurfing / dock_builder_example.cpp
Created July 29, 2021 03:36 — forked from PossiblyAShrub/dock_builder_example.cpp
Simple example, of how to use the dock builder API. (Adapted from the dock space example in the demo window) You need to use the docking branch and set the ImGuiConfigFlags_DockingEnable config flag. Learn more about Dear ImGui here:
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
ImGuiViewport* viewport = ImGui::GetMainViewport();
moebiussurfing / ofApp.cpp
Last active January 21, 2023 10:14
openFrameworks | Int / Lambda callbacks : ofParameters
ofParameter<int> MODE_COLOR{ "Palette Type", 1, 1, 3 };
ofParameter<int> MODE_SORTING{ "Sorting Mode", 0, 1, 5 };
ofParameter<bool> bPlayerBeat{"Next", false};
ofEventListener listener_ModeColor;
ofEventListener listener_ModeSorting;
ofEventListener listener_Beat;
listener_ModeSorting = MODE_SORTING.newListener([this](int &i) {
moebiussurfing / ImGuiDockspaceExample.cpp
Created July 29, 2021 05:43 — forked from AidanSun05/ImGuiDockspaceExample.cpp
A modified DockSpace example for Dear ImGui. Changes are listed at the top of the file.
// Added more clarifying comments inside the function.
// Removed MSVC warning C6011 - null pointer dereference.
// Fixed a slight grammar error - "This demo app only demonstrate" => "This demo app only demonstrates"
// Demonstrate using DockSpace() to create an explicit docking node within an existing window.
// Note: You can use most Docking facilities without calling any API. You DO NOT need to call DockSpace() to use Docking!
// - Drag from window title bar or their tab to dock/undock. Hold SHIFT to disable docking.
// - Drag from window menu button (upper-left button) to undock an entire node (all windows).
// About dockspaces:
moebiussurfing / ofApp.cpp
Last active August 16, 2022 08:44
openFrameworks | ofParameters callbacks using modern lambdas. Exclusive toggle bool's behaviour. ofParameterGroup different types filtetering / casting too.
#include "ofApp.h"
void ofApp::setup(){
listenerMouse = ofEvents().mousePressed.newListener([this](ofMouseEventArgs&mouse) {
ofLogNotice() << __FUNCTION__ << "mouse:"<<ofToString(mouse);
moebiussurfing / ofParameterGroup_Changed_params
Last active August 20, 2021 01:09
openFrameworks - callback parameterGroup . ofParameterGroup / Changed_params / name = e.getName()
// .h
ofParameterGroup params{"Params"};
void Changed_Params(ofAbstractParameter &e);
bool DISABLE_Callbacks = false; // to avoid callback crashes or to enable only after setup()
// .cpp
// setup()
SHOW_gui.set("SHOW_gui", true);
moebiussurfing / toolbar.cpp
Created July 29, 2021 05:47 — forked from rmitton/toolbar.cpp
How to do a toolbar in Dear ImGui.
// How to do a toolbar in Dear ImGui.
const float toolbarSize = 50;
void DockSpaceUI()
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos + ImVec2(0, toolbarSize));
ImGui::SetNextWindowSize(viewport->Size - ImVec2(0, toolbarSize));
moebiussurfing /
Created July 20, 2021 01:33 — forked from dlublin/
Encoding to Hap from the command line using FFmpeg

Encoding to Hap from the command line using FFmpeg

For users who prefer working with a command line or need to access advanced encoding settings for Hap the popular FFmpeg library can be used to work with Hap movies.

  1. If this is your first time using FFmpeg you may need to install it on your system, or compile it from source. In either case be sure that Snappy is enabled as part of the binary. If you already have FFmpeg on your system with Snappy enabled, you can skip this step.

    You can check that your version of FFmpeg can encode Hap using

    ffmpeg -encoders | grep hap
moebiussurfing /
Created July 15, 2021 22:07 — forked from liangfu/
using ffmpeg to extract audio from video files


Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz: