mirror of
https://github.com/HarbourMasters/Starship
synced 2026-08-19 22:31:58 -04:00
Audio: go back to 32 khz to fix issues with portamento.
This commit is contained in:
+17
-15
@@ -1,6 +1,7 @@
|
||||
#include "Engine.h"
|
||||
#include "ui/ImguiUI.h"
|
||||
#include "StringHelper.h"
|
||||
|
||||
#include "libultraship/src/Context.h"
|
||||
#include "resource/type/ResourceType.h"
|
||||
#include "resource/importers/AnimFactory.h"
|
||||
@@ -54,6 +55,7 @@ extern "C" {
|
||||
float gInterpolationStep = 0.0f;
|
||||
#include <sf64thread.h>
|
||||
#include <macros.h>
|
||||
#include "sf64audio_provisional.h"
|
||||
void AudioThread_CreateNextAudioBuffer(int16_t* samples, uint32_t num_samples);
|
||||
}
|
||||
|
||||
@@ -82,11 +84,11 @@ GameEngine::GameEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
this->context =
|
||||
Ship::Context::CreateUninitializedInstance("Starship", "ship", "starship.cfg.json");
|
||||
this->context = Ship::Context::CreateUninitializedInstance("Starship", "ship", "starship.cfg.json");
|
||||
|
||||
this->context->InitConfiguration(); // without this line InitConsoleVariables fails at Config::Reload()
|
||||
this->context->InitConsoleVariables(); // without this line the controldeck constructor failes in ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()
|
||||
this->context->InitConfiguration(); // without this line InitConsoleVariables fails at Config::Reload()
|
||||
this->context->InitConsoleVariables(); // without this line the controldeck constructor failes in
|
||||
// ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()
|
||||
|
||||
auto controlDeck = std::make_shared<LUS::ControlDeck>();
|
||||
|
||||
@@ -95,9 +97,10 @@ GameEngine::GameEngine() {
|
||||
|
||||
auto window = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
|
||||
|
||||
this->context->Init(OTRFiles, {}, 3, { 44100, 1024*2, 2480*2 }, window, controlDeck);
|
||||
this->context->Init(OTRFiles, {}, 3, { 32000, 1024 , 2480 }, window, controlDeck);
|
||||
|
||||
Ship::Context::GetInstance()->GetLogger()->set_level((spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
|
||||
Ship::Context::GetInstance()->GetLogger()->set_level(
|
||||
(spdlog::level::level_enum) CVarGetInteger("gDeveloperTools.LogLevel", 1));
|
||||
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
|
||||
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
@@ -139,11 +142,12 @@ GameEngine::GameEngine() {
|
||||
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML,
|
||||
"Vertex", static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLVertexV0>(), RESOURCE_FORMAT_XML, "Vertex",
|
||||
static_cast<uint32_t>(Fast::ResourceType::Vertex), 0);
|
||||
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY,
|
||||
"DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(),
|
||||
RESOURCE_FORMAT_BINARY, "DisplayList",
|
||||
static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
|
||||
loader->RegisterResourceFactory(std::make_shared<Fast::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML,
|
||||
"DisplayList", static_cast<uint32_t>(Fast::ResourceType::DisplayList), 0);
|
||||
|
||||
@@ -215,14 +219,14 @@ void GameEngine::StartFrame() const {
|
||||
this->context->GetWindow()->StartFrame();
|
||||
}
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
// Values for 44100 hz
|
||||
#define SAMPLES_HIGH 752
|
||||
#define SAMPLES_LOW 720
|
||||
#else
|
||||
// Values for 32000 hz
|
||||
#define SAMPLES_HIGH 560
|
||||
#define SAMPLES_LOW 544
|
||||
#define SAMPLES_LOW 528
|
||||
|
||||
#endif
|
||||
|
||||
@@ -259,9 +263,7 @@ void GameEngine::HandleAudioThread() {
|
||||
|
||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||
int samples_left = AudioPlayerBuffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered()
|
||||
? (((samples_high ) ) )
|
||||
: (((samples_low)) );
|
||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? (((samples_high))) : (((samples_low)));
|
||||
|
||||
frames++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user