drmr2/drmr.h
2012-02-07 09:31:51 +01:00

91 lines
1.9 KiB
C

/*
LV2 DrMr plugin
Copyright 2012 Nick Lanham <nick@afternight.org>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef DRMR_H
#define DRMR_H
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "lv2/lv2plug.in/ns/ext/event/event-helpers.h"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include <sndfile.h>
// libsndfile stuff
typedef struct {
SF_INFO info;
char active;
uint32_t offset;
uint32_t limit;
float* data;
} drmr_sample;
int load_sample(char* path,drmr_sample* smp);
// lv2 stuff
#define DRMR_URI "http://github.com/nicklan/drmr"
typedef enum {
DRMR_MIDI = 0,
DRMR_LEFT,
DRMR_RIGHT,
DRMR_GAIN_ONE,
DRMR_GAIN_TWO,
DRMR_GAIN_THREE,
DRMR_GAIN_FOUR,
DRMR_GAIN_FIVE,
DRMR_GAIN_SIX,
DRMR_GAIN_SEVEN,
DRMR_GAIN_EIGHT,
DRMR_GAIN_NINE,
DRMR_GAIN_TEN,
DRMR_GAIN_ELEVEN,
DRMR_GAIN_TWELVE,
DRMR_GAIN_THIRTEEN,
DRMR_GAIN_FOURTEEN,
DRMR_GAIN_FIFTEEN,
DRMR_GAIN_SIXTEEN,
DRMR_NUM_PORTS
} DrMrPortIndex;
typedef struct {
// Ports
float* left;
float* right;
LV2_Event_Buffer *midi_port;
// params
float** gains;
// URIs
LV2_URI_Map_Feature* map;
struct {
uint32_t midi_event;
} uris;
// Samples
drmr_sample* samples;
uint8_t num_samples;
} DrMr;
#endif // DRMR_H