Deluge Firmware
1.3.0
Build date: 2025.06.05
Loading...
Searching...
No Matches
pitchenv.h
1
/*
2
* Copyright 2013 Google Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include "env.h"
20
21
// Computation of the DX7 pitch envelope
22
23
class
PitchEnv
{
24
public
:
25
static
void
init(
double
sample_rate);
26
27
// The rates and levels arrays are calibrated to match the Dx7 parameters
28
// (ie, value 0..99).
29
void
set(
const
EnvParams
& p);
30
31
// Result is in Q24/octave
32
int32_t getsample(
const
EnvParams
& p,
int
n);
33
void
keydown(
const
EnvParams
& p,
bool
down);
34
void
getPosition(
char
* step);
35
bool
isDown()
const
{
return
down_; }
36
37
private
:
38
static
int
unit_;
39
int32_t level_;
40
int
targetlevel_;
41
bool
rising_;
42
int
ix_;
43
int
inc_;
44
45
bool
down_;
46
47
void
advance(
const
EnvParams
& p,
int
newix);
48
};
49
50
extern
const
uint8_t pitchenv_rate[];
51
extern
const
int8_t pitchenv_tab[];
EnvParams
Definition
env.h:26
PitchEnv
Definition
pitchenv.h:23