mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-27 00:45:10 -04:00
4df8ccc871
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}
* Update configure.py and project.py for new libs structure
* Refactor `#include <dolphin/x.h>` -> `<x.h>`
* Remove `__REVOLUTION_SDK__` forwards from dolphin
* Fix dolphin/ references in revolution
* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`
* Always build TRK against dolphin headers
* Resolve revolution SDK header resolution issues
103 lines
2.1 KiB
C
103 lines
2.1 KiB
C
#include <dolphin/dolphin.h>
|
|
#include <dolphin/ax.h>
|
|
#include <dolphin/syn.h>
|
|
#include "sdk_math.h"
|
|
|
|
#include "__syn.h"
|
|
|
|
static f32 __SYNLfo[64] = {
|
|
0.000000f,
|
|
0.098020f,
|
|
0.195090f,
|
|
0.290280f,
|
|
0.382680f,
|
|
0.471400f,
|
|
0.555570f,
|
|
0.634390f,
|
|
0.707110f,
|
|
0.773010f,
|
|
0.831470f,
|
|
0.881920f,
|
|
0.923880f,
|
|
0.956940f,
|
|
0.980790f,
|
|
0.995180f,
|
|
1.000000f,
|
|
0.995180f,
|
|
0.980790f,
|
|
0.956940f,
|
|
0.923880f,
|
|
0.881920f,
|
|
0.831470f,
|
|
0.773010f,
|
|
0.707110f,
|
|
0.634390f,
|
|
0.555570f,
|
|
0.471400f,
|
|
0.382680f,
|
|
0.290280f,
|
|
0.195090f,
|
|
0.098020f,
|
|
0.000000f,
|
|
-0.098020f,
|
|
-0.195090f,
|
|
-0.290280f,
|
|
-0.382680f,
|
|
-0.471400f,
|
|
-0.555570f,
|
|
-0.634390f,
|
|
-0.707110f,
|
|
-0.773010f,
|
|
-0.831470f,
|
|
-0.881920f,
|
|
-0.923880f,
|
|
-0.956940f,
|
|
-0.980790f,
|
|
-0.995180f,
|
|
-1.000000f,
|
|
-0.995180f,
|
|
-0.980790f,
|
|
-0.956940f,
|
|
-0.923880f,
|
|
-0.881920f,
|
|
-0.831470f,
|
|
-0.773010f,
|
|
-0.707110f,
|
|
-0.634390f,
|
|
-0.555570f,
|
|
-0.471400f,
|
|
-0.382680f,
|
|
-0.290280f,
|
|
-0.195090f,
|
|
-0.098020f,
|
|
};
|
|
|
|
void __SYNSetupLfo(SYNVOICE* voice) {
|
|
ASSERTLINE(47, voice);
|
|
|
|
voice->lfoState = voice->lfoAttn = voice->lfoCents = 0;
|
|
voice->lfoFreq = voice->art->lfoFreq;
|
|
voice->lfoDelay = voice->art->lfoDelay;
|
|
voice->lfoAttn_ = voice->art->lfoAtten;
|
|
voice->lfoCents = voice->art->lfoPitch;
|
|
voice->lfoModAttn = voice->art->lfoMod2Atten;
|
|
voice->lfoModCents = voice->art->lfoMod2Pitch;
|
|
}
|
|
|
|
void __SYNRunLfo(SYNVOICE* voice) {
|
|
f32 lfoAmplitude;
|
|
f32 lfoModWheel;
|
|
|
|
ASSERTLINE(66, voice);
|
|
|
|
if (voice->lfoDelay != 0) {
|
|
voice->lfoDelay--;
|
|
} else {
|
|
voice->lfoState += voice->lfoFreq;
|
|
lfoAmplitude = __SYNLfo[(voice->lfoState >> 0x10) % 64];
|
|
lfoModWheel = __SYNn128[voice->synth->controller[voice->midiChannel][1]];
|
|
voice->lfoAttn = (lfoAmplitude * (voice->lfoAttn_ + (voice->lfoModAttn* lfoModWheel)));
|
|
voice->lfoCents = (lfoAmplitude * (voice->lfoCents_ + (voice->lfoModCents* lfoModWheel)));
|
|
}
|
|
}
|