UNTESTED! DO NOT USE - PC speaker passthrough
This commit is contained in:
parent
c684107b11
commit
6728edbb71
|
@ -21,6 +21,12 @@
|
||||||
#include "../engine.h"
|
#include "../engine.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <linux/kd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PCSPKR_DIVIDER 4
|
#define PCSPKR_DIVIDER 4
|
||||||
#define CHIP_DIVIDER 1
|
#define CHIP_DIVIDER 1
|
||||||
|
|
||||||
|
@ -106,6 +112,19 @@ void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
|
#ifdef __linux__
|
||||||
|
if (lastOn!=on || lastFreq!=freq) {
|
||||||
|
lastOn=on;
|
||||||
|
lastFreq=freq;
|
||||||
|
ioctl(STDOUT_FILENO,KIOCSOUND,on?freq:0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
for (size_t i=start; i<start+len; i++) {
|
||||||
|
bufL[i]=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
switch (speakerType) {
|
switch (speakerType) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -117,6 +136,9 @@ void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_
|
||||||
case 2:
|
case 2:
|
||||||
acquire_piezo(bufL,bufR,start,len);
|
acquire_piezo(bufL,bufR,start,len);
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
acquire_real(bufL,bufR,start,len);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,12 +304,20 @@ void DivPlatformPCSpeaker::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
on=false;
|
on=false;
|
||||||
|
lastOn=false;
|
||||||
freq=0;
|
freq=0;
|
||||||
|
lastFreq=0;
|
||||||
pos=0;
|
pos=0;
|
||||||
flip=false;
|
flip=false;
|
||||||
low=0;
|
low=0;
|
||||||
band=0;
|
band=0;
|
||||||
|
|
||||||
|
if (speakerType==3) {
|
||||||
|
#ifdef __linux__
|
||||||
|
ioctl(STDOUT_FILENO,KIOCSOUND,0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
memset(regPool,0,2);
|
memset(regPool,0,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +359,11 @@ int DivPlatformPCSpeaker::init(DivEngine* p, int channels, int sugRate, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::quit() {
|
void DivPlatformPCSpeaker::quit() {
|
||||||
|
if (speakerType==3) {
|
||||||
|
#ifdef __linux__
|
||||||
|
ioctl(STDOUT_FILENO,KIOCSOUND,0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DivPlatformPCSpeaker::~DivPlatformPCSpeaker() {
|
DivPlatformPCSpeaker::~DivPlatformPCSpeaker() {
|
||||||
|
|
|
@ -52,12 +52,12 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
};
|
};
|
||||||
Channel chan[1];
|
Channel chan[1];
|
||||||
bool isMuted[1];
|
bool isMuted[1];
|
||||||
bool on, flip;
|
bool on, flip, lastOn;
|
||||||
int pos, speakerType;
|
int pos, speakerType;
|
||||||
float low, band;
|
float low, band;
|
||||||
float low2, high2, band2;
|
float low2, high2, band2;
|
||||||
float low3, band3;
|
float low3, band3;
|
||||||
unsigned short freq;
|
unsigned short freq, lastFreq;
|
||||||
unsigned char regPool[2];
|
unsigned char regPool[2];
|
||||||
|
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
@ -65,6 +65,7 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
void acquire_unfilt(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_unfilt(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
void acquire_cone(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_cone(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
void acquire_piezo(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_piezo(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
void acquire_real(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <SDL_video.h>
|
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -4894,12 +4893,10 @@ bool FurnaceGUI::loop() {
|
||||||
e->setSysFlags(i,(flags&(~3))|2,restart);
|
e->setSysFlags(i,(flags&(~3))|2,restart);
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
}
|
}
|
||||||
/*
|
if (ImGui::RadioButton("Use system beeper (Linux only!)",(flags&3)==3)) {
|
||||||
if (ImGui::RadioButton("Use system beeper",(flags&3)==3)) {
|
|
||||||
e->setSysFlags(i,(flags&(~3))|3,restart);
|
e->setSysFlags(i,(flags&(~3))|3,restart);
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_SYSTEM_QSOUND: {
|
case DIV_SYSTEM_QSOUND: {
|
||||||
|
|
Loading…
Reference in a new issue