2017-02-26 11:00:41 -05:00
|
|
|
#ifndef __SDLSPEAKER_H
|
|
|
|
#define __SDLSPEAKER_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "physicalspeaker.h"
|
|
|
|
|
2017-12-31 17:21:34 -05:00
|
|
|
#define SPEAKERQUEUESIZE 64
|
|
|
|
|
2017-02-26 11:00:41 -05:00
|
|
|
class SDLSpeaker : public PhysicalSpeaker {
|
|
|
|
public:
|
|
|
|
SDLSpeaker();
|
|
|
|
virtual ~SDLSpeaker();
|
|
|
|
|
2017-12-31 17:21:34 -05:00
|
|
|
virtual void toggle(uint32_t c);
|
2018-01-02 20:28:47 -05:00
|
|
|
virtual void maintainSpeaker(uint32_t c, uint64_t microseconds);
|
2017-02-26 11:00:41 -05:00
|
|
|
virtual void beginMixing();
|
|
|
|
virtual void mixOutput(uint8_t v);
|
|
|
|
private:
|
2018-01-02 20:28:47 -05:00
|
|
|
int16_t mixerValue;
|
2017-02-26 11:00:41 -05:00
|
|
|
bool toggleState;
|
2017-12-31 17:21:34 -05:00
|
|
|
|
|
|
|
uint32_t toggleTimes[SPEAKERQUEUESIZE];
|
|
|
|
uint8_t toggleCount; // # of entries still in queue
|
|
|
|
uint8_t toggleReadPtr; // ring buffer pointer in queue
|
|
|
|
uint8_t toggleWritePtr; // ring buffer pointer in queue
|
2017-02-26 11:00:41 -05:00
|
|
|
|
2018-01-02 20:28:47 -05:00
|
|
|
uint64_t lastCycleCount;
|
|
|
|
uint64_t lastSampleCount;
|
|
|
|
|
2017-02-26 11:00:41 -05:00
|
|
|
FILE *f;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|