Files
XCEngine/engine/include/XCEngine/Audio/AudioMixer.h
ssdfasd d575532966 docs: update TEST_SPEC.md and README.md to reflect new directory structure
- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset,
  Core/IO, and Resources/<Type> subdirectories
- TEST_SPEC.md: Updated module names and test counts (852 total)
- TEST_SPEC.md: Updated build commands for new Resources subdirectories
- README.md: Updated engine structure with Core/Asset/ and Core/IO/
- README.md: Updated Resources section with layered architecture
- README.md: Updated test coverage table with accurate counts
2026-03-24 16:14:05 +08:00

57 lines
1.3 KiB
C++

#pragma once
#include <XCEngine/Audio/AudioTypes.h>
#include <XCEngine/Core/Math/Vector3.h>
#include <vector>
#include <map>
#include <string>
namespace XCEngine {
namespace Audio {
class IAudioEffect;
class AudioMixer {
public:
AudioMixer();
~AudioMixer();
void SetVolume(float volume);
float GetVolume() const { return m_volume; }
void SetMute(bool mute);
bool IsMute() const { return m_mute; }
void AddEffect(IAudioEffect* effect);
void RemoveEffect(IAudioEffect* effect);
void ClearEffects();
void ProcessAudio(float* buffer, uint32 sampleCount, uint32 channels);
void SetOutputMixer(AudioMixer* mixer);
AudioMixer* GetOutputMixer() const { return m_outputMixer; }
void Set3DParams(const Audio3DParams& params);
const Audio3DParams& Get3DParams() const { return m_3DParams; }
struct ChannelVolume {
float volume = 1.0f;
bool mute = false;
};
void SetChannelVolume(AudioChannel channel, float volume);
float GetChannelVolume(AudioChannel channel) const;
private:
float m_volume = 1.0f;
bool m_mute = false;
Audio3DParams m_3DParams;
AudioMixer* m_outputMixer = nullptr;
std::vector<IAudioEffect*> m_effects;
std::map<AudioChannel, ChannelVolume> m_channelVolumes;
};
} // namespace Audio
} // namespace XCEngine