diff --git a/include/JSystem/JAudio/JASOscillator.h b/include/JSystem/JAudio/JASOscillator.h new file mode 100644 index 000000000..ba2c5068b --- /dev/null +++ b/include/JSystem/JAudio/JASOscillator.h @@ -0,0 +1,38 @@ +#ifndef JASOSCILLATOR_H +#define JASOSCILLATOR_H + +#include "dolphin/types.h" + +namespace JASystem { + class TOscillator { + public: + struct Osc_ { + /* 0x00 */ u8 field_0x0; + /* 0x04 */ f32 field_0x4; + /* 0x08 */ u32 table; + /* 0x0C */ int rel_table; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + }; + + void init(); + void initStart(); + f32 getOffset(); + bool forceStop(); + bool release(); + void calc(s16*); + + /* 0x00 */ const Osc_* field_0x0; + /* 0x04 */ u8 field_0x4; + /* 0x05 */ u8 field_0x5; + /* 0x06 */ short field_0x6; + /* 0x08 */ f32 field_0x8; + /* 0x0C */ f32 field_0xc; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ u16 field_0x18; + /* 0x1C */ f32 field_0x1c; + }; +} + +#endif /* JASOSCILLATOR_H */ diff --git a/src/JSystem/JAudio/JASOscillator.cpp b/src/JSystem/JAudio/JASOscillator.cpp index 06e7293a0..73455b03e 100644 --- a/src/JSystem/JAudio/JASOscillator.cpp +++ b/src/JSystem/JAudio/JASOscillator.cpp @@ -3,36 +3,60 @@ // Translation Unit: JASOscillator.cpp // -#include "JASOscillator.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JASOscillator.h" /* 8028DE94-8028DECC .text init__Q28JASystem11TOscillatorFv */ void JASystem::TOscillator::init() { - /* Nonmatching */ + field_0x0 = NULL; + field_0x4 = 1; + field_0x5 = 0; + field_0x6 = 0; + field_0x8 = 0.0f; + field_0xc = 0.0f; + field_0x10 = 0.0f; + field_0x14 = 0.0f; + field_0x18 = 0; + field_0x1c = 0.0f; } /* 8028DECC-8028DF2C .text initStart__Q28JASystem11TOscillatorFv */ void JASystem::TOscillator::initStart() { - /* Nonmatching */ + field_0x4 = 2; + field_0x18 = 0; + if (!field_0x0 || !field_0x0->table) { + field_0xc = 0.0f; + return; + } + field_0x6 = 0; + field_0x8 = 0.0f; + field_0x10 = 0.0f; + field_0x18 = 0; + field_0x8 -= field_0x0->field_0x4; } /* 8028DF2C-8028E070 .text getOffset__Q28JASystem11TOscillatorFv */ -void JASystem::TOscillator::getOffset() { +f32 JASystem::TOscillator::getOffset() { /* Nonmatching */ } /* 8028E070-8028E0AC .text forceStop__Q28JASystem11TOscillatorFv */ -void JASystem::TOscillator::forceStop() { - /* Nonmatching */ +bool JASystem::TOscillator::forceStop() { + if (field_0x4 == 5) { + return false; + } + field_0x6 = 0; + field_0x8 = 0.0f; + field_0x10 = field_0xc; + field_0x4 = 5; + return true; } /* 8028E0AC-8028E238 .text release__Q28JASystem11TOscillatorFv */ -void JASystem::TOscillator::release() { +bool JASystem::TOscillator::release() { /* Nonmatching */ } /* 8028E238-8028E5EC .text calc__Q28JASystem11TOscillatorFPs */ -void JASystem::TOscillator::calc(short*) { +void JASystem::TOscillator::calc(s16*) { /* Nonmatching */ } -