Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (68 sloc) 1.91 KB
#ifndef MIXER_H
#define MIXER_H
#ifdef _MSC_VER
#pragma warning(disable : 4786)
#include <list>
#include "audiere.h"
#include "device.h"
#include "resampler.h"
#include "threads.h"
#include "types.h"
#include "utility.h"
namespace audiere {
class MixerStream;
/// Always produce 16-bit, stereo audio at the specified rate.
class MixerDevice : public AbstractDevice, public Mutex {
MixerDevice(int rate);
// update() must be implementated by the specific device to call read()
// and write the samples to the output device.
OutputStream* ADR_CALL openStream(SampleSource* source);
OutputStream* ADR_CALL openBuffer(
void* samples,
int frame_count,
int channel_count,
int sample_rate,
SampleFormat sample_format);
int read(int sample_count, void* samples);
std::list<MixerStream*> m_streams;
int m_rate;
friend class MixerStream;
class MixerStream : public RefImplementation<OutputStream> {
MixerStream(MixerDevice* device, SampleSource* source, int rate);
void ADR_CALL play();
void ADR_CALL stop();
bool ADR_CALL isPlaying();
void ADR_CALL reset();
void ADR_CALL setRepeat(bool repeat);
bool ADR_CALL getRepeat();
void ADR_CALL setVolume(float volume);
float ADR_CALL getVolume();
void ADR_CALL setPan(float pan);
float ADR_CALL getPan();
void ADR_CALL setPitchShift(float shift);
float ADR_CALL getPitchShift();
bool ADR_CALL isSeekable();
int ADR_CALL getLength();
void ADR_CALL setPosition(int position);
int ADR_CALL getPosition();
void read(int frame_count, s16* buffer);
RefPtr<MixerDevice> m_device;
RefPtr<Resampler> m_source;
s16 m_last_l;
s16 m_last_r;
bool m_is_playing;
int m_volume;
int m_pan;
friend class MixerDevice;
Jump to Line
Something went wrong with that request. Please try again.