summaryrefslogtreecommitdiff
path: root/src/mdaPianoCommon.h
blob: 81680443346f95342687be99ced8c8c85f27c0f8 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef MDA_PIANO_COMMON_H
#define MDA_PIANO_COMMON_H

#define NPARAMS 12       //number of parameters
#define NOUTS    2       //number of outputs
#define NVOICES 64       //max polyphony
#define SUSTAIN 128
#define SILENCE 0.0001f  //voice choking
#define PARAM_OFFSET 3 //offset for param enum
#define SAMPLES_PER_NOTE 1
#define NSAMPLES 15

struct KGRP  //keygroup
{
  long root;  //MIDI root note
  long high;  //highest note
  long loop;
};

typedef struct
{
  long size;     //length of sample data
  short* buffer; //pointer to sample data
} Sample;

static float scale_midi_to_f(unsigned char data)
{
  return 0.0078f * (float)(data);
}

static unsigned char p_offset(unsigned char i)
{
  return (i - PARAM_OFFSET);
}

#endif