Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fcf2a93681
Fetching contributors…

Cannot retrieve contributors at this time

183 lines (160 sloc) 3.661 kb
/* drmr.h
* LV2 DrMr plugin
* Copyright 2012 Nick Lanham <nick@afternight.org>
*
* Public License v3. source code is available at
* <http://github.com/nicklan/drmr>
* 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 <sndfile.h>
#include <pthread.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"
// drumkit scanned from a hydrogen xml file
typedef struct {
char* name;
char* desc;
char* path;
char** sample_names;
int samples;
} scanned_kit;
typedef struct {
int num_kits;
scanned_kit* kits;
} kits;
// libsndfile stuff
typedef struct {
float min;
float max;
SF_INFO *info;
uint32_t limit;
float* data;
} drmr_layer;
typedef struct {
SF_INFO *info;
char active;
uint32_t offset;
uint32_t limit;
uint32_t layer_count;
float velocity;
drmr_layer *layers;
float* data;
} drmr_sample;
// lv2 stuff
#define DRMR_URI "http://github.com/nicklan/drmr"
#define GAIN_MIN -60.0f
#define GAIN_MAX 6.0f
typedef enum {
DRMR_MIDI = 0,
DRMR_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,
DRMR_PAN_TWENTYFIVE,
DRMR_PAN_TWENTYSIX,
DRMR_PAN_TWENTYSEVEN,
DRMR_PAN_TWENTYEIGHT,
DRMR_PAN_TWENTYNINE,
DRMR_PAN_THIRTY,
DRMR_PAN_THIRTYONE,
DRMR_PAN_THIRTYTWO,
DRMR_IGNORE_VELOCITY,
DRMR_IGNORE_NOTE_OFF,
DRMR_NUM_PORTS
} DrMrPortIndex;
typedef struct {
// Ports
float* left;
float* right;
LV2_Event_Buffer *midi_port;
// params
float** gains;
float** pans;
float* kitReq;
float* baseNote;
float* ignore_velocity;
float* ignore_note_off;
double rate;
// URIs
LV2_URI_Map_Feature* map;
struct {
uint32_t midi_event;
} uris;
// Available kits
kits* kits;
int curKit;
// Samples
drmr_sample* samples;
uint8_t num_samples;
// loading thread stuff
pthread_mutex_t load_mutex;
pthread_cond_t load_cond;
pthread_t load_thread;
} DrMr;
#endif // DRMR_H
Jump to Line
Something went wrong with that request. Please try again.