libsidplayfp::Mixer Class Reference

`#include <mixer.h>`

## Classes

class | badBufferSize

## Public Member Functions

| Mixer ()
void | doMix ()
void | clockChips ()
void | resetBufs ()
void | begin (short *buffer, uint_least32_t count)
void | clearSids ()
void | addSid (sidemu *chip)
sidemu * | getSid (unsigned int i) const
bool | setFastForward (int ff)
void | setVolume (int_least32_t left, int_least32_t right)
void | setStereo (bool stereo)
void | setSamplerate (uint_least32_t rate)
bool | notFinished () const
uint_least32_t | samplesGenerated () const
bool | wait () const

## Static Public Attributes

static constexpr unsigned int | MAX_SIDS = 3
| Maximum number of supported SIDs.
static constexpr int_least32_t | VOLUME_MAX = 1024
| Maximum allowed volume, must be a power of 2.

## Detailed Description

This class implements the mixer.

## Constructor & Destructor Documentation

## Mixer()

libsidplayfp::Mixer::Mixer | ( |  | ) |

inline

Create a new mixer.

## Member Function Documentation

## addSid()

void libsidplayfp::Mixer::addSid | ( | sidemu * | chip | ) |

Add a SID to the mixer.

Parameters

  chip | the sid emu to add

## begin()

void libsidplayfp::Mixer::begin | ( | short * | buffer,
|  | uint_least32_t | count
| ) |  |

Prepare for mixing cycle.

Parameters

  buffer | output buffer
  count | size of the buffer in samples

Exceptions

  badBufferSize |

## clearSids()

void libsidplayfp::Mixer::clearSids | ( |  | ) |

Remove all SIDs from the mixer.

## clockChips()

void libsidplayfp::Mixer::clockChips | ( |  | ) |

This clocks the SID chips to the present moment, if they aren't already.

## doMix()

void libsidplayfp::Mixer::doMix | ( |  | ) |

Do the mixing.

## getSid()

sidemu * libsidplayfp::Mixer::getSid | ( | unsigned int | i | ) | const

inline

Get a SID from the mixer.

Parameters

  i | the number of the SID to get

Returns
  a pointer to the requested sid emu or 0 if not found

## notFinished()

bool libsidplayfp::Mixer::notFinished | ( |  | ) | const

inline

Check if the buffer have been filled.

## resetBufs()

void libsidplayfp::Mixer::resetBufs | ( |  | ) |

Reset sidemu buffer position discarding produced samples.

## samplesGenerated()

uint_least32_t libsidplayfp::Mixer::samplesGenerated | ( |  | ) | const

inline

Get the number of samples generated up to now.

## setFastForward()

bool libsidplayfp::Mixer::setFastForward | ( | int | ff | ) |

Set the fast forward ratio.

Parameters

  ff | the fast forward ratio, from 1 to 32

Returns
  true if parameter is valid, false otherwise

## setSamplerate()

void libsidplayfp::Mixer::setSamplerate | ( | uint_least32_t | rate | ) |

Set sample rate.

Parameters

  rate | sample rate in Hertz

## setStereo()

void libsidplayfp::Mixer::setStereo | ( | bool | stereo | ) |

Set mixing mode.

Parameters

  stereo | true for stereo mode, false for mono

## setVolume()

void libsidplayfp::Mixer::setVolume | ( | int_least32_t | left,
|  | int_least32_t | right
| ) |  |

Set mixing volumes, from 0 to VOLUME_MAX.

Parameters

  left | volume for left or mono channel
  right | volume for right channel in stereo mode

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

- mixer.h
- mixer.cpp