mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Initialize some stuff in SasAudio, fixes some audio issues on my mac
This commit is contained in:
parent
d8da92befa
commit
38a7059bdd
2 changed files with 26 additions and 15 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "../MemMap.h"
|
||||
#include "SasAudio.h"
|
||||
|
||||
static const double f[5][2] =
|
||||
static const double f[5][2] =
|
||||
{ { 0.0, 0.0 },
|
||||
{ 60.0 / 64.0, 0.0 },
|
||||
{ 115.0 / 64.0, -52.0 / 64.0 },
|
||||
|
@ -58,7 +58,7 @@ bool VagDecoder::DecodeBlock()
|
|||
else if (flags == 3 && loopEnabled_) {
|
||||
loopAtNextBlock_ = true;
|
||||
}
|
||||
for (int i = 0; i < 28; i += 2)
|
||||
for (int i = 0; i < 28; i += 2)
|
||||
{
|
||||
int d = GetByte();
|
||||
int s = (short)((d & 0xf) << 12);
|
||||
|
@ -168,8 +168,14 @@ void ADSREnvelope::SetSimpleEnvelope(u32 ADSREnv1, u32 ADSREnv2) {
|
|||
sustainLevel = getSustainLevel(ADSREnv1);
|
||||
}
|
||||
|
||||
SasInstance::SasInstance()
|
||||
: mixBuffer(0), sendBuffer(0), resampleBuffer(0), grainSize(0) {
|
||||
SasInstance::SasInstance()
|
||||
: maxVoices(PSP_SAS_VOICES_MAX),
|
||||
sampleRate(44100),
|
||||
outputMode(0),
|
||||
mixBuffer(0),
|
||||
sendBuffer(0),
|
||||
resampleBuffer(0),
|
||||
grainSize(0) {
|
||||
}
|
||||
|
||||
SasInstance::~SasInstance() {
|
||||
|
@ -409,6 +415,12 @@ static int getExpCurveAt(int index, int duration) {
|
|||
return (short)(sample);
|
||||
}
|
||||
|
||||
ADSREnvelope::ADSREnvelope()
|
||||
: steps_(0),
|
||||
state_(STATE_OFF),
|
||||
height_(0) {
|
||||
}
|
||||
|
||||
void ADSREnvelope::WalkCurve(int rate, int type) {
|
||||
short expFactor;
|
||||
int duration;
|
||||
|
|
|
@ -111,6 +111,7 @@ private:
|
|||
class ADSREnvelope
|
||||
{
|
||||
public:
|
||||
ADSREnvelope();
|
||||
void SetSimpleEnvelope(u32 ADSREnv1, u32 ADSREnv2);
|
||||
|
||||
void WalkCurve(int rate, int type);
|
||||
|
@ -121,7 +122,7 @@ public:
|
|||
void Step();
|
||||
|
||||
int GetHeight() const {
|
||||
return height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX ? PSP_SAS_ENVELOPE_HEIGHT_MAX : height_;
|
||||
return height_ > PSP_SAS_ENVELOPE_HEIGHT_MAX ? PSP_SAS_ENVELOPE_HEIGHT_MAX : height_;
|
||||
}
|
||||
bool HasEnded() const {
|
||||
return state_ == STATE_OFF;
|
||||
|
@ -158,7 +159,7 @@ struct SasVoice
|
|||
{
|
||||
SasVoice()
|
||||
: playing(false), paused(false), on(false),
|
||||
type(VOICETYPE_OFF),
|
||||
type(VOICETYPE_OFF),
|
||||
vagAddr(0),
|
||||
vagSize(0),
|
||||
pcmAddr(0),
|
||||
|
@ -171,7 +172,13 @@ struct SasVoice
|
|||
volumeLeft(0),
|
||||
volumeRight(0),
|
||||
volumeLeftSend(0),
|
||||
volumeRightSend(0) {}
|
||||
volumeRightSend(0) {
|
||||
}
|
||||
|
||||
void Reset();
|
||||
void KeyOn();
|
||||
void KeyOff();
|
||||
void ChangedParams(bool changedVag);
|
||||
|
||||
bool playing;
|
||||
bool paused; // a voice can be playing AND paused. In that case, it won't play.
|
||||
|
@ -195,14 +202,6 @@ struct SasVoice
|
|||
int volumeRight;
|
||||
int volumeLeftSend; // volume to "Send" (audio-lingo) to the effects processing engine, like reverb
|
||||
int volumeRightSend;
|
||||
|
||||
void Reset();
|
||||
|
||||
void KeyOn();
|
||||
void KeyOff();
|
||||
|
||||
void ChangedParams(bool changedVag);
|
||||
|
||||
s16 resampleHist[2];
|
||||
|
||||
ADSREnvelope envelope;
|
||||
|
|
Loading…
Add table
Reference in a new issue