Skip to content

Instantly share code, notes, and snippets.

@orazdow
orazdow / rb.c
Last active May 7, 2018 03:05
two ring buffers
#include "ringbuffer.h"
#include "stdlib.h"
size_t rb_push(RingBuffer* r, short* data, size_t num){
size_t written = 0;
while((r->head+1) % r->size != r->tail && written != num){
r->buffer[r->head] = *data++;
r->head = (r->head+1) % r->size;
written++;
}
@orazdow
orazdow / Makefile
Last active January 2, 2020 06:13
useful makefiles
TARGET := out.exe
SRC := main.cpp
# INCLUDE = -ID:/Libraries/portaudio/include
# LIBS = -LD:/Libraries/portaudio/build
# LIBS += -lportaudio
CXX := g++
FLAGS := -pthread -Wall