started working on sounds

This commit is contained in:
2025-07-20 23:48:00 +03:00
parent d786abd0fe
commit 8a29e6b86f
13 changed files with 93568 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
CUtlVector<CUtlString> all_IncludeDirectories = {
"public",
"external",
"external/cglm/include",
"external/stb",
"external/SDL/include",

View File

@@ -18,6 +18,9 @@ CUtlVector<CUtlString> engine_CompiledFiles = {
"engine/input.cpp",
"engine/networking.cpp",
/* audio */
"engine/ma_audio.cpp",
"engine/mesh.cpp",
/* entities */

49
engine/ma_audio.cpp Normal file
View File

@@ -0,0 +1,49 @@
#define MINIAUDIO_IMPLEMENTATION
#include "miniaudio.h"
#include "audio.h"
class CMASound
{
};
class CMAAudioManager: public IAudioManager
{
virtual void Init() override;
virtual void Frame() override;
virtual void Deinit() override;
virtual ISound *CreateSound() override;
virtual I3DSound *Create3DSound() override;
};
DECLARE_ENGINE_INTERFACE(AudioManager, CMAAudioManager)
ma_engine ma_audioEngine;
void CMAAudioManager::Init()
{
ma_result r;
r = ma_engine_init(NULL, &ma_audioEngine);
}
void CMAAudioManager::Frame()
{
}
void CMAAudioManager::Deinit()
{
}
ISound *CMAAudioManager::CreateSound()
{
}
I3DSound *CMAAudioManager::Create3DSound()
{
}

4
engine/ma_audio_apple.mm Normal file
View File

@@ -0,0 +1,4 @@
#define MINIAUDIO_IMPLEMENTATION
#include "miniaudio.h"

View File

@@ -61,6 +61,7 @@ void IServer::Think( float fDelta )
for (auto &entity: EntityManager()->m_entities)
{
entity->Think(fTickrate);
entity->SendToServer();
}
px_frame(px, fTickrate);
INetworking::Frame();

93468
external/miniaudio.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,6 @@ CUtlString CLDProject::Link( void )
szFileName = CUtlString("lib%s.so", m_szName.GetString());
break;
}
V_printf("%s\n",szFileName.GetString());
CUtlString szTarget = m_target.GetTriplet();
CUtlString szOutputFile = CUtlString("%s/%s/ld/%u_%s/%s",FPC_TEMPORAL_DIRNAME, szTarget.GetString(), hash, m_szName.GetString(), szFileName.GetString());

View File

@@ -3,4 +3,4 @@ bind a +left;
bind d +right;
bind w +forward;
bind s +back;
bind o connect 90271429367739416;
bind o connect 90271448333504536;

Binary file not shown.

View File

@@ -261852,7 +261852,19 @@
"origin" "10 -50 3"
}
{
"classname" "info_player_start"
"origin" "10 -51 3"
}
{
"classname" "info_player_start"
"origin" "10 -52 3"
}
{
"classname" "info_player_start"
"origin" "10 -53 3"
}
{
"classname" "info_player_start"
"origin" "10 -54 3"
}

View File

@@ -195,6 +195,7 @@ void CMOBAPlayer::SendToServer()
.fYaw = fYaw,
};
movement.type = PACKET_TYPE_PLAYER_MOVEMENT;
if (INetworking::IsClient())
{
if (g_localClient->pBasePlayer != this)
@@ -212,7 +213,6 @@ void CMOBAPlayer::SendToServer()
INetworking::SendDataEverybodyExcept(&movement, sizeof(PlayerMovement_t), this, MESSAGE_MODE_RELIABLE);
}
return;
}
void CMOBAPlayer::RecieveFromServer( void *pData, uint32_t nDataSize )

View File

@@ -11,6 +11,10 @@
#include "windows.h"
#endif
#ifdef __linux__
#include "dlfcn.h"
#endif
#if defined(__APPLE__) && defined(__MACH__)
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE

24
public/audio.h Normal file
View File

@@ -0,0 +1,24 @@
#ifndef AUDIO_H
#define AUDIO_H
#include "interface.h"
#include "tier0/platform.h"
abstract_class ISound
{
virtual void SetVolume() = 0;
};
abstract_class I3DSound: public ISound
{
virtual void SetPosition() = 0;
virtual void SetVelocity() = 0;
};
interface IAudioManager: public IInterface
{
virtual ISound *CreateSound() = 0;
virtual I3DSound *Create3DSound() = 0;
};
#endif