openMSX
|
#include <CassettePlayer.hh>
Public Types | |
enum | State { PLAY , RECORD , STOP } |
![]() | |
enum | ResampleType { RESAMPLE_HQ , RESAMPLE_LQ , RESAMPLE_BLIP } |
Public Member Functions | |
CassettePlayer (const HardwareConfig &hwConf) | |
~CassettePlayer () override | |
void | setMotor (bool status, EmuTime::param time) override |
Sets the cassette motor relay false = off true = on. More... | |
int16_t | readSample (EmuTime::param time) override |
Read wave data from cassette device. More... | |
void | setSignal (bool output, EmuTime::param time) override |
Sets the cassette output signal false = low true = high. More... | |
std::string_view | getName () const override |
Name used to identify this pluggable. More... | |
std::string_view | getDescription () const override |
Description for this pluggable. More... | |
void | plugHelper (Connector &connector, EmuTime::param time) override |
void | unplugHelper (EmuTime::param time) override |
void | generateChannels (float **buffers, unsigned num) override |
Abstract method to generate the actual sound data. More... | |
float | getAmplificationFactorImpl () const override |
Get amplification/attenuation factor for this device. More... | |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
![]() | |
std::string_view | getClass () const final |
A pluggable belongs to a certain class. More... | |
![]() | |
virtual | ~Pluggable ()=default |
void | plug (Connector &connector, EmuTime::param time) |
This method is called when this pluggable is inserted in a connector. More... | |
void | unplug (EmuTime::param time) |
This method is called when this pluggable is removed from a connector. More... | |
Connector * | getConnector () const |
Get the connector this Pluggable is plugged into. More... | |
bool | isPluggedIn () const |
Returns true if this pluggable is currently plugged into a connector. More... | |
![]() | |
bool | generateInput (float *buffer, unsigned num) |
Note: To enable various optimizations (like SSE), this method is allowed to generate up to 3 extra sample. More... | |
DynamicClock & | getEmuClock () |
![]() | |
const std::string & | getName () const |
Get the unique name that identifies this sound device. More... | |
std::string_view | getDescription () const |
Gets a description of this sound device, to be presented to the user. More... | |
bool | isStereo () const |
Is this a stereo device? This is set in the constructor and cannot be changed anymore. More... | |
std::pair< float, float > | getAmplificationFactor () const |
Gets this device its 'amplification factor'. More... | |
void | setSoftwareVolume (float volume, EmuTime::param time) |
Change the 'software volume' of this sound device. More... | |
void | setSoftwareVolume (float left, float right, EmuTime::param time) |
void | recordChannel (unsigned channel, const Filename &filename) |
void | muteChannel (unsigned channel, bool muted) |
Additional Inherited Members | |
![]() | |
static constexpr unsigned | MAX_CHANNELS = 24 |
![]() | |
Pluggable () | |
void | setConnector (Connector *conn) |
![]() | |
ResampledSoundDevice (MSXMotherBoard &motherBoard, std::string_view name, static_string_view description, unsigned channels, unsigned inputSampleRate, bool stereo) | |
~ResampledSoundDevice () | |
void | setOutputRate (unsigned sampleRate) override |
When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through this method. More... | |
bool | updateBuffer (unsigned length, float *buffer, EmuTime::param time) override |
Generate sample data. More... | |
void | update (const Setting &setting) noexcept override |
void | createResampler () |
![]() | |
SoundDevice (MSXMixer &mixer, std::string_view name, static_string_view description, unsigned numChannels, unsigned inputRate, bool stereo) | |
Constructor. More... | |
~SoundDevice () | |
void | registerSound (const DeviceConfig &config) |
Registers this sound device with the Mixer. More... | |
void | unregisterSound () |
Unregisters this sound device with the Mixer. More... | |
void | updateStream (EmuTime::param time) |
void | setInputRate (unsigned sampleRate) |
unsigned | getInputRate () const |
bool | mixChannels (float *dataOut, unsigned samples) |
Calls generateChannels() and combines the output to a single channel. More... | |
const DynamicClock & | getHostSampleClock () const |
See MSXMixer::getHostSampleClock(). More... | |
double | getEffectiveSpeed () const |
![]() | |
~Observer ()=default | |
virtual void | subjectDeleted (const Setting &) |
![]() | |
static void | addFill (float *&buffer, float value, unsigned num) |
Adds a number of samples that all have the same value. More... | |
Definition at line 25 of file CassettePlayer.hh.
Enumerator | |
---|---|
PLAY | |
RECORD | |
STOP |
Definition at line 50 of file CassettePlayer.hh.
|
explicit |
Definition at line 80 of file CassettePlayer.cc.
References openmsx::Reactor::getEventDistributor(), openmsx::MSXMotherBoard::getMSXCliComm(), openmsx::MSXMotherBoard::getReactor(), openmsx::CliComm::HARDWARE, openmsx::OPENMSX_BOOT_EVENT, openmsx::EventDistributor::registerEventListener(), openmsx::SoundDevice::registerSound(), and openmsx::CliComm::update().
|
override |
Definition at line 113 of file CassettePlayer.cc.
References openmsx::Pluggable::getConnector(), openmsx::Reactor::getEventDistributor(), openmsx::MSXMotherBoard::getMSXCliComm(), openmsx::MSXMotherBoard::getReactor(), openmsx::CliComm::HARDWARE, openmsx::OPENMSX_BOOT_EVENT, openmsx::EventDistributor::unregisterEventListener(), openmsx::SoundDevice::unregisterSound(), and openmsx::CliComm::update().
|
overridevirtual |
Abstract method to generate the actual sound data.
buffers | An array of pointer to buffers. Each buffer must be big enough to hold 'num' samples. |
num | The number of samples. |
This method should fill each buffer with sound data that corresponds to one channel of the sound device. The same channel should each time be written to the same buffer (needed for record).
If a certain channel is muted it is allowed to set the buffer pointer to nullptr. This has exactly the same effect as filling the buffer completely with zeros, but it can be more efficient.
Implements openmsx::SoundDevice.
Definition at line 569 of file CassettePlayer.cc.
References PLAY.
|
overridevirtual |
Get amplification/attenuation factor for this device.
Normally the outputBuffer() method should scale the output to the range [-1.0..+1.0]. But sometimes it's more convenient to generate another output range. In later stages the output is anyway still multiplied by some factor. This method tells which factor should be used to scale the output to the correct range. The default implementation returns '1.0 / 32768.0'.
Reimplemented from openmsx::SoundDevice.
Definition at line 580 of file CassettePlayer.cc.
|
overridevirtual |
Description for this pluggable.
Implements openmsx::Pluggable.
Definition at line 551 of file CassettePlayer.cc.
References openmsx::DESCRIPTION.
|
overridevirtual |
Name used to identify this pluggable.
Reimplemented from openmsx::Pluggable.
Definition at line 546 of file CassettePlayer.cc.
|
overridevirtual |
Implements openmsx::Pluggable.
Definition at line 556 of file CassettePlayer.cc.
|
overridevirtual |
Read wave data from cassette device.
Implements openmsx::CassetteDevice.
Definition at line 438 of file CassettePlayer.cc.
References PLAY.
void openmsx::CassettePlayer::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 859 of file CassettePlayer.cc.
References openmsx::Sha1Sum::empty(), openmsx::FileOperations::exists(), openmsx::FilePool::getFile(), openmsx::Reactor::getFilePool(), openmsx::MSXMotherBoard::getMSXCliComm(), openmsx::MSXMotherBoard::getReactor(), openmsx::Filename::getResolved(), PLAY, openmsx::CliComm::printWarning(), RECORD, openmsx::Filename::setResolved(), STOP, openmsx::TAPE, openmsx::Sha1Sum::toString(), and openmsx::Filename::updateAfterLoadState().
|
overridevirtual |
Sets the cassette motor relay false = off true = on.
Implements openmsx::CassetteDevice.
Definition at line 420 of file CassettePlayer.cc.
|
overridevirtual |
Sets the cassette output signal false = low true = high.
Implements openmsx::CassetteDevice.
Definition at line 450 of file CassettePlayer.cc.
|
overridevirtual |