Match and link RubmleAdsr

This commit is contained in:
Phillip Stephens 2022-10-06 02:50:00 -07:00
parent a37c4fde2e
commit 08d4f2a080
3 changed files with 85 additions and 0 deletions

View File

@ -57,6 +57,7 @@ COMPLETE_OBJECTS = [
"Kyoto/zlib/infutil", "Kyoto/zlib/infutil",
"Kyoto/zlib/zutil", "Kyoto/zlib/zutil",
"Kyoto/Graphics/CColor", "Kyoto/Graphics/CColor",
"Kyoto/Input/RumbleAdsr",
"Kyoto/Input/DolphinIController", "Kyoto/Input/DolphinIController",
"Kyoto/Input/CDolphinController", "Kyoto/Input/CDolphinController",
"Kyoto/Alloc/CSmallAllocPool", "Kyoto/Alloc/CSmallAllocPool",

View File

@ -0,0 +1,39 @@
#ifndef __RUMBLEADSR_HPP__
#define __RUMBLEADSR_HPP__
enum ERumblePriority { kPriority_Zero, kPriority_One, kPriority_Two, kPriority_Three };
struct SAdsrDelta {
enum EPhase { kP_Stop, kP_PrePulse, kP_Attack, kP_Decay, kP_Sustain, kP_Release };
static SAdsrDelta Start(ERumblePriority priority, bool);
static SAdsrDelta Stopped();
SAdsrDelta(EPhase phase);
SAdsrDelta(EPhase phase, ERumblePriority priority);
float x0_curIntensity;
float x4_attackTime;
float x8_decayTime;
float xc_releaseTime;
float x10_autoReleaseTime;
float x14_attackIntensity;
float x18_sustainIntensity;
ERumblePriority x1c_priority;
EPhase x20_phase;
};
struct SAdsrData {
SAdsrData();
SAdsrData(float, float, float, float, float, float, bool, bool);
float x0_attackGain;
float x4_autoReleaseDur;
float x8_attackDur;
float xc_decayDur;
float x10_sustainGain;
float x14_releaseDur;
bool x18_24_hasSustain : 1;
bool x18_25_autoRelease : 1;
};
#endif // __RUBMLEADSR_HPP__

View File

@ -0,0 +1,45 @@
#include "Kyoto/Input/RumbleAdsr.hpp"
SAdsrDelta SAdsrDelta::Start(ERumblePriority priority, bool prePulse) {
return SAdsrDelta(prePulse ? kP_PrePulse : kP_Attack, priority);
}
SAdsrDelta SAdsrDelta::Stopped() { return SAdsrDelta(kP_Stop); }
SAdsrDelta::SAdsrDelta(EPhase phase)
: x0_curIntensity(0.f)
, x4_attackTime(0.f)
, x8_decayTime(0.f)
, xc_releaseTime(0.f)
, x10_autoReleaseTime(0.f)
, x1c_priority(kPriority_Zero)
, x20_phase(phase) {}
SAdsrDelta::SAdsrDelta(EPhase phase, ERumblePriority priority)
: x0_curIntensity(phase == kP_PrePulse ? 2.f : 0.f)
, x4_attackTime(0.f)
, x8_decayTime(0.f)
, xc_releaseTime(0.f)
, x10_autoReleaseTime(0.f)
, x1c_priority(priority)
, x20_phase(phase) {}
SAdsrData::SAdsrData()
: x0_attackGain(0.f)
, x4_autoReleaseDur(0.f)
, x8_attackDur(0.f)
, xc_decayDur(0.f)
, x10_sustainGain(0.f)
, x14_releaseDur(0.f)
, x18_24_hasSustain(false)
, x18_25_autoRelease(false) {}
SAdsrData::SAdsrData(float attackGain, float autoReleaseDur, float attackDur, float decayDur,
float sustainGain, float releaseDur, bool hasSustain, bool autoRelease)
: x0_attackGain(attackGain)
, x4_autoReleaseDur(autoReleaseDur)
, x8_attackDur(attackDur)
, xc_decayDur(decayDur)
, x10_sustainGain(sustainGain)
, x14_releaseDur(releaseDur)
, x18_24_hasSustain(hasSustain)
, x18_25_autoRelease(autoRelease) {}