Skip to content

Instantly share code, notes, and snippets.

View mazbox's full-sized avatar

Marek Bereza mazbox

View GitHub Profile
@mazbox
mazbox / AudioMidiIO.h
Created August 22, 2024 14:00
Get audio / midi prototyping testbed up and running in C++ in one file
#pragma once
/*
Get audio / midi prototyping testbed up and running in C++ in one file
Included in this comment are a basic example of usage and a CMakeLists.txt file to build the example (including
CPM installation of RtAudio and RtMidi).
/*
* save to file, then type
* `mzgl-livecode Conway.h`
* its mouse interactive, you can click and drag to create new life.
*/
#pragma once
#include "App.h"
#include "Drawer.h"
#include <array>
17:11:51.496 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(SYSTEMEXCLUSIVE) DATA(F07F7F0602F7)
17:11:51.497 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(START)
17:11:51.497 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
17:11:51.497 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CONTROLCHANGE) CHANNEL(1) DATA1(54) DATA2(127)
17:11:51.529 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
17:11:51.546 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
17:11:51.563 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
17:11:51.580 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
17:11:51.596 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CONTROLCHANGE) CHANNEL(1) DATA1(54) DATA2(0)
17:11:51.613 | RECEIVE | ENDPOINT(Arturia BeatStep Pro Arturia BeatStepPro) TYPE(CLOCK)
@mazbox
mazbox / Halo.h
Last active January 18, 2024 11:25
//
// Created by Marek Bereza on 18/01/2024.
//
#pragma once
#include "Layer.h"
class Halo : public Layer {
public:
#ifndef WIN32
#include <dlfcn.h>
#include <stdio.h>
#include <vector>
#if DEBUG
void* malloc(size_t sz) {
static void *(*libc_malloc)(size_t) = nullptr;
if(libc_malloc==nullptr) {
@mazbox
mazbox / xcode-music-pause.sh
Last active January 13, 2023 01:25
play/pause Music.app on Mac when running
#!/bin/zsh
musicAppOpen=`osascript -e 'tell application "System Events" to (name of processes) contains "Music"'`
rm -f "/tmp/xcode-itunes.txt"
if [ $musicAppOpen = 'true' ]; then
musicState=`osascript -e 'tell application "Music" to player state as string'`
if [ $musicState = 'playing' ]; then
echo 'play' > '/tmp/xcode-itunes.txt'
osascript -e 'tell application "Music" to pause'
diff --git a/IPlug/AUv3/IPlugAUAudioUnit.h b/IPlug/AUv3/IPlugAUAudioUnit.h
index e9f179623..7678f1547 100644
--- a/IPlug/AUv3/IPlugAUAudioUnit.h
+++ b/IPlug/AUv3/IPlugAUAudioUnit.h
@@ -29,6 +29,7 @@
- (void) populateChannelCapabilitesArray: (NSMutableArray*) pArray;
- (NSInteger) width;
- (NSInteger) height;
+- (void) hostResized:(CGSize) newSize;
- (PLATFORM_VIEW*) openWindow: (PLATFORM_VIEW*) pParent;
@mazbox
mazbox / fmbeat.cpp
Created November 30, 2020 14:33
nice fm drum synth
#include "LiveAudio.h"
#include <math.h>
class MyLiveAudio : public LiveAudio {
public:
int pos = 0;
double ph = 0;
float period = 15050;
#include "concurrentqueue.h"
moodycamel::ConcurrentQueue<function<void()>> audioThreadQueue(100);
moodycamel::ConcurrentQueue<function<void()>> uiThreadQueue(100);
void runOnAudioThread(function<void()> fn) {
audioThreadQueue.enqueue(fn);
}
void pollAudioThreadQueue() {
@mazbox
mazbox / MyLiveAudio-drum-machine.h
Created July 20, 2020 21:37
Example for making a drum machine with cppsketch
#include "LiveAudio.h"
#include <math.h>
#include <stdlib.h>
class MyLiveAudio : public LiveAudio {
public:
float frac(float f) {
return f - (int)f;
}