summaryrefslogtreecommitdiff
path: root/synth/note_skel.h
blob: 7272c8ed2fcd7769945594fb36023f9248fbc31a (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
    Copyright (C) 2010-2012 Florian Jung
     
    This file is part of flo's FM synth.

    flo's FM synth is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    flo's FM synth is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with flo's FM synth.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef __NOTE_SKEL_H__
#define __NOTE_SKEL_H__

#include <jack/jack.h>

#include "programs.h"
#include "fixed.h"

class NoteSkel
{
	public:
		NoteSkel();
		virtual ~NoteSkel();
		virtual fixed_t get_sample()=0;

		int get_program();
		int get_note();
		void set_note(int n);
		void set_note(int n, bool do_port);
		void set_freq(float f);
		void set_freq(float f, bool do_port);
		void set_pitchbend(fixed_t pb);
		void set_vel(float v);
		void set_vol_factor(float vol_fac);
		void set_portamento_frames(jack_nframes_t f);

		virtual void release_quickly(jack_nframes_t maxt)=0;
		virtual void release()=0;
		virtual void reattack()=0;
		virtual bool still_active()=0;

		virtual void set_param(const parameter_t &p, fixed_t v)=0;
		
		virtual void recalc_actual_freq()=0;
		
		virtual void destroy()=0;
		
	protected:
		virtual void do_ksl()=0;
		virtual void do_ksr()=0;

		virtual void recalc_factors()=0;
		virtual void apply_pfactor()=0;

		fixed_t freq, dest_freq, old_freq;
		fixed_t vel;
		jack_nframes_t portamento_t, portamento_frames;
		
		pfactor_value_t pfactor;
		float volume_factor;
		
		int note;
		int program;
		program_t *curr_prg;
		
		fixed_t pitchbend;
};


#endif