openMSX
WavAudioInput.hh
Go to the documentation of this file.
1 #ifndef WAVAUDIOINPUT_HH
2 #define WAVAUDIOINPUT_HH
3 
4 #include "AudioInputDevice.hh"
5 #include "FilenameSetting.hh"
6 #include "WavData.hh"
7 #include "Observer.hh"
8 #include "EmuTime.hh"
9 
10 namespace openmsx {
11 
12 class CommandController;
13 
14 class WavAudioInput final : public AudioInputDevice, private Observer<Setting>
15 {
16 public:
17  explicit WavAudioInput(CommandController& commandController);
18  ~WavAudioInput() override;
19 
20  // AudioInputDevice
21  const std::string& getName() const override;
22  std::string_view getDescription() const override;
23  void plugHelper(Connector& connector, EmuTime::param time) override;
24  void unplugHelper(EmuTime::param time) override;
25  int16_t readSample(EmuTime::param time) override;
26 
27  template<typename Archive>
28  void serialize(Archive& ar, unsigned version);
29 
30 private:
31  void loadWave();
32  void update(const Setting& setting) override;
33 
34  FilenameSetting audioInputFilenameSetting;
35  WavData wav;
36  EmuTime reference;
37 };
38 
39 } // namespace openmsx
40 
41 #endif
openmsx::WavData
Definition: WavData.hh:13
openmsx::CommandController
Definition: CommandController.hh:17
AudioInputDevice.hh
openmsx::WavAudioInput
Definition: WavAudioInput.hh:14
openmsx::FilenameSetting
Definition: FilenameSetting.hh:8
openmsx::WavAudioInput::serialize
void serialize(Archive &ar, unsigned version)
Definition: WavAudioInput.cc:84
openmsx::Setting
Definition: Setting.hh:119
openmsx::WavAudioInput::plugHelper
void plugHelper(Connector &connector, EmuTime::param time) override
Definition: WavAudioInput.cc:43
openmsx::WavAudioInput::getName
const std::string & getName() const override
Name used to identify this pluggable.
Definition: WavAudioInput.cc:31
Observer.hh
openmsx::WavAudioInput::readSample
int16_t readSample(EmuTime::param time) override
Read wave data.
Definition: WavAudioInput.cc:74
openmsx::WavAudioInput::~WavAudioInput
~WavAudioInput() override
Definition: WavAudioInput.cc:21
FilenameSetting.hh
WavData.hh
EmuTime.hh
openmsx::WavAudioInput::getDescription
std::string_view getDescription() const override
Description for this pluggable.
Definition: WavAudioInput.cc:37
openmsx::WavAudioInput::unplugHelper
void unplugHelper(EmuTime::param time) override
Definition: WavAudioInput.cc:55
openmsx::Connector
Represents something you can plug devices into.
Definition: Connector.hh:20
openmsx::AudioInputDevice
Definition: AudioInputDevice.hh:9
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::Observer
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
openmsx::WavAudioInput::WavAudioInput
WavAudioInput(CommandController &commandController)
Definition: WavAudioInput.cc:11