mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 10:01:46 +00:00
fix ext sound bank crash when instId > 0x83
This commit is contained in:
parent
7ec6c77e1c
commit
4284e389a9
1 changed files with 12 additions and 12 deletions
|
|
@ -212,7 +212,7 @@ struct SequenceChannel *allocate_sequence_channel(void) {
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOG_ERROR("RAN OUT OF SEQUENCE CHANNELS FOR ALLOCATION!");
|
||||
return &gSequenceChannelNone;
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ void sequence_player_init_channels_extended(struct SequencePlayer* seqPlayer, u6
|
|||
if (!seqPlayer) { return; }
|
||||
u64 channelBits = channelBitsLower;
|
||||
LOG_DEBUG("Enabling channels (extended) with corresponding bits %llX", channelBits);
|
||||
|
||||
|
||||
for (u32 i = 0; i < CHANNELS_MAX; i++) {
|
||||
if (i == sizeof(u64) * 8) {
|
||||
channelBits = channelBitsUpper;
|
||||
|
|
@ -350,9 +350,9 @@ void sequence_player_disable_channels_extended(struct SequencePlayer* seqPlayer,
|
|||
|
||||
void sequence_player_disable_all_channels(struct SequencePlayer *seqPlayer) {
|
||||
if (!seqPlayer) { return; }
|
||||
|
||||
|
||||
MUTEX_LOCK(gAudioThread);
|
||||
|
||||
|
||||
eu_stubbed_printf_0("SUBTRACK DIM\n");
|
||||
for (u32 i = 0; i < CHANNELS_MAX; i++) {
|
||||
struct SequenceChannel *seqChannel = seqPlayer->channels[i];
|
||||
|
|
@ -371,16 +371,16 @@ void sequence_player_disable_all_channels(struct SequencePlayer *seqPlayer) {
|
|||
seqPlayer->channels[i] = &gSequenceChannelNone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MUTEX_UNLOCK(gAudioThread);
|
||||
}
|
||||
|
||||
void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex, void *script) {
|
||||
if (!seqPlayer) { return; }
|
||||
if (channelIndex >= CHANNELS_MAX) { return; }
|
||||
|
||||
|
||||
MUTEX_LOCK(gAudioThread);
|
||||
|
||||
|
||||
struct SequenceChannel *seqChannel = seqPlayer->channels[channelIndex];
|
||||
s32 i;
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) == FALSE) {
|
||||
|
|
@ -409,19 +409,19 @@ void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex,
|
|||
seq_channel_layer_free(seqChannel, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LOG_DEBUG("Enabled sequence channel %d with script entry of %p", channelIndex, script);
|
||||
}
|
||||
|
||||
|
||||
MUTEX_UNLOCK(gAudioThread);
|
||||
}
|
||||
|
||||
void sequence_player_disable(struct SequencePlayer *seqPlayer) {
|
||||
if (!seqPlayer) { return; }
|
||||
MUTEX_LOCK(gAudioThread);
|
||||
|
||||
|
||||
LOG_DEBUG("Disabling sequence player %p", seqPlayer);
|
||||
|
||||
|
||||
sequence_player_disable_all_channels(seqPlayer);
|
||||
note_pool_clear(&seqPlayer->notePool);
|
||||
seqPlayer->finished = TRUE;
|
||||
|
|
@ -1620,7 +1620,7 @@ u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrume
|
|||
}
|
||||
|
||||
void set_instrument(struct SequenceChannel *seqChannel, u8 instId) {
|
||||
if (instId >= 0x80) {
|
||||
if (instId >= 0x80 && instId <= 0x83) {
|
||||
seqChannel->instOrWave = instId;
|
||||
seqChannel->instrument = NULL;
|
||||
} else if (instId == 0x7f) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue