38 lines
689 B
C++
38 lines
689 B
C++
#ifndef GAME_SOUNDBLASTER_H
|
|
#define GAME_SOUNDBLASTER_H
|
|
|
|
#ifdef BUILD_SDL
|
|
#include <SDL.h>
|
|
#else
|
|
#include <dpmi.h>
|
|
#endif
|
|
#include <cstdint>
|
|
|
|
#define SB_BUFFER_SIZE 1024
|
|
#define SB_BUFFERS 32
|
|
#define SB_DMA_BUFFER_SIZE (SB_BUFFER_SIZE * 4)
|
|
|
|
class SoundBlaster {
|
|
public:
|
|
SoundBlaster();
|
|
~SoundBlaster();
|
|
|
|
private:
|
|
friend void soundblasterIsr();
|
|
void onInterrupt();
|
|
|
|
#ifdef BUILD_SDL
|
|
#else
|
|
_go32_dpmi_seginfo _dmaBuffer{};
|
|
uint8_t (*_buffers)[SB_BUFFER_SIZE]{};
|
|
uint8_t _dmaPage{0};
|
|
uint16_t _dmaOffset{0};
|
|
unsigned _nextBufferReadIndex{0};
|
|
unsigned _nextBufferWriteIndex{0};
|
|
#endif
|
|
};
|
|
|
|
extern SoundBlaster soundblaster;
|
|
|
|
#endif //GAME_SOUNDBLASTER_H
|