mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 22:33:43 -07:00
Fix two conflicts.
This commit is contained in:
commit
98ee23a33a
10 changed files with 63 additions and 13 deletions
|
@ -167,6 +167,11 @@ else()
|
||||||
list(FILTER soh__Enhancements EXCLUDE REGEX "soh/Enhancements/speechsynthesizer/(Darwin|SAPI).*")
|
list(FILTER soh__Enhancements EXCLUDE REGEX "soh/Enhancements/speechsynthesizer/(Darwin|SAPI).*")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# handle accessible audio engine removals
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS")
|
||||||
|
list(FILTER soh__Enhancements EXCLUDE REGEX "soh/Enhancements/accessible-actors/*")
|
||||||
|
endif()
|
||||||
|
|
||||||
source_group("soh\\Enhancements" REGULAR_EXPRESSION "soh/Enhancements/*")
|
source_group("soh\\Enhancements" REGULAR_EXPRESSION "soh/Enhancements/*")
|
||||||
source_group("soh\\Enhancements\\audio" REGULAR_EXPRESSION "soh/Enhancements/audio/*")
|
source_group("soh\\Enhancements\\audio" REGULAR_EXPRESSION "soh/Enhancements/audio/*")
|
||||||
source_group("soh\\Enhancements\\controls" REGULAR_EXPRESSION "soh/Enhancements/controls/*")
|
source_group("soh\\Enhancements\\controls" REGULAR_EXPRESSION "soh/Enhancements/controls/*")
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include "overlays\actors\ovl_Boss_Goma\z_boss_goma.h"
|
#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h"
|
||||||
|
|
||||||
//Declarations specific to chests.
|
//Declarations specific to chests.
|
||||||
#include "overlays/actors/ovl_En_Box/z_en_box.h"
|
#include "overlays/actors/ovl_En_Box/z_en_box.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef float f32;
|
||||||
typedef int8_t s8;
|
typedef int8_t s8;
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
//Processing for our custom audio positioning.
|
//Processing for our custom audio positioning.
|
||||||
static float lerp(float x, float y, float z) {
|
static float lerp_aae(float x, float y, float z) {
|
||||||
return (1.0 - z) * x + z * y;
|
return (1.0 - z) * x + z * y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ static float lerp(float x, float y, float z) {
|
||||||
return 0;
|
return 0;
|
||||||
float leftover = ma_volume_db_to_linear(AAE_MAX_DB_REDUCTION);
|
float leftover = ma_volume_db_to_linear(AAE_MAX_DB_REDUCTION);
|
||||||
float normDist = fabs(extras->distToPlayer) / extras->maxDistance;
|
float normDist = fabs(extras->distToPlayer) / extras->maxDistance;
|
||||||
float db = lerp(0, AAE_MAX_DB_REDUCTION, normDist);
|
float db = lerp_aae(0, AAE_MAX_DB_REDUCTION, normDist);
|
||||||
float gain = ma_volume_db_to_linear(db);
|
float gain = ma_volume_db_to_linear(db);
|
||||||
gain -= lerp(0, leftover, normDist);
|
gain -= lerp_aae(0, leftover, normDist);
|
||||||
return gain;
|
return gain;
|
||||||
}
|
}
|
||||||
//Borrow the pan calculation from the game itself. Todo: this is technical debt, so copy/ revise it or something at some point.
|
//Borrow the pan calculation from the game itself. Todo: this is technical debt, so copy/ revise it or something at some point.
|
||||||
|
@ -148,7 +148,7 @@ void AccessibleAudioEngine::doPrepare(SoundAction& action)
|
||||||
//This should not loop more than twice.
|
//This should not loop more than twice.
|
||||||
uint32_t nextChunk = nFrames;
|
uint32_t nextChunk = nFrames;
|
||||||
ma_pcm_rb_acquire_write(&preparedOutput, &nextChunk, (void**)&chunk);//Might reduce nextChunk if there isn't enough buffer space available to accommodate the request.
|
ma_pcm_rb_acquire_write(&preparedOutput, &nextChunk, (void**)&chunk);//Might reduce nextChunk if there isn't enough buffer space available to accommodate the request.
|
||||||
uint64_t framesRead = 0;
|
ma_uint64 framesRead = 0;
|
||||||
ma_engine_read_pcm_frames(&engine, chunk, nextChunk, &framesRead);
|
ma_engine_read_pcm_frames(&engine, chunk, nextChunk, &framesRead);
|
||||||
//Even if we get fewer frames than expected, we should still submit a full buffer of silence.
|
//Even if we get fewer frames than expected, we should still submit a full buffer of silence.
|
||||||
if (framesRead < nextChunk)
|
if (framesRead < nextChunk)
|
||||||
|
@ -357,7 +357,7 @@ void AccessibleAudioEngine::postHighPrioritySoundAction(SoundAction& action) {
|
||||||
return;
|
return;
|
||||||
slot->extras.cutoff = action.cutoff;
|
slot->extras.cutoff = action.cutoff;
|
||||||
ma_lpf_config config =
|
ma_lpf_config config =
|
||||||
ma_lpf_config_init(ma_format_f32, AAE_CHANNELS, AAE_SAMPLE_RATE, lerp(0.0, AAE_SAMPLE_RATE / 2, action.cutoff), AAE_LPF_ORDER);
|
ma_lpf_config_init(ma_format_f32, AAE_CHANNELS, AAE_SAMPLE_RATE, lerp_aae(0.0, AAE_SAMPLE_RATE / 2, action.cutoff), AAE_LPF_ORDER);
|
||||||
ma_lpf_reinit(&config, &slot->extras.filter);
|
ma_lpf_reinit(&config, &slot->extras.filter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <condition_variable>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "soh/OTRGlobals.h"
|
#include "soh/OTRGlobals.h"
|
||||||
#include "SfxTable.h"
|
#include "SfxTable.h"
|
||||||
|
#include <sstream>
|
||||||
const char* GetLanguageCode();
|
const char* GetLanguageCode();
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern Vec3f D_801333D4;
|
extern Vec3f D_801333D4;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "z64.h"
|
#include "z64.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include <cmath>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
s32 Player_PosVsWallLineTest(PlayState* play, Player* p, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId,
|
s32 Player_PosVsWallLineTest(PlayState* play, Player* p, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId,
|
||||||
Vec3f* posResult);
|
Vec3f* posResult);
|
||||||
|
|
16
soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp
Normal file
16
soh/soh/Enhancements/speechsynthesizer/SpeechLogger.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "SpeechLogger.h"
|
||||||
|
#include <libultraship/libultraship.h>
|
||||||
|
|
||||||
|
SpeechLogger::SpeechLogger() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpeechLogger::Speak(const char* text, const char* language) {
|
||||||
|
lusprintf(__FILE__, __LINE__, 2, "Spoken Text (%s): %s", language, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SpeechLogger::DoInit() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpeechLogger::DoUninitialize() {
|
||||||
|
}
|
17
soh/soh/Enhancements/speechsynthesizer/SpeechLogger.h
Normal file
17
soh/soh/Enhancements/speechsynthesizer/SpeechLogger.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef SOHSpeechLogger_h
|
||||||
|
#define SOHSpeechLogger_h
|
||||||
|
|
||||||
|
#include "SpeechSynthesizer.h"
|
||||||
|
|
||||||
|
class SpeechLogger : public SpeechSynthesizer {
|
||||||
|
public:
|
||||||
|
SpeechLogger();
|
||||||
|
|
||||||
|
void Speak(const char* text, const char* language);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool DoInit(void);
|
||||||
|
void DoUninitialize(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -36,3 +36,5 @@ class SpeechSynthesizer {
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include "DarwinSpeechSynthesizer.h"
|
#include "DarwinSpeechSynthesizer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "SpeechLogger.h"
|
||||||
|
|
|
@ -120,12 +120,10 @@ GameInteractorSail* GameInteractorSail::Instance;
|
||||||
#include "soh/resource/importer/BackgroundFactory.h"
|
#include "soh/resource/importer/BackgroundFactory.h"
|
||||||
|
|
||||||
#include "soh/config/ConfigUpdaters.h"
|
#include "soh/config/ConfigUpdaters.h"
|
||||||
#include "soh/Enhancements/accessible-actors/ActorAccessibility.h"
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
#include "Enhancements//accessible-actors/ActorAccessibility.h"
|
#include "Enhancements/accessible-actors/ActorAccessibility.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void SoH_ProcessDroppedFiles(std::string filePath);
|
void SoH_ProcessDroppedFiles(std::string filePath);
|
||||||
|
|
||||||
OTRGlobals* OTRGlobals::Instance;
|
OTRGlobals* OTRGlobals::Instance;
|
||||||
SaveManager* SaveManager::Instance;
|
SaveManager* SaveManager::Instance;
|
||||||
CustomMessageManager* CustomMessageManager::Instance;
|
CustomMessageManager* CustomMessageManager::Instance;
|
||||||
|
@ -506,10 +504,11 @@ void OTRAudio_Thread() {
|
||||||
for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
|
for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
|
||||||
AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS),
|
AudioMgr_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS),
|
||||||
num_audio_samples);
|
num_audio_samples);
|
||||||
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
// Give accessibility a chance to merge its own audio in.
|
// Give accessibility a chance to merge its own audio in.
|
||||||
ActorAccessibility_MixAccessibleAudioWithGameAudio(
|
ActorAccessibility_MixAccessibleAudioWithGameAudio(
|
||||||
audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples);
|
audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
||||||
|
|
||||||
|
@ -1113,6 +1112,9 @@ extern "C" void InitOTR() {
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
SpeechSynthesizer::Instance = new SAPISpeechSynthesizer();
|
SpeechSynthesizer::Instance = new SAPISpeechSynthesizer();
|
||||||
SpeechSynthesizer::Instance->Init();
|
SpeechSynthesizer::Instance->Init();
|
||||||
|
#else
|
||||||
|
SpeechSynthesizer::Instance = new SpeechLogger();
|
||||||
|
SpeechSynthesizer::Instance->Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_REMOTE_CONTROL
|
#ifdef ENABLE_REMOTE_CONTROL
|
||||||
|
@ -1122,7 +1124,9 @@ extern "C" void InitOTR() {
|
||||||
|
|
||||||
clearMtx = (uintptr_t)&gMtxClear;
|
clearMtx = (uintptr_t)&gMtxClear;
|
||||||
OTRMessage_Init();
|
OTRMessage_Init();
|
||||||
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
ActorAccessibility_Init();
|
ActorAccessibility_Init();
|
||||||
|
#endif
|
||||||
OTRAudio_Init();
|
OTRAudio_Init();
|
||||||
OTRExtScanner();
|
OTRExtScanner();
|
||||||
VanillaItemTable_Init();
|
VanillaItemTable_Init();
|
||||||
|
@ -1185,7 +1189,9 @@ extern "C" void DeinitOTR() {
|
||||||
}
|
}
|
||||||
SDLNet_Quit();
|
SDLNet_Quit();
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
ActorAccessibility_Shutdown();
|
ActorAccessibility_Shutdown();
|
||||||
|
#endif
|
||||||
// Destroying gui here because we have shared ptrs to LUS objects which output to SPDLOG which is destroyed before these shared ptrs.
|
// Destroying gui here because we have shared ptrs to LUS objects which output to SPDLOG which is destroyed before these shared ptrs.
|
||||||
SohGui::Destroy();
|
SohGui::Destroy();
|
||||||
|
|
||||||
|
@ -2701,7 +2707,9 @@ void OTRAudio_SfxCaptureThread() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||||
|
#if !defined(__SWITCH__) && !defined(__WIIU__)
|
||||||
ActorAccessibility_DoSoundExtractionStep();
|
ActorAccessibility_DoSoundExtractionStep();
|
||||||
|
#endif
|
||||||
audio.processing = false;
|
audio.processing = false;
|
||||||
audio.cv_from_thread.notify_one();
|
audio.cv_from_thread.notify_one();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue