| 1 |
|
| 2 |
|
| 3 |
#ifndef DACSOUND16S_HH |
| 4 |
#define DACSOUND16S_HH |
| 5 |
|
| 6 |
#include "BlipBuffer.hh" |
| 7 |
#include "SoundDevice.hh" |
| 8 |
|
| 9 |
#include <cstdint> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class DACSound16S : public SoundDevice |
| 14 |
{ |
| 15 |
public: |
| 16 |
DACSound16S(std::string_view name, static_string_view desc, |
| 17 |
const DeviceConfig& config); |
| 18 |
virtual ~DACSound16S(); |
| 19 |
|
| 20 |
void reset(EmuTime time); |
| 21 |
void writeDAC(int16_t value, EmuTime time); |
| 22 |
|
| 23 |
template<typename Archive> |
| 24 |
void serialize(Archive& ar, unsigned version); |
| 25 |
|
| 26 |
private: |
| 27 |
|
| 28 |
void setOutputRate(unsigned hostSampleRate, double speed) override; |
| 29 |
void generateChannels(std::span<float*> bufs, unsigned num) override; |
| 30 |
bool updateBuffer(size_t length, float* buffer, |
| 31 |
EmuTime time) override; |
| 32 |
|
| 33 |
private: |
| 34 |
BlipBuffer blip; |
| 35 |
int16_t lastWrittenValue = 0; |
| 36 |
}; |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
#endif |