shithub: neindaw

ref: 8606ddf48890de2de0f25b771f9ca60ce4ede412
dir: /piper/piper.c/

View raw version
#include <u.h>
#include <libc.h>
#include <thread.h>

static int b2i[] = {
	['0'] =  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
	['a'] = 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
	['k'] = 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
	['u'] = 30, 31, 32, 33, 34, 35,
};

static float notes[/* octave */]['g'-'A'+1 /* note */] = {
#include "a440.h"
};

static float
note2freq(int octave, char note)
{
	note -= 'A';
	if(octave < 0 || octave >= nelem(notes) || note >= nelem(notes[0]))
		return 0.0;
	return notes[octave][note];
}

static void
usage(void)
{
	print("usage: %s DIR...\n", argv0);
	threadexitsall("usage");
}

void
threadmain(int argc, char **argv)
{
	int i;

	ARGBEGIN{
	default:
		usage();
	}ARGEND;

	if (argc < 1)
		usage();

	for (i = 0; i < argc; i++) {
	}

	threadexitsall(nil);
}