Added a function which checks which operators are carriers. This is needed

for exclude voices from sound calculation (e.g. voices where all carriers are
silent) => more CPU for other things available.
pull/1/head
Holger Wirtz 8 years ago
parent 27f8a52a47
commit 42316698bf
  1. 2
      src/Makefile
  2. 17
      src/dexed.cpp
  3. 16
      src/msfa/fm_core.cc
  4. 1
      src/msfa/fm_core.h

@ -41,7 +41,7 @@ endif
ifeq ($(DEBUG), 1)
ifeq ($(FILETRACE), 1)
CXXFLAGS += -DDEBUG -DFILETRACE $(CFLAGS) -D PATCH_DEBUG
CXXFLAGS += -DDEBUG -DFILETRACE $(CFLAGS)
else
CXXFLAGS += -DDEBUG $(CFLAGS)
endif

@ -104,6 +104,10 @@ void Dexed::activate(void)
set_params();
#ifdef DEBUG
TRACE("Algorithm %d outputs: %d",data[134],controllers.core->op_out(data[134]));
#endif
Plugin::activate();
TRACE("Bye");
@ -447,18 +451,25 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer)
if(voices[i].live==true && voices[i].keydown==false)
{
uint8_t op_amp=0;
uint8_t op_out=controllers.core->op_out(data[134]);
uint8_t op_carrier_num=0;
voices[i].dx7_note->peekVoiceStatus(voiceStatus);
for(uint8_t op=0;op<6;op++)
{
// TRACE("Voice[%2d] OP [%d] amp=%ld,amp_step=%d,pitch_step=%d",i,op,voiceStatus.amp[op],voiceStatus.ampStep[op],voiceStatus.pitchStep);
if((op_out&op)==1)
{
// this voice is a carrier!
op_carrier_num++;
TRACE("Voice[%2d] OP [%d] amp=%ld,amp_step=%d,pitch_step=%d",i,op,voiceStatus.amp[op],voiceStatus.ampStep[op],voiceStatus.pitchStep);
if(voiceStatus.amp[op]<=1069)
op_amp++;
}
if(op_amp==6)
}
if(op_amp==op_carrier_num)
voices[i].live=false;
}
// TRACE("Voice[%2d] live=%d keydown=%d",i,voices[i].live,voices[i].keydown);

@ -68,6 +68,22 @@ int n_out(const FmAlgorithm &alg) {
return count;
}
uint8_t FmCore::op_out(uint8_t algorithm)
{
uint8_t op_out=0;
FmAlgorithm alg=algorithms[algorithm];
for(uint8_t i=0; i<6;i++)
{
if((alg.ops[i]&OUT_BUS_ADD)==OUT_BUS_ADD)
op_out|=1<<i;
TRACE("OP[%d]:",6-i);
TRACE("OUT_BUS_ONE=%d OUT_BUS_TWO=%d OUT_BUS_ADD=%d IN_BUS_ONE=%d IN_BUS_TWO=%d FB_IN=%d FB_OUT=%d",alg.ops[i]&OUT_BUS_ONE?1:0,alg.ops[i]&OUT_BUS_TWO?1:0,alg.ops[i]&OUT_BUS_ADD?1:0,alg.ops[i]&IN_BUS_ONE?1:0,alg.ops[i]&IN_BUS_TWO?1:0,alg.ops[i]&FB_IN?1:0,alg.ops[i]&FB_OUT?1:0);
}
return op_out;
}
void FmCore::dump() {
#ifdef VERBOSE
for (int i = 0; i < 32; i++) {

@ -48,6 +48,7 @@ class FmCore {
public:
virtual ~FmCore() {};
static void dump();
uint8_t op_out(uint8_t algorithm);
virtual void render(int32_t *output, FmOpParams *params, int algorithm, int32_t *fb_buf, int32_t feedback_gain);
protected:
AlignedBuf<int32_t, N>buf_[2];

Loading…
Cancel
Save