2024-03-05 22:11:52 -05:00
|
|
|
// Copyright: 2021 - 2024, Ziemas
|
2022-05-19 16:54:36 -04:00
|
|
|
// SPDX-License-Identifier: ISC
|
|
|
|
#pragma once
|
|
|
|
#include <forward_list>
|
|
|
|
#include <memory>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-06-22 23:37:46 -04:00
|
|
|
#include "envelope.h"
|
|
|
|
#include "sound_types.h"
|
|
|
|
#include "voice.h"
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2022-05-19 16:54:36 -04:00
|
|
|
namespace snd {
|
|
|
|
struct SpuVolume {
|
|
|
|
/* 0 */ s16 left;
|
|
|
|
/* 2 */ s16 right;
|
|
|
|
};
|
|
|
|
|
2023-12-07 20:22:54 -05:00
|
|
|
class Synth {
|
2022-05-19 16:54:36 -04:00
|
|
|
public:
|
2023-12-07 20:22:54 -05:00
|
|
|
Synth() {
|
|
|
|
mVolume.left.Set(0x3FFF);
|
|
|
|
mVolume.right.Set(0x3FFF);
|
2022-05-19 16:54:36 -04:00
|
|
|
}
|
|
|
|
|
2023-12-07 20:22:54 -05:00
|
|
|
s16Output Tick();
|
|
|
|
void AddVoice(std::shared_ptr<Voice> voice);
|
|
|
|
void SetMasterVol(u32 volume);
|
2022-05-19 16:54:36 -04:00
|
|
|
|
|
|
|
private:
|
2023-12-07 20:22:54 -05:00
|
|
|
std::forward_list<std::shared_ptr<Voice>> mVoices;
|
2022-05-19 16:54:36 -04:00
|
|
|
|
2023-12-07 20:22:54 -05:00
|
|
|
VolumePair mVolume{};
|
2022-05-19 16:54:36 -04:00
|
|
|
};
|
|
|
|
} // namespace snd
|