You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MicroDexed/dx7note.h

83 lines
2.4 KiB

6 years ago
/*
Copyright 2016-2017 Pascal Gauthier.
Copyright 2012 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
6 years ago
#ifndef SYNTH_DX7NOTE_H_
#define SYNTH_DX7NOTE_H_
// This is the logic to put together a note from the MIDI description
// and run the low-level modules.
// It will continue to evolve a bit, as note-stealing logic, scaling,
// and real-time control of parameters live here.
6 years ago
#include <Arduino.h>
6 years ago
#include "env.h"
#include "pitchenv.h"
#include "fm_core.h"
struct VoiceStatus {
uint32_t amp[6];
char ampStep[6];
char pitchStep;
6 years ago
};
class Dx7Note {
public:
6 years ago
Dx7Note();
void init(const uint8_t patch[156], int midinote, int velocity, int srcnote, int porta, const Controllers *ctrls);
6 years ago
// Note: this _adds_ to the buffer. Interesting question whether it's
// worth it...
void compute(int32_t *buf, int32_t lfo_val, int32_t lfo_delay, const Controllers *ctrls);
6 years ago
void keyup();
6 years ago
// TODO: some way of indicating end-of-note. Maybe should be a return
// value from the compute method? (Having a count return from keyup
// is also tempting, but if there's a dynamic parameter change after
// keyup, that won't work.
6 years ago
// PG:add the update
void update(const uint8_t patch[156], int midinote, int velocity, int porta, const Controllers *ctrls);
6 years ago
void peekVoiceStatus(VoiceStatus &status);
void transferState(Dx7Note& src);
void transferSignal(Dx7Note &src);
void transferPortamento(Dx7Note &src);
6 years ago
void oscSync();
private:
6 years ago
Env env_[6];
FmOpParams params_[6];
PitchEnv pitchenv_;
int32_t basepitch_[6];
int32_t fb_buf_[2];
int32_t fb_shift_;
int32_t ampmodsens_[6];
6 years ago
int32_t opMode[6];
6 years ago
int ampmoddepth_;
int algorithm_;
int pitchmoddepth_;
int pitchmodsens_;
int porta_rateindex_;
int porta_gliss_;
int32_t porta_curpitch_[6];
6 years ago
};
#endif // SYNTH_DX7NOTE_H_