mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-30 07:12:55 +00:00
refactor: relocate ConsoleSoundEngine base into minecraft/sounds/
This commit is contained in:
parent
4d9db3ed3b
commit
62186f8afb
|
|
@ -1,24 +0,0 @@
|
|||
#include "Consoles_SoundEngine.h"
|
||||
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() {
|
||||
return m_bIsPlayingStreamingCDMusic;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() {
|
||||
return m_bIsPlayingStreamingGameMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) {
|
||||
m_bIsPlayingStreamingCDMusic = bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) {
|
||||
m_bIsPlayingStreamingGameMusic = bVal;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; }
|
||||
bool ConsoleSoundEngine::GetIsPlayingNetherMusic() {
|
||||
return m_bIsPlayingNetherMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
|
||||
m_bIsPlayingEndMusic = bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
|
||||
m_bIsPlayingNetherMusic = bVal;
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "app/common/Audio/Consoles_SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "app/linux/Iggy/include/rrCore.h"
|
||||
#include "app/linux/LinuxGame.h"
|
||||
#include "java/Random.h"
|
||||
|
|
@ -1938,40 +1938,3 @@ char* SoundEngine::ConvertSoundPathToName(const std::string& name,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void ConsoleSoundEngine::tick() {
|
||||
if (scheduledSounds.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) {
|
||||
SoundEngine::ScheduledSound* next = *it;
|
||||
next->delay--;
|
||||
|
||||
if (next->delay <= 0) {
|
||||
play(next->iSound, next->x, next->y, next->z, next->volume,
|
||||
next->pitch);
|
||||
it = scheduledSounds.erase(it);
|
||||
delete next;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z,
|
||||
float volume, float pitch, int delayTicks) {
|
||||
scheduledSounds.push_back(new SoundEngine::ScheduledSound(
|
||||
iSound, x, y, z, volume, pitch, delayTicks));
|
||||
}
|
||||
|
||||
ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y,
|
||||
float z, float volume,
|
||||
float pitch, int delay) {
|
||||
this->iSound = iSound;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->volume = volume;
|
||||
this->pitch = pitch;
|
||||
this->delay = delay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Random;
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "app/common/Audio/Consoles_SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "app/linux/Iggy/include/rrCore.h"
|
||||
#include "minecraft/sounds/SoundTypes.h"
|
||||
#include "platform/PlatformTypes.h"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "Consoles_SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "minecraft/sounds/SoundTypes.h"
|
||||
|
||||
const char* ConsoleSoundEngine::wchSoundNames[eSoundType_MAX] = {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "app/common/App_structs.h"
|
||||
#include "app/common/ArchiveManager.h"
|
||||
#include "app/common/Audio/Consoles_SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "app/common/BannedListManager.h"
|
||||
#include "app/common/DLC/DLCManager.h"
|
||||
#include "app/common/DLCController.h"
|
||||
|
|
|
|||
|
|
@ -993,10 +993,13 @@ void Game::HandleXuiActions(void) {
|
|||
// need to stop the streaming audio - by playing
|
||||
// streaming audio from the default texture pack now
|
||||
// reset the streaming sounds back to the normal ones
|
||||
pMinecraft->soundEngine->SetStreamingSounds(
|
||||
eStream_Overworld_Calm1, eStream_Overworld_piano3,
|
||||
eStream_Nether1, eStream_Nether4,
|
||||
eStream_end_dragon, eStream_end_end, eStream_CD_1);
|
||||
static_cast<SoundEngine*>(pMinecraft->soundEngine)
|
||||
->SetStreamingSounds(eStream_Overworld_Calm1,
|
||||
eStream_Overworld_piano3,
|
||||
eStream_Nether1,
|
||||
eStream_Nether4,
|
||||
eStream_end_dragon,
|
||||
eStream_end_end, eStream_CD_1);
|
||||
pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1,
|
||||
1);
|
||||
|
||||
|
|
|
|||
|
|
@ -1354,9 +1354,11 @@ void UIController::NavigateToHomeMenu() {
|
|||
// need to stop the streaming audio - by playing streaming audio from
|
||||
// the default texture pack now reset the streaming sounds back to the
|
||||
// normal ones
|
||||
pMinecraft->soundEngine->SetStreamingSounds(
|
||||
eStream_Overworld_Calm1, eStream_Overworld_piano3, eStream_Nether1,
|
||||
eStream_Nether4, eStream_end_dragon, eStream_end_end, eStream_CD_1);
|
||||
static_cast<SoundEngine*>(pMinecraft->soundEngine)
|
||||
->SetStreamingSounds(eStream_Overworld_Calm1,
|
||||
eStream_Overworld_piano3, eStream_Nether1,
|
||||
eStream_Nether4, eStream_end_dragon,
|
||||
eStream_end_end, eStream_CD_1);
|
||||
pMinecraft->soundEngine->playStreaming("", 0, 0, 0, 1, 1);
|
||||
|
||||
// if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
common/AppGameServices.cpp
|
||||
common/ArchiveManager.cpp
|
||||
common/Audio/Consoles_SoundEngine.cpp
|
||||
common/Audio/SoundEngine.cpp
|
||||
common/Audio/SoundNames.cpp
|
||||
common/BannedListManager.cpp
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
// GDraw GL backend for Linux
|
||||
#include "platform/renderer/renderer.h"
|
||||
#include "renderer/gl/gl_compat.h"
|
||||
#include "Linux_UIController.h"
|
||||
#include "app/common/UI/All Platforms/UIStructs.h"
|
||||
#include "app/linux/Iggy/gdraw/gdraw.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class BackgroundDownloader;
|
|||
class HumanoidModel;
|
||||
class HitResult;
|
||||
class Options;
|
||||
class SoundEngine;
|
||||
class ConsoleSoundEngine;
|
||||
class IPlatformLeaderboard;
|
||||
class MinecraftApplet;
|
||||
class MouseHandler;
|
||||
|
|
@ -191,7 +191,7 @@ protected:
|
|||
MinecraftApplet* minecraftApplet;
|
||||
|
||||
public:
|
||||
SoundEngine* soundEngine;
|
||||
ConsoleSoundEngine* soundEngine;
|
||||
MouseHandler* mouseHandler;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Options.h"
|
||||
|
||||
#include "KeyMapping.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "java/File.h"
|
||||
#include "java/InputOutputStream/BufferedReader.h"
|
||||
#include "java/InputOutputStream/DataOutputStream.h"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "Screen.h"
|
||||
|
||||
#include "Button.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "minecraft/GameEnums.h"
|
||||
#include "minecraft/IGameServices.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "StatsScreen.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
#include "minecraft/client/gui/Button.h"
|
||||
#include "minecraft/client/gui/Font.h"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "ClientConnection.h"
|
||||
#include "MultiPlayerLevel.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "java/Class.h"
|
||||
#include "minecraft/IGameServices.h"
|
||||
#include "minecraft/client/Minecraft.h"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "ClientConnection.h"
|
||||
#include "MultiPlayerChunkCache.h"
|
||||
#include "MultiPlayerLocalPlayer.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "java/Random.h"
|
||||
#include "minecraft/Console_Debug_enum.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "PlatformTypes.h"
|
||||
#include "Pos.h"
|
||||
#include "app/common/App_structs.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "app/common/Tutorial/Tutorial.h"
|
||||
#include "app/common/Tutorial/TutorialMode.h"
|
||||
#include "app/linux/Linux_UIController.h"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#include "Chunk.h"
|
||||
#include "GameRenderer.h"
|
||||
#include "Tesselator.h"
|
||||
#include "app/common/Audio/SoundEngine.h"
|
||||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
#include "java/Class.h"
|
||||
#include "java/JavaMath.h"
|
||||
#include "java/Random.h"
|
||||
|
|
|
|||
|
|
@ -409,11 +409,14 @@ int DLCTexturePack::onPackMounted(int iPad, std::uint32_t dwErr,
|
|||
iEndC =
|
||||
dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||
|
||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(
|
||||
iOverworldStart, iOverworldStart + iOverworldC,
|
||||
iNetherStart, iNetherStart + iNetherC, iEndStart,
|
||||
iEndStart + iEndC,
|
||||
iEndStart + iEndC); // push the CD start to after
|
||||
static_cast<SoundEngine*>(
|
||||
Minecraft::GetInstance()->soundEngine)
|
||||
->SetStreamingSounds(
|
||||
iOverworldStart, iOverworldStart + iOverworldC,
|
||||
iNetherStart, iNetherStart + iNetherC, iEndStart,
|
||||
iEndStart + iEndC,
|
||||
iEndStart +
|
||||
iEndC); // push the CD start to after
|
||||
}
|
||||
}
|
||||
texturePack->loadColourTable();
|
||||
|
|
|
|||
62
targets/minecraft/sounds/ConsoleSoundEngine.cpp
Normal file
62
targets/minecraft/sounds/ConsoleSoundEngine.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#include "minecraft/sounds/ConsoleSoundEngine.h"
|
||||
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic() {
|
||||
return m_bIsPlayingStreamingCDMusic;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic() {
|
||||
return m_bIsPlayingStreamingGameMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal) {
|
||||
m_bIsPlayingStreamingCDMusic = bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal) {
|
||||
m_bIsPlayingStreamingGameMusic = bVal;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingEndMusic() { return m_bIsPlayingEndMusic; }
|
||||
bool ConsoleSoundEngine::GetIsPlayingNetherMusic() {
|
||||
return m_bIsPlayingNetherMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal) {
|
||||
m_bIsPlayingEndMusic = bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal) {
|
||||
m_bIsPlayingNetherMusic = bVal;
|
||||
}
|
||||
|
||||
void ConsoleSoundEngine::tick() {
|
||||
if (scheduledSounds.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto it = scheduledSounds.begin(); it != scheduledSounds.end();) {
|
||||
ConsoleSoundEngine::ScheduledSound* next = *it;
|
||||
next->delay--;
|
||||
|
||||
if (next->delay <= 0) {
|
||||
play(next->iSound, next->x, next->y, next->z, next->volume,
|
||||
next->pitch);
|
||||
it = scheduledSounds.erase(it);
|
||||
delete next;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z,
|
||||
float volume, float pitch, int delayTicks) {
|
||||
scheduledSounds.push_back(new ConsoleSoundEngine::ScheduledSound(
|
||||
iSound, x, y, z, volume, pitch, delayTicks));
|
||||
}
|
||||
|
||||
ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y,
|
||||
float z, float volume,
|
||||
float pitch, int delay) {
|
||||
this->iSound = iSound;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->volume = volume;
|
||||
this->pitch = pitch;
|
||||
this->delay = delay;
|
||||
}
|
||||
|
|
@ -21,6 +21,11 @@ typedef struct {
|
|||
class Options;
|
||||
class Mob;
|
||||
|
||||
// Game-side sound engine interface. The concrete backend
|
||||
// (app/common/Audio/SoundEngine) inherits from this and forwards into
|
||||
// IPlatformSound. minecraft/ consumers see only the abstract base, so
|
||||
// they don't have to drag the concrete backend (and its miniaudio
|
||||
// pimpl) into their compilation units.
|
||||
class ConsoleSoundEngine {
|
||||
public:
|
||||
ConsoleSoundEngine()
|
||||
|
|
@ -29,6 +34,8 @@ public:
|
|||
m_bIsPlayingEndMusic(false),
|
||||
m_bIsPlayingNetherMusic(false) {}
|
||||
|
||||
virtual ~ConsoleSoundEngine() = default;
|
||||
|
||||
virtual void tick(std::shared_ptr<Mob>* players, float a) = 0;
|
||||
virtual void destroy() = 0;
|
||||
virtual void play(int iSound, float x, float y, float z, float volume,
|
||||
|
|
@ -395,6 +395,7 @@ server/level/TrackedEntity.cpp
|
|||
server/network/PendingConnection.cpp
|
||||
server/network/PlayerConnection.cpp
|
||||
server/network/ServerConnection.cpp
|
||||
sounds/ConsoleSoundEngine.cpp
|
||||
stats/Achievement.cpp
|
||||
stats/Achievements.cpp
|
||||
stats/CommonStats.cpp
|
||||
|
|
|
|||
Loading…
Reference in a new issue