Initial Sound Implementation (#1325)

This commit is contained in:
Ziemas
2022-05-19 22:54:36 +02:00
committed by GitHub
parent be976d2e69
commit 07cc0ddc35
377 changed files with 108012 additions and 338 deletions
+90
View File
@@ -4,6 +4,7 @@
#include "common/log/log.h"
#include "sbank.h"
#include "common/util/Assert.h"
#include "iso_queue.h"
using namespace iop;
@@ -106,3 +107,92 @@ void LoadMusic(const char* music_name, s32* bank) {
gMusicTweak = 0x80;
}
void QueueVAGStream(FileRecord* file, VagDirEntry* vag, u32 sound_id, u32 priority) {
if (vag == nullptr) {
return;
}
auto* cmd = GetVAGCommand();
cmd->cmd_id = QUEUE_VAG_STREAM;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
cmd->file = file;
cmd->vag = vag;
cmd->sound_id = sound_id;
cmd->priority = priority;
cmd->positioned = 0;
SendMbx(iso_mbx, cmd);
}
void PlayVAGStream(FileRecord* file,
VagDirEntry* vag,
u32 sound_id,
s32 volume,
u32 priority,
Vec3w* trans) {
auto cmd = GetVAGCommand();
cmd->cmd_id = PLAY_VAG_STREAM;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
cmd->file = file;
cmd->vag = vag;
cmd->sound_id = sound_id;
cmd->volume = volume;
cmd->priority = priority;
if (trans) {
cmd->trans = *trans;
cmd->positioned = 1;
} else {
cmd->positioned = 0;
}
SendMbx(iso_mbx, cmd);
}
void SetVAGStreamVolume(s32 volume) {
auto cmd = GetVAGCommand();
cmd->cmd_id = 1029;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
cmd->volume = volume;
SendMbx(iso_mbx, cmd);
}
void SetDialogVolume(s32 volume) {
auto cmd = GetVAGCommand();
cmd->cmd_id = 1030;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
cmd->volume = volume;
SendMbx(iso_mbx, cmd);
}
void StopVAGStream(VagDirEntry* vag, u32 priority) {
auto cmd = GetVAGCommand();
cmd->cmd_id = STOP_VAG_STREAM;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
cmd->vag = vag;
cmd->priority = priority;
SendMbx(iso_mbx, cmd);
}
void PauseVAGStream() {
auto cmd = GetVAGCommand();
cmd->cmd_id = 1027;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
SendMbx(iso_mbx, cmd);
}
void UnpauseVAGStream() {
auto cmd = GetVAGCommand();
cmd->cmd_id = 1028;
cmd->messagebox_to_reply = 0;
cmd->thread_id = 0;
SendMbx(iso_mbx, cmd);
}