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  [[nodiscard]] std::string_view getName() const override;
22  [[nodiscard]] std::string_view getDescription() const override;
23  void plugHelper(Connector& connector, EmuTime::param time) override;
24  void unplugHelper(EmuTime::param time) override;
25  [[nodiscard]] 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) noexcept override;
33 
34 private:
35  FilenameSetting audioInputFilenameSetting;
36  WavData wav;
37  EmuTime reference;
38 };
39 
40 } // namespace openmsx
41 
42 #endif
Represents something you can plug devices into.
Definition: Connector.hh:21
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
void serialize(Archive &ar, unsigned version)
void unplugHelper(EmuTime::param time) override
void plugHelper(Connector &connector, EmuTime::param time) override
WavAudioInput(CommandController &commandController)
std::string_view getDescription() const override
Description for this pluggable.
std::string_view getName() const override
Name used to identify this pluggable.
int16_t readSample(EmuTime::param time) override
Read wave data.
This file implemented 3 utility functions:
Definition: Autofire.cc:5