mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-20 21:33:40 -07:00
fixes
This commit is contained in:
parent
a2993a3430
commit
d9760694d8
15 changed files with 134 additions and 139 deletions
1
soh/include/dr_libs
Submodule
1
soh/include/dr_libs
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 9cb7092ac8c75a82b5c6ea72652ca8d0091d7ffa
|
|
@ -1,4 +1,6 @@
|
|||
#include "ActorAccessibility.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
#include <map>
|
||||
#include <random>
|
||||
|
||||
|
@ -25,9 +27,9 @@ extern "C" {
|
|||
void EnKarebaba_DeadItemDrop(EnKarebaba*, PlayState*);
|
||||
}
|
||||
//Declarations specific to Torches
|
||||
#include "overlays\actors\ovl_Obj_Syokudai\z_obj_syokudai.h"
|
||||
#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h"
|
||||
//Declarations specific to dogs
|
||||
#include "overlays\actors\ovl_En_Dog\z_en_dog.h"
|
||||
#include "overlays/actors/ovl_En_Dog/z_en_dog.h"
|
||||
extern "C" {
|
||||
void EnDog_FollowPlayer(EnDog*, PlayState*);
|
||||
s8 EnDog_CanFollow(EnDog*, PlayState*);
|
||||
|
@ -303,7 +305,7 @@ void accessible_area_change(AccessibleActor* actor) {
|
|||
//kakariko village attenuation
|
||||
else if (actor->play->sceneNum == 82) {
|
||||
if (actor->sceneIndex == 83 || actor->sceneIndex == 81 || actor->sceneIndex == 96) {
|
||||
actor->policy.runsAlways == true;
|
||||
actor->policy.runsAlways = true;
|
||||
actor->policy.ydist = 5000;
|
||||
if (actor->xzDistToPlayer > 700) {
|
||||
if (actor->sceneIndex == 81) {
|
||||
|
@ -650,9 +652,9 @@ void accessible_audio_compass_cleanup(AccessibleActor* actor)
|
|||
}
|
||||
void accessible_audio_compass(AccessibleActor* actor) {
|
||||
Player* player = GET_PLAYER(actor->play);
|
||||
if (player->stateFlags1 & PLAYER_STATE1_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||
if (player->stateFlags1 & PLAYER_STATE1_Z_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||
return;
|
||||
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
||||
OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
|
||||
AudioCompassData* data = (AudioCompassData*)actor->userData;
|
||||
bool compassCombo = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttonList[11] &&
|
||||
trackerButtonsPressed[0].button & buttonList[6];
|
||||
|
@ -671,7 +673,7 @@ void accessible_audio_compass(AccessibleActor* actor) {
|
|||
|
||||
|
||||
/* Player* player = GET_PLAYER(actor->play);
|
||||
if (player->stateFlags1 & PLAYER_STATE1_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||
if (player->stateFlags1 & PLAYER_STATE1_Z_TARGETING || player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)
|
||||
return;
|
||||
|
||||
actor->world.pos = player->actor.world.pos;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ActorAccessibility.h"
|
||||
#include "AccessibleAudioEngine.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "resource/type/Blob.h"
|
||||
|
||||
#include <map>
|
||||
#include <random>
|
||||
|
@ -55,9 +56,8 @@ typedef std::unordered_set<s16> SceneList_t;//A list of scenes which have alread
|
|||
|
||||
typedef struct {
|
||||
std::string path;
|
||||
std::shared_ptr<LUS::File> resource;
|
||||
std::shared_ptr<Ship::IResource> resource;
|
||||
std::shared_ptr<s16*> decodedSample;//Set if the record is for a raw sample as opposed to a SFX.
|
||||
|
||||
}SfxRecord;
|
||||
|
||||
class AudioGlossaryData {
|
||||
|
@ -425,7 +425,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
return;
|
||||
if (actor->policy.aimAssist.isProvider) {
|
||||
if (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON &&
|
||||
(player->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND ||
|
||||
(player->stateFlags1 & PLAYER_STATE1_USING_BOOMERANG ||
|
||||
player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND)) {
|
||||
ActorAccessibility_SetSoundPitch(actor, 9, actor->aimAssist.pitch);
|
||||
actor->aimAssist.framesSinceAimAssist++;
|
||||
|
@ -527,7 +527,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
return;
|
||||
}
|
||||
|
||||
OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads();
|
||||
OSContPad* trackerButtonsPressed = std::dynamic_pointer_cast<LUS::ControlDeck>(Ship::Context::GetInstance()->GetControlDeck())->GetPads();
|
||||
bool comboStartGlossary = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & buttons[10] &&
|
||||
trackerButtonsPressed[0].button & buttons[6];
|
||||
if (comboStartGlossary) {
|
||||
|
@ -750,7 +750,7 @@ int ActorAccessibility_GetRandomStartingFrameCount(int min, int max) {
|
|||
{
|
||||
SfxRecord tempRecord;
|
||||
std::string fullPath = SfxExtractor::getExternalFileName(sfxId);
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(fullPath);
|
||||
auto res = std::static_pointer_cast<Ship::Blob>(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath));
|
||||
|
||||
if(res == nullptr)
|
||||
return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
||||
|
@ -760,8 +760,8 @@ return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
|||
tempRecord.path = ss.str();
|
||||
aa->sfxMap[sfxId] = tempRecord;
|
||||
record = &aa->sfxMap[sfxId];
|
||||
aa->audioEngine->cacheDecodedSample(record->path, record->resource->Buffer.data(),
|
||||
record->resource->Buffer.size());
|
||||
aa->audioEngine->cacheDecodedSample(record->path, record->resource->GetRawPointer(),
|
||||
record->resource->GetPointerSize());
|
||||
} else
|
||||
record = &it->second;
|
||||
|
||||
|
@ -780,11 +780,11 @@ return NULL;//Resource doesn't exist, user's gotta run the extractor.
|
|||
std::stringstream ss;
|
||||
ss << "audio/samples/" << key;
|
||||
std::string fullPath = ss.str();
|
||||
auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath);
|
||||
auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fullPath);
|
||||
if (res == nullptr)
|
||||
return NULL; // Resource doesn't exist, user's gotta run the extractor.
|
||||
AudioDecoder decoder;
|
||||
decoder.setSample((LUS::AudioSample*)res.get());
|
||||
decoder.setSample((SOH::AudioSample*)res.get());
|
||||
s16* wav;
|
||||
size_t wavSize = decoder.decodeToWav(&wav);
|
||||
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
#include "SfxExtractor.h"
|
||||
#include "dr_libs/wav.h"
|
||||
#include "dr_libs/dr_wav.h"
|
||||
#include "soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h"
|
||||
#include "soh/Enhancements/tts/tts.h"
|
||||
#include "miniaudio.h"
|
||||
#include "z64.h"
|
||||
#include "functions.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
#include "SfxTable.h"
|
||||
#include <sstream>
|
||||
const char* GetLanguageCode();
|
||||
extern "C" {
|
||||
extern Vec3f D_801333D4;
|
||||
extern f32 D_801333E0;
|
||||
extern s8 D_801333E8;
|
||||
extern u8 D_801333F0;
|
||||
#include "z64.h"
|
||||
#include "functions.h"
|
||||
#include "variables.h"
|
||||
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||
extern bool freezeGame;
|
||||
}
|
||||
|
@ -57,8 +54,8 @@ void SfxExtractor::setEndOfInput() {
|
|||
endOfInput -= 2;
|
||||
}
|
||||
}
|
||||
void SfxExtractor::renderOutput() {
|
||||
|
||||
void SfxExtractor::renderOutput() {
|
||||
ma_channel_converter_config config =
|
||||
ma_channel_converter_config_init(ma_format_s16, 2, NULL, 1, NULL, ma_channel_mix_mode_default);
|
||||
ma_channel_converter converter;
|
||||
|
@ -88,10 +85,11 @@ void SfxExtractor::renderOutput() {
|
|||
mark += thisChunk;
|
||||
}
|
||||
drwav_uninit(&wav);
|
||||
archive->AddFile(fileName.c_str(), (uintptr_t)mem, size);
|
||||
|
||||
std::vector<uint8_t> fileData((uint8_t*)mem, (uint8_t*)mem + size);
|
||||
drwav_free(mem, NULL);
|
||||
archive->WriteFile(fileName.c_str(), fileData);
|
||||
}
|
||||
|
||||
void SfxExtractor::setup() {
|
||||
try {
|
||||
|
||||
|
@ -100,7 +98,7 @@ void SfxExtractor::setup() {
|
|||
captureThreadState = CT_WAITING;
|
||||
OTRAudio_InstallSfxCaptureThread();
|
||||
// Make sure we're starting from a clean slate.
|
||||
std::string sohAccessibilityPath = LUS::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||
std::string sohAccessibilityPath = Ship::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||
if (std::filesystem::exists(sohAccessibilityPath)) {
|
||||
currentStep = STEP_ERROR_OTR;
|
||||
return;
|
||||
|
@ -114,9 +112,10 @@ void SfxExtractor::setup() {
|
|||
sfxToRip.push(sfxTable[i]);
|
||||
|
||||
currentStep = STEP_MAIN;
|
||||
for (int i = 1; i < 10; i++)
|
||||
for (int i = 1; i < 10; i++) {
|
||||
progressMilestones[i - 1] = sfxToRip.size() - ((int)ceil(sfxToRip.size() * (i / 10.0f)));
|
||||
archive = LUS::Archive::CreateArchive("accessibility.otr", sfxToRip.size());
|
||||
}
|
||||
archive = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->AddArchive("accessibility.otr");
|
||||
|
||||
} catch (...) { currentStep = STEP_ERROR; }
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ void SfxExtractor::ripNextSfx() {
|
|||
// Was the last sfx a loop? If so then we need to stop it, and then we need to run audio out to nowhere for as long
|
||||
// as it takes to get back to a blank slate.
|
||||
if (currentSfx != -1) {
|
||||
Audio_StopSfxByPos(&D_801333D4);
|
||||
Audio_StopSfxByPos(&gSfxDefaultPos);
|
||||
captureThreadState = CT_PRIMING;
|
||||
currentSfx = -1;
|
||||
|
||||
|
@ -144,7 +143,7 @@ void SfxExtractor::ripNextSfx() {
|
|||
sfxToRip.pop();
|
||||
startOfInput = 0;
|
||||
endOfInput = 0;
|
||||
Audio_PlaySoundGeneral(currentSfx, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
Audio_PlaySoundGeneral(currentSfx, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
||||
{
|
||||
auto lock = OTRAudio_Lock();
|
||||
|
@ -162,8 +161,8 @@ void SfxExtractor::finished() {
|
|||
Audio_QueueSeqCmd(NA_BGM_TITLE);
|
||||
|
||||
if (currentStep == STEP_ERROR || currentStep == STEP_ERROR_OTR) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
Audio_PlaySoundGeneral(NA_SE_EN_GANON_LAUGH, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
std::stringstream ss;
|
||||
ss << "Sorry, we tried to extract the sound effects, but Ganondorf overruled us with an iron fist."
|
||||
<< std::endl;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "libultraship/libultraship.h"
|
||||
class SfxExtractor {
|
||||
std::shared_ptr<LUS::Archive> archive;
|
||||
std::shared_ptr<Ship::Archive> archive;
|
||||
int currentStep;
|
||||
int captureThreadState;
|
||||
std::queue<s16> sfxToRip;
|
||||
|
|
|
@ -292,7 +292,7 @@ class Wall: protected TerrainCueSound {
|
|||
play();
|
||||
ActorAccessibility_SeekSound(this, 0, 44100 * 2);
|
||||
}
|
||||
f32 pitchModifier;
|
||||
f32 pitchModifier = 0.0;
|
||||
|
||||
if (targetPitch < 0)
|
||||
pitchModifier = LERP(2.5, 0.5 + targetPitch, (f32)frames / 20.0f);
|
||||
|
@ -396,13 +396,12 @@ class Lava : protected TerrainCueSound {
|
|||
f32 probeSpeed; // Approximate for now.
|
||||
Vec3f velocity;
|
||||
Vec3f expectedVelocity;
|
||||
int terrainDiscovered;
|
||||
int terrainDiscovered = DISCOVERED_NOTHING;
|
||||
CollisionPoly* floorPoly;
|
||||
CollisionPoly* wallPoly;
|
||||
s32 wallBgId;
|
||||
f32 wallHeight;
|
||||
s32 floorBgId;
|
||||
f32 yDistToWater;
|
||||
f32 pushedSpeed;
|
||||
bool disabled; // Only used for debugging.
|
||||
bool trackingMode; // A debugging feature which forces Link to move along the probe's path. Used to catch collision
|
||||
|
@ -549,7 +548,7 @@ class Lava : protected TerrainCueSound {
|
|||
return wallHeight;
|
||||
}
|
||||
D_80854798.y = 18.0f;
|
||||
D_80854798.z = player->ageProperties->unk_38 + 10.0f;
|
||||
D_80854798.z = player->ageProperties->wallCheckRadius + 10.0f;
|
||||
f32 wallYaw = Math_Atan2S(poly->normal.z, poly->normal.x);
|
||||
f32 nx = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
f32 ny = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
|
@ -583,7 +582,7 @@ class Lava : protected TerrainCueSound {
|
|||
// passing in the real player with a temporarily modified pos vector, I'm using this fake player instance
|
||||
// instead. These functions only need the player's position and shape rotation vectors set.
|
||||
if (Player_PosVsWallLineTest(actor->play, &fakePlayer, &D_80854798, &testPoly, &bgId, &collisionResult) &&
|
||||
abs(wallYaw - Math_Atan2S(testPoly->normal.z, testPoly->normal.x)) < 0x4000 &&
|
||||
std::abs(wallYaw - Math_Atan2S(testPoly->normal.z, testPoly->normal.x)) < 0x4000 &&
|
||||
!func_80041E18(&actor->play->colCtx, testPoly, bgId)) {
|
||||
wallHeight = 399.96002f;
|
||||
}
|
||||
|
@ -702,7 +701,7 @@ class Lava : protected TerrainCueSound {
|
|||
floorHeight = BgCheck_EntityRaycastFloor3(&actor->play->colCtx, &floorPoly, &floorBgId, &pos);
|
||||
if ((floorHeight - playerHeight) > 100.0) {
|
||||
destroyCurrentSound();
|
||||
pos.y - floorHeight;
|
||||
pos.y -= floorHeight; // TODO remove?
|
||||
platform.setPosition(pos);
|
||||
platform.run();
|
||||
return true;
|
||||
|
@ -874,9 +873,9 @@ class Lava : protected TerrainCueSound {
|
|||
wallCheckHeight = 15.0f;
|
||||
ceilingCheckHeight = 30.0f;
|
||||
} else {
|
||||
wallCheckRadius = player->ageProperties->unk_38;
|
||||
wallCheckRadius = player->ageProperties->wallCheckRadius;
|
||||
wallCheckHeight = 26.0f;
|
||||
ceilingCheckHeight = player->ageProperties->unk_00;
|
||||
ceilingCheckHeight = player->ageProperties->ceilingCheckHeight;
|
||||
}
|
||||
// The virtual cue actors travel in lines relative to Link's angle.
|
||||
rot = ActorAccessibility_ComputeRelativeAngle(&player->actor.world.rot, &relRot);
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
#include "AudioDecoder.h"
|
||||
#include "z64audio.h"
|
||||
#include "dr_libs/wav.h"
|
||||
#define DR_WAV_IMPLEMENTATION
|
||||
#include "dr_libs/dr_wav.h"
|
||||
#include <stdexcept>
|
||||
#define WAV_DECODE_CHUNK_SIZE 64
|
||||
//A handful of definitions need to be copied from mixer.c.
|
||||
// A handful of definitions need to be copied from mixer.c.
|
||||
#define ROUND_UP_32(v) (((v) + 31) & ~31)
|
||||
//The below is copied verbatim from mixer.c.
|
||||
// The below is copied verbatim from mixer.c.
|
||||
static inline int16_t clamp16(int32_t v) {
|
||||
if (v < -0x8000) {
|
||||
return -0x8000;
|
||||
} else if (v > 0x7fff) {
|
||||
return 0x7fff;
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
AudioDecoder::AudioDecoder() {
|
||||
AudioDecoder::AudioDecoder() {
|
||||
prev1 = 0;
|
||||
prev2 = 0;
|
||||
|
||||
}
|
||||
AudioDecoder::~AudioDecoder()
|
||||
{
|
||||
|
||||
}
|
||||
void AudioDecoder::setSample(LUS::AudioSample* sample)
|
||||
{
|
||||
AudioDecoder::~AudioDecoder() {
|
||||
}
|
||||
void AudioDecoder::setSample(SOH::AudioSample* sample) {
|
||||
this->sample.codec = sample->sample.codec;
|
||||
this->sample.loop.start = sample->sample.loop->start;
|
||||
this->sample.loop.end = sample->sample.loop->end;
|
||||
|
@ -34,7 +33,7 @@ void AudioDecoder::setSample(LUS::AudioSample* sample)
|
|||
memset(adpcm_table, 0, 8 * 2 * 8 * 2);
|
||||
else
|
||||
memcpy(adpcm_table, sample->sample.book->book,
|
||||
16 * sample->sample.book->order * sample->sample.book->npredictors);
|
||||
16 * sample->sample.book->order * sample->sample.book->npredictors);
|
||||
prev1 = 0;
|
||||
prev2 = 0;
|
||||
in = sample->sample.sampleAddr;
|
||||
|
@ -50,15 +49,14 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
|||
if (sample->book->book == nullptr)
|
||||
memset(adpcm_table, 0, 8 * 2 * 8 * 2);
|
||||
else
|
||||
memcpy(adpcm_table, sample->book->book,
|
||||
16 * sample->book->order * sample->book->npredictors);
|
||||
memcpy(adpcm_table, sample->book->book, 16 * sample->book->order * sample->book->npredictors);
|
||||
prev1 = 0;
|
||||
prev2 = 0;
|
||||
in = sample->sampleAddr;
|
||||
inStart = in;
|
||||
inEnd = in + sample->size;
|
||||
}
|
||||
size_t AudioDecoder::decode(int16_t * out, size_t nSamples) {
|
||||
size_t AudioDecoder::decode(int16_t* out, size_t nSamples) {
|
||||
size_t samplesOut = 0;
|
||||
size_t nbytes = nSamples * 2;
|
||||
// Prevent the decoder from using more output bytes than declared to be available by the callee.
|
||||
|
@ -94,7 +92,6 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
|||
acc >>= 11;
|
||||
*out++ = clamp16(acc);
|
||||
samplesOut++;
|
||||
|
||||
}
|
||||
prev1 = out[-1];
|
||||
prev2 = out[-2];
|
||||
|
@ -102,11 +99,9 @@ void AudioDecoder::setSample(SoundFontSample* sample) {
|
|||
nbytes -= 16 * sizeof(int16_t);
|
||||
}
|
||||
return samplesOut;
|
||||
|
||||
}
|
||||
|
||||
size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
||||
{
|
||||
size_t AudioDecoder::decodeToWav(int16_t** buffer) {
|
||||
int16_t* wavOut = nullptr;
|
||||
|
||||
drwav_data_format format;
|
||||
|
@ -114,7 +109,8 @@ size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
|||
format.channels = 1;
|
||||
format.container = drwav_container_riff;
|
||||
format.format = DR_WAVE_FORMAT_PCM;
|
||||
//Todo: figure out how to really determine the sample rate. CODEC_ADPCM tends to stream at higher rates (usually 20KHZ) while CODEC_SMALL_ADPCM is usually around 14000. They're still not consistent though.
|
||||
// Todo: figure out how to really determine the sample rate. CODEC_ADPCM tends to stream at higher rates (usually
|
||||
// 20KHZ) while CODEC_SMALL_ADPCM is usually around 14000. They're still not consistent though.
|
||||
if (sample.codec == CODEC_ADPCM)
|
||||
format.sampleRate = 20000;
|
||||
else if (sample.codec = CODEC_SMALL_ADPCM)
|
||||
|
@ -123,12 +119,12 @@ size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
|||
throw std::runtime_error("AudioDecoder: Unsupported codec.");
|
||||
drwav wav;
|
||||
size_t wavSize;
|
||||
if (!drwav_init_memory_write(&wav, (void**) &wavOut, &wavSize, &format, nullptr))
|
||||
if (!drwav_init_memory_write(&wav, (void**)&wavOut, &wavSize, &format, nullptr))
|
||||
throw std::runtime_error("AudioDecoder: Unable to initialize wave writer.");
|
||||
int16_t chunk[WAV_DECODE_CHUNK_SIZE];
|
||||
//Don't decode past the end of the loop.
|
||||
// Don't decode past the end of the loop.
|
||||
size_t samplesLeft = sample.loop.end;
|
||||
//Unless the loop is 0?
|
||||
// Unless the loop is 0?
|
||||
if (samplesLeft == 0)
|
||||
samplesLeft = sample.loop.count;
|
||||
|
||||
|
@ -145,10 +141,8 @@ size_t AudioDecoder::decodeToWav (int16_t** buffer)
|
|||
throw std::runtime_error("AudioDecoder: Unable to write wave data.");
|
||||
}
|
||||
samplesLeft -= samplesRead;
|
||||
|
||||
}
|
||||
drwav_uninit(&wav);
|
||||
*buffer = wavOut;
|
||||
return wavSize;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
#pragma once
|
||||
//A standalone, incremental audio sample decoder.
|
||||
//Based on the ADPCM decoding routines in mixer.c.
|
||||
// A standalone, incremental audio sample decoder.
|
||||
// Based on the ADPCM decoding routines in mixer.c.
|
||||
|
||||
#include "libultraship/libultraship.h"
|
||||
#include "soh/resource/type/AudioSample.h"
|
||||
#include "z64audio.h"
|
||||
class AudioDecoder
|
||||
{
|
||||
class AudioDecoder {
|
||||
struct {
|
||||
int codec;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
int start;
|
||||
int end;
|
||||
int count;
|
||||
|
||||
}loop;
|
||||
} loop;
|
||||
} sample;
|
||||
|
||||
uint8_t *in, *inStart, *inEnd;
|
||||
int16_t adpcm_table[8][2][8];
|
||||
int16_t prev1, prev2;//The internal decoder takes an array of 16 shorts which it calls ADPCM_STATE. Strictly speaking only the last two decoded samples are needed for continuation.
|
||||
int16_t prev1, prev2; // The internal decoder takes an array of 16 shorts which it calls ADPCM_STATE. Strictly
|
||||
// speaking only the last two decoded samples are needed for continuation.
|
||||
public:
|
||||
AudioDecoder();
|
||||
~AudioDecoder();
|
||||
//Support both LUS samples and Z64 samples.
|
||||
void setSample(LUS::AudioSample* sample);
|
||||
// Support both SOH samples and Z64 samples.
|
||||
void setSample(SOH::AudioSample* sample);
|
||||
void setSample(SoundFontSample* sample);
|
||||
|
||||
size_t decode(int16_t* out, size_t nSamples);
|
||||
|
|
|
@ -288,12 +288,10 @@ void GameInteractor_ExecuteOnSetGameLanguage() {
|
|||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnSetGameLanguage>();
|
||||
}
|
||||
|
||||
void GameInteractor_ExecuteOnGameStillFrozen()
|
||||
{
|
||||
void GameInteractor_ExecuteOnGameStillFrozen() {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGameStillFrozen>();
|
||||
}
|
||||
|
||||
|
||||
// MARK: - System
|
||||
|
||||
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)) {
|
||||
|
|
|
@ -77,7 +77,6 @@ void GameInteractor_ExecuteOnSetGameLanguage();
|
|||
|
||||
void GameInteractor_ExecuteOnGameStillFrozen();
|
||||
|
||||
|
||||
// MARK: - System
|
||||
void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void));
|
||||
|
||||
|
|
|
@ -127,11 +127,17 @@ Sail* Sail::Instance;
|
|||
#include "soh/resource/importer/BackgroundFactory.h"
|
||||
|
||||
#include "soh/config/ConfigUpdaters.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||
#include "Enhancements/accessible-actors/ActorAccessibility.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Dns/z_en_dns.h"
|
||||
}
|
||||
|
||||
void SoH_ProcessDroppedFiles(std::string filePath);
|
||||
|
||||
OTRGlobals* OTRGlobals::Instance;
|
||||
SaveManager* SaveManager::Instance;
|
||||
CustomMessageManager* CustomMessageManager::Instance;
|
||||
|
@ -288,7 +294,7 @@ OTRGlobals::OTRGlobals() {
|
|||
}
|
||||
}
|
||||
|
||||
std::string sohAccessibilityPath = LUS::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||
std::string sohAccessibilityPath = Ship::Context::GetPathRelativeToAppDirectory("accessibility.otr");
|
||||
if (std::filesystem::exists(sohAccessibilityPath)) {
|
||||
OTRFiles.push_back(sohAccessibilityPath);
|
||||
}
|
||||
|
|
|
@ -196,12 +196,12 @@ void SohMenu::AddMenuSettings() {
|
|||
.RaceDisable(false)
|
||||
.Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle."));
|
||||
|
||||
AddWidget(path "Accessible Audio Cues", WIDGET_CVAR_CHECKBOX)
|
||||
AddWidget(path, "Accessible Audio Cues", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar("gA11yAudioInteraction")
|
||||
.RaceDisable(false)
|
||||
.Options(CheckboxOptions().Tooltip("Enables accessibility audio cues"));
|
||||
|
||||
AddWidget(path "Extract Sfx", WIDGET_CVAR_CHECKBOX)
|
||||
AddWidget(path, "Extract Sfx", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar("gExtractSfx")
|
||||
.RaceDisable(false)
|
||||
.Options(CheckboxOptions().Tooltip("Extracts the sfx to be used in accessible audio cues, must be run once for the audio cues to play then restart game"));
|
||||
|
|
|
@ -374,7 +374,7 @@ extern f32 D_80130F28;
|
|||
|
||||
void Audio_QueueSeqCmd(u32 cmd) {
|
||||
if (freezeGame)
|
||||
return;//No music during SFX rip.
|
||||
return; // No music during SFX rip.
|
||||
//
|
||||
u8 op = cmd >> 28;
|
||||
if (op == 0 || op == 2 || op == 12) {
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
#include "textures/place_title_cards/g_pn_56.h"
|
||||
#include "textures/place_title_cards/g_pn_57.h"
|
||||
#endif
|
||||
bool freezeActors= false;
|
||||
bool freezeActors = false;
|
||||
|
||||
static CollisionPoly* sCurCeilingPoly;
|
||||
static s32 sCurCeilingBgId;
|
||||
|
@ -2559,8 +2559,6 @@ u32 D_80116068[ACTORCAT_MAX] = {
|
|||
|
||||
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
||||
|
||||
|
||||
|
||||
Actor* refActor;
|
||||
Actor* actor;
|
||||
Player* player;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
bool freezeGame = false;//Used for SFX ripper.
|
||||
bool freezeGame = false; // Used for SFX ripper.
|
||||
TransitionUnk sTrnsnUnk;
|
||||
s32 gTrnsnUnkState;
|
||||
VisMono gPlayVisMono;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue