mirror of
https://github.com/open-goal/jak-project
synced 2026-09-09 04:10:23 -04:00
Initial Sound Implementation (#1325)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user