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  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
void serialize(Archive &ar, unsigned version)
string_view getDescription() const override
Description for this pluggable.
Represents something you can plug devices into.
Definition: Connector.hh:20
const std::string & getName() const override
Name used to identify this pluggable.
void unplugHelper(EmuTime::param time) override
WavAudioInput(CommandController &commandController)
void plugHelper(Connector &connector, EmuTime::param time) override
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
int16_t readSample(EmuTime::param time) override
Read wave data.
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9