N K
/
GaNtroller
a fork of priustroller
Fork of priustroller_current by
meta/modulators.cpp@14:1cc975207995, 2015-03-09 (annotated)
- Committer:
- bwang
- Date:
- Mon Mar 09 02:06:06 2015 +0000
- Revision:
- 14:1cc975207995
- Parent:
- 13:79e247e54d78
- Child:
- 15:d754b71a1290
added stubs for SVM, modulation scheme is still the same as last time
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 11:dccbaa9274c5 | 1 | #include "includes.h" |
bwang | 11:dccbaa9274c5 | 2 | #include "core.h" |
bwang | 11:dccbaa9274c5 | 3 | #include "meta.h" |
bwang | 14:1cc975207995 | 4 | #include "fastmath.h" |
bwang | 14:1cc975207995 | 5 | #include "transforms.h" |
bwang | 11:dccbaa9274c5 | 6 | |
bwang | 14:1cc975207995 | 7 | void SinusoidalModulator::Update(float valpha, float vbeta) { |
bwang | 13:79e247e54d78 | 8 | //--hack to make duty cycles positive |
bwang | 14:1cc975207995 | 9 | float dtcA = valpha; |
bwang | 14:1cc975207995 | 10 | float dtcB = ((-valpha + sqrt(3.0f) * vbeta) / 2.0f); |
bwang | 14:1cc975207995 | 11 | float dtcC = ((-valpha - sqrt(3.0f) * vbeta) / 2.0f); |
bwang | 13:79e247e54d78 | 12 | _inverter->SetDtcA(dtcA * 0.5f + 0.5f); |
bwang | 13:79e247e54d78 | 13 | _inverter->SetDtcB(dtcB * 0.5f + 0.5f); |
bwang | 13:79e247e54d78 | 14 | _inverter->SetDtcC(dtcC * 0.5f + 0.5f); |
bwang | 14:1cc975207995 | 15 | } |
bwang | 14:1cc975207995 | 16 | |
bwang | 14:1cc975207995 | 17 | void SvmModulator::Update(float valpha, float vbeta) { |
bwang | 14:1cc975207995 | 18 | float va, vb, vc; |
bwang | 14:1cc975207995 | 19 | InverseClarke(valpha, vbeta, &va, &vb); |
bwang | 14:1cc975207995 | 20 | vc = -(va + vb); |
bwang | 11:dccbaa9274c5 | 21 | } |