openMSX
AudioInputConnector.cc
Go to the documentation of this file.
1 #include "AudioInputConnector.hh"
3 #include "AudioInputDevice.hh"
4 #include "checked_cast.hh"
5 #include "serialize.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
11  std::string name_)
12  : Connector(pluggingController_, std::move(name_),
13  std::make_unique<DummyAudioInputDevice>())
14 {
15 }
16 
17 std::string_view AudioInputConnector::getDescription() const
18 {
19  return "Audio input connector";
20 }
21 
22 std::string_view AudioInputConnector::getClass() const
23 {
24  return "Audio Input Port";
25 }
26 
27 int16_t AudioInputConnector::readSample(EmuTime::param time) const
28 {
29  return getPluggedAudioDev().readSample(time);
30 }
31 
33 {
34  return *checked_cast<AudioInputDevice*>(&getPlugged());
35 }
36 
37 template<typename Archive>
38 void AudioInputConnector::serialize(Archive& ar, unsigned /*version*/)
39 {
40  ar.template serializeBase<Connector>(*this);
41 }
43 
44 } // namespace openmsx
AudioInputDevice & getPluggedAudioDev() const
Represents something you can plug devices into.
Definition: Connector.hh:20
std::string_view getDescription() const final override
Get a description for this connector.
int16_t readSample(EmuTime::param time) const
virtual int16_t readSample(EmuTime::param time)=0
Read wave data.
STL namespace.
Central administration of Connectors and Pluggables.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
std::string_view getClass() const final override
A Connector belong to a certain class.
void serialize(Archive &ar, unsigned version)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
Definition: serialize.hh:981
Pluggable & getPlugged() const
Returns the Pluggable currently plugged in.
Definition: Connector.hh:59
AudioInputConnector(PluggingController &pluggingController, std::string name)