openMSX
Classes | Public Types | Public Member Functions | List of all members
openmsx::CassettePlayer Class Referencefinal

#include <CassettePlayer.hh>

Inheritance diagram for openmsx::CassettePlayer:
Inheritance graph
[legend]
Collaboration diagram for openmsx::CassettePlayer:
Collaboration graph
[legend]

Public Types

enum  State { PLAY , RECORD , STOP }
 
- Public Types inherited from openmsx::ResampledSoundDevice
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 (std::span< 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...
 
void getMediaInfo (TclObject &result) override
 This method gets called when information is required on the media inserted in the media slot of the provider. More...
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::CassetteDevice
virtual void setMotor (bool status, EmuTime::param time)=0
 Sets the cassette motor relay false = off true = on. More...
 
virtual int16_t readSample (EmuTime::param time)=0
 Read wave data from cassette device. More...
 
virtual void setSignal (bool output, EmuTime::param time)=0
 Sets the cassette output signal false = low true = high. More...
 
std::string_view getClass () const final
 A pluggable belongs to a certain class. More...
 
- Public Member Functions inherited from openmsx::Pluggable
virtual ~Pluggable ()=default
 
virtual std::string_view getName () const
 Name used to identify this pluggable. More...
 
virtual std::string_view getClass () const =0
 A pluggable belongs to a certain class. More...
 
virtual std::string_view getDescription () const =0
 Description for this pluggable. More...
 
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...
 
ConnectorgetConnector () 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...
 
- Public Member Functions inherited from openmsx::ResampledSoundDevice
bool generateInput (float *buffer, size_t num)
 Note: To enable various optimizations (like SSE), this method is allowed to generate up to 3 extra sample. More...
 
DynamicClockgetEmuClock ()
 
- Public Member Functions inherited from openmsx::SoundDevice
 SoundDevice (const SoundDevice &)=delete
 
SoundDeviceoperator= (const SoundDevice &)=delete
 
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...
 
AmplificationFactors getAmplificationFactor () const
 
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)
 
virtual void setOutputRate (unsigned hostSampleRate, double speed)=0
 When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through this method. More...
 
virtual bool updateBuffer (size_t length, float *buffer, EmuTime::param time)=0
 Generate sample data. More...
 
- Public Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider (const MediaInfoProvider &)=delete
 
MediaInfoProvideroperator= (const MediaInfoProvider &)=delete
 
virtual void getMediaInfo (TclObject &result)=0
 This method gets called when information is required on the media inserted in the media slot of the provider. More...
 

Additional Inherited Members

- Static Public Attributes inherited from openmsx::SoundDevice
static constexpr unsigned MAX_CHANNELS = 24
 
- Protected Member Functions inherited from openmsx::Pluggable
 Pluggable ()
 
virtual void plugHelper (Connector &newConnector, EmuTime::param time)=0
 
virtual void unplugHelper (EmuTime::param time)=0
 
void setConnector (Connector *conn)
 
- Protected Member Functions inherited from openmsx::ResampledSoundDevice
 ResampledSoundDevice (MSXMotherBoard &motherBoard, std::string_view name, static_string_view description, unsigned channels, unsigned inputSampleRate, bool stereo)
 
 ~ResampledSoundDevice ()
 
void setOutputRate (unsigned hostSampleRate, double speed) override
 When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through this method. More...
 
bool updateBuffer (size_t length, float *buffer, EmuTime::param time) override
 Generate sample data. More...
 
void update (const Setting &setting) noexcept override
 
void createResampler ()
 
- Protected Member Functions inherited from openmsx::SoundDevice
 SoundDevice (MSXMixer &mixer, std::string_view name, static_string_view description, unsigned numChannels, unsigned inputRate, bool stereo)
 Constructor. More...
 
 ~SoundDevice ()
 
virtual float getAmplificationFactorImpl () const
 Get amplification/attenuation factor for this device. More...
 
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
 
virtual void generateChannels (std::span< float * > buffers, unsigned num)=0
 Abstract method to generate the actual sound data. More...
 
bool mixChannels (float *dataOut, size_t samples)
 Calls generateChannels() and combines the output to a single channel. More...
 
const DynamicClockgetHostSampleClock () const
 See MSXMixer::getHostSampleClock(). More...
 
double getEffectiveSpeed () const
 
- Protected Member Functions inherited from openmsx::Observer< Setting >
 Observer ()=default
 
 ~Observer ()=default
 
 Observer (const Observer &)=delete
 
Observeroperator= (const Observer &)=delete
 
virtual void update (const Setting &subject) noexcept=0
 
virtual void subjectDeleted (const Setting &)
 
- Protected Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider ()=default
 
 ~MediaInfoProvider ()=default
 
- Static Protected Member Functions inherited from openmsx::SoundDevice
static void addFill (float *&buffer, float value, unsigned num)
 Adds a number of samples that all have the same value. More...
 

Detailed Description

Definition at line 26 of file CassettePlayer.hh.

Member Enumeration Documentation

◆ State

Enumerator
PLAY 
RECORD 
STOP 

Definition at line 55 of file CassettePlayer.hh.

Constructor & Destructor Documentation

◆ CassettePlayer()

openmsx::CassettePlayer::CassettePlayer ( const HardwareConfig hwConf)
explicit

◆ ~CassettePlayer()

openmsx::CassettePlayer::~CassettePlayer ( )
override

Member Function Documentation

◆ generateChannels()

void openmsx::CassettePlayer::generateChannels ( std::span< float * >  buffers,
unsigned  num 
)
overridevirtual

Abstract method to generate the actual sound data.

Parameters
buffersAn array of pointer to buffers. Each buffer must be big enough to hold 'num' samples.
numThe 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 580 of file CassettePlayer.cc.

References PLAY.

◆ getAmplificationFactorImpl()

float openmsx::CassettePlayer::getAmplificationFactorImpl ( ) const
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 593 of file CassettePlayer.cc.

◆ getDescription()

std::string_view openmsx::CassettePlayer::getDescription ( ) const
overridevirtual

Description for this pluggable.

Implements openmsx::Pluggable.

Definition at line 562 of file CassettePlayer.cc.

◆ getMediaInfo()

void openmsx::CassettePlayer::getMediaInfo ( TclObject result)
overridevirtual

This method gets called when information is required on the media inserted in the media slot of the provider.

The provider must attach the info as a dictionary to the given TclObject.

Implements openmsx::MediaInfoProvider.

Definition at line 117 of file CassettePlayer.cc.

References openmsx::TclObject::addDictKeyValues().

◆ getName()

std::string_view openmsx::CassettePlayer::getName ( ) const
overridevirtual

Name used to identify this pluggable.

Reimplemented from openmsx::Pluggable.

Definition at line 557 of file CassettePlayer.cc.

◆ plugHelper()

void openmsx::CassettePlayer::plugHelper ( Connector connector,
EmuTime::param  time 
)
overridevirtual

Implements openmsx::Pluggable.

Definition at line 567 of file CassettePlayer.cc.

◆ readSample()

int16_t openmsx::CassettePlayer::readSample ( EmuTime::param  time)
overridevirtual

Read wave data from cassette device.

Implements openmsx::CassetteDevice.

Definition at line 446 of file CassettePlayer.cc.

References PLAY.

◆ serialize()

template<typename Archive >
void openmsx::CassettePlayer::serialize ( Archive &  ar,
unsigned  version 
)

◆ setMotor()

void openmsx::CassettePlayer::setMotor ( bool  status,
EmuTime::param  time 
)
overridevirtual

Sets the cassette motor relay false = off true = on.

Implements openmsx::CassetteDevice.

Definition at line 428 of file CassettePlayer.cc.

◆ setSignal()

void openmsx::CassettePlayer::setSignal ( bool  output,
EmuTime::param  time 
)
overridevirtual

Sets the cassette output signal false = low true = high.

Implements openmsx::CassetteDevice.

Definition at line 458 of file CassettePlayer.cc.

◆ unplugHelper()

void openmsx::CassettePlayer::unplugHelper ( EmuTime::param  time)
overridevirtual

Implements openmsx::Pluggable.

Definition at line 573 of file CassettePlayer.cc.

References STOP.


The documentation for this class was generated from the following files: