summaryrefslogtreecommitdiff
path: root/src/mdaPiano.h
blob: 56e529300729c6ed3309c7b72d89c9c5b2fbdfea (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//See associated .cpp file for copyright and other info

#ifndef MDA_PIANO_H
#define MDA_PIANO_H

#pragma GCC system_header
#include "mdaPianoVoice.h"
#include "mdaPiano.peg"
#include <lv2synth.hpp>


class mdaPiano : public LV2::Synth<mdaPianoVoice, mdaPiano> {
public:
  mdaPiano(double rate);
  ~mdaPiano() {
    free(waves);
  }

  void load_kgrp(KGRP*);
  void load_samples(short**);

  virtual void process(float **inputs, float **outputs, uint32_t sampleframes);
  virtual uint32_t processEvents(VstEvents* events);

  virtual void setParameter(uint32_t index, float value);
  virtual void resume();


private:
  void update();  //my parameter update
  void noteOn(uint32_t note, uint32_t velocity);

  float param[NPARAMS];
  float Fs, iFs;

  #define EVENTBUFFER 120
  #define EVENTS_DONE 99999999
  uint32_t notes[EVENTBUFFER + 8];  //list of delta|note|velocity for current block

  ///global internal variables
  KGRP  kgrp[16];
  mdaPianoVoice *voices[NVOICES];
  uint32_t activevoices, poly, cpos;
  short *waves;
  uint32_t cmax;
  float *comb, cdep, width, trim;
  uint32_t size, sustain;
  float tune, fine, random, stretch;
  float muff, muffvel, sizevel, velsens, volume;
};

#endif