OXYGENHUB
◆ main openmsx / src / sound / DACSound8U.cc
637 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#include "DACSound8U.hh"
2
3
#include "DeviceConfig.hh"
4
#include "MSXMotherBoard.hh"
5
6
#include "narrow.hh"
7
8
namespace openmsx {
9
10
DACSound8U::DACSound8U(std::string_view name_, static_string_view desc,
11
                       const DeviceConfig& config)
12
	: DACSound16S(name_, desc, config)
13
{
14
	// Apply 8->16 bit scaling as part of volume-multiplication (= for
15
	// free) instead of on each writeDAC() invocation.
16
	setSoftwareVolume(256.0f, config.getMotherBoard().getCurrentTime());
17
}
18
19
void DACSound8U::writeDAC(uint8_t value, EmuTime time)
20
{
21
	DACSound16S::writeDAC(narrow<int16_t>(narrow<int>(value) - 0x80), time);
22
}
23
24
} // namespace openmsx