ScummVM API documentation
Audio::Paula Class Referenceabstract

#include <paula.h>

Inheritance diagram for Audio::Paula:
Audio::AudioStream Audio::Infogrames Modules::ProtrackerStream Scumm::IMuseDriver_Amiga Scumm::Player_V3A TeenAgent::MusicPlayer Chewy::TMFStream

Classes

struct  Channel
 
struct  FilterState
 
struct  Offset
 

Public Types

enum  {
  kPalSystemClock = 7093790, kNtscSystemClock = 7159090, kPalCiaClock = kPalSystemClock / 10, kNtscCiaClock = kNtscSystemClock / 10,
  kPalPaulaClock = kPalSystemClock / 2, kNtscPaulaClock = kNtscSystemClock / 2
}
 
enum  FilterMode { kFilterModeNone = 0, kFilterModeA500, kFilterModeA1200, kFilterModeDefault = kFilterModeA1200 }
 

Public Member Functions

 Paula (bool stereo=false, int rate=44100, uint interruptFreq=0, FilterMode filterMode=kFilterModeDefault, int periodScaleDivisor=1)
 
bool playing () const
 
void setTimerBaseValue (uint32 ticksPerSecond)
 
uint32 getTimerBaseValue ()
 
void setSingleInterrupt (uint sampleDelay)
 
void setSingleInterruptUnscaled (uint timerDelay)
 
void setInterruptFreq (uint sampleDelay)
 
void setInterruptFreqUnscaled (uint timerDelay)
 
void clearVoice (byte voice)
 
void clearVoices ()
 
void startPlay ()
 
void stopPlay ()
 
void pausePlay (bool pause)
 
int readBuffer (int16 *buffer, const int numSamples)
 
bool isStereo () const
 
bool endOfData () const
 
int getRate () const
 
- Public Member Functions inherited from Audio::AudioStream
virtual bool endOfStream () const
 

Static Public Attributes

static const int NUM_VOICES = 4
 
static const int PANNING_LEFT = 63
 
static const int PANNING_RIGHT = 191
 

Protected Member Functions

virtual void interrupt ()=0
 
virtual void interruptChannel (byte channel)
 
void startPaula ()
 
void stopPaula ()
 
void setChannelPanning (byte channel, byte panning)
 
void disableChannel (byte channel)
 
void enableChannel (byte channel)
 
void setChannelInterrupt (byte channel, bool enable)
 
void setChannelPeriod (byte channel, int16 period)
 
void setChannelVolume (byte channel, byte volume)
 
void setChannelSampleStart (byte channel, const int8 *data)
 
void setChannelSampleLen (byte channel, uint32 length)
 
void setChannelData (uint8 channel, const int8 *data, const int8 *dataRepeat, uint32 length, uint32 lengthRepeat, int32 offset=0)
 
void setChannelOffset (byte channel, Offset offset)
 
Offset getChannelOffset (byte channel)
 
int getChannelDmaCount (byte channel)
 
void setChannelDmaCount (byte channel, int dmaVal=0)
 
void setAudioFilter (bool enable)
 

Protected Attributes

bool _end
 
Common::Mutex_mutex
 

Detailed Description

Emulation of the "Paula" Amiga music chip The interrupt frequency specifies the number of mixed wavesamples between calls of the interrupt method

Member Function Documentation

◆ readBuffer()

int Audio::Paula::readBuffer ( int16 *  buffer,
const int  numSamples 
)
virtual

Fill the given buffer with up to numSamples samples.

Data must be in native endianness, 16 bits per sample, signed. For stereo stream, the buffer will be filled with interleaved left and right channel samples, starting with the left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

Returns
The actual number of samples read, or -1 if a critical error occurred.
Note
You must check whether the returned value is less than what you requested. This indicates that the stream is fully used up.

Implements Audio::AudioStream.

◆ isStereo()

bool Audio::Paula::isStereo ( ) const
inlinevirtual

Check whether this is a stereo stream.

Implements Audio::AudioStream.

◆ endOfData()

bool Audio::Paula::endOfData ( ) const
inlinevirtual

Check whether end of data has been reached.

If this returns true, it indicates that at this time there is no data available in the stream. However, there might be more data in the future.

This is used by e.g. a rate converter to decide whether to keep on converting data or to stop.

Implements Audio::AudioStream.

◆ getRate()

int Audio::Paula::getRate ( ) const
inlinevirtual

Sample rate of the stream.

Implements Audio::AudioStream.


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