Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio_seqplayer.c cleanup #1274

Merged
merged 16 commits into from
Jun 21, 2022
Prev Previous commit
Next Next commit
Merge branch 'master' into seqplayer_cleanup
engineer124 committed Jun 4, 2022
commit 966be03aa7da638ab19f81e3ee80197b1c07c400
2 changes: 1 addition & 1 deletion src/code/audio_load.c
Original file line number Diff line number Diff line change
@@ -565,7 +565,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) {
seqPlayer->scriptState.pc = seqData;
seqPlayer->scriptState.depth = 0;
seqPlayer->delay = 0;
seqPlayer->finished = 0;
seqPlayer->finished = false;
seqPlayer->playerIndex = playerIndex;
AudioSeq_SkipForwardSequence(seqPlayer);
//! @bug missing return (but the return value is not used so it's not UB)
19 changes: 10 additions & 9 deletions src/code/audio_seqplayer.c
Original file line number Diff line number Diff line change
@@ -731,7 +731,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
case 0xCB:
cmdArg16 = AudioSeq_ScriptReadS16(state);
layer->adsr.envelope = (AdsrEnvelope*)(seqPlayer->seqData + cmdArg16);
// fallthrough
FALLTHROUGH;
case 0xCF:
layer->adsr.decayIndex = AudioSeq_ScriptReadU8(state);
break;
@@ -746,7 +746,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {

case 0xCE:
cmdArg8 = AudioSeq_ScriptReadU8(state);
layer->unk_34 = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)];
layer->bend = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)];
break;

default:
@@ -936,7 +936,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
}

layer->delay2 = layer->delay;
layer->freqScale *= layer->unk_34;
layer->freqScale *= layer->bend;

if (layer->delay == 0) {
if (layer->sound != NULL) {
@@ -1247,7 +1247,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}

cmdArgs[0] = cmdArgs[1];
// fallthrough
FALLTHROUGH;
case 0xC1:
cmd = (u8)cmdArgs[0];
AudioSeq_SetInstrument(channel, cmd);
@@ -1504,7 +1504,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->vibratoRateStart = 0;
channel->vibratoRateChangeDelay = 0;
channel->filter = NULL;
channel->unk_0C = 0;
channel->gain = 0;
channel->adsr.sustain = 0;
channel->velocityRandomVariance = 0;
channel->gateTimeRandomVariance = 0;
@@ -1520,7 +1520,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {

case 0xED:
cmd = (u8)cmdArgs[0];
channel->unk_0C = cmd;
channel->gain = cmd;
break;

case 0xB0:
@@ -1532,6 +1532,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0xB1:
channel->filter = NULL;
break;

case 0xB3:
cmd = cmdArgs[0];

@@ -1796,7 +1797,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {

case 0xDF:
seqPlayer->transposition = 0;
// fallthrough
FALLTHROUGH;
case 0xDE:
seqPlayer->transposition += (s8)AudioSeq_ScriptReadU8(seqScript);
break;
@@ -1842,7 +1843,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 1:
seqPlayer->state = 0;
seqPlayer->fadeVolume = 0.0f;
// fallthrough
FALLTHROUGH;
case 0:
seqPlayer->fadeTimer = seqPlayer->fadeTimerUnkEu;
if (seqPlayer->fadeTimerUnkEu != 0) {
@@ -2086,7 +2087,7 @@ void AudioSeq_InitSequencePlayerChannels(s32 playerIndex) {
s32 j;

for (i = 0; i < ARRAY_COUNT(seqPlayer->channels); i++) {
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioContext.notesAndBuffersPool, sizeof(SequenceChannel));
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(SequenceChannel));
if (seqPlayer->channels[i] == NULL) {
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone;
} else {
You are viewing a condensed version of this merge commit. You can view the full changes here.