mirror of
https://github.com/libretro/Mu.git
synced 2026-09-22 14:45:57 +00:00
Remove last of old audio code
This commit is contained in:
@@ -93,7 +93,7 @@ void EmuWrapper::emuThreadRun(){
|
||||
emulateFrame();
|
||||
if(!emuNewFrameReady){
|
||||
memcpy(emuDoubleBufferVideo, emuVideoWidth == 320 ? palmExtendedFramebuffer : palmFramebuffer, emuVideoWidth * emuVideoHeight * sizeof(uint16_t));
|
||||
memcpy(emuDoubleBufferAudio, palmAudio, AUDIO_SAMPLES * 2/*channels*/ * sizeof(int16_t));
|
||||
memcpy(emuDoubleBufferAudio, palmAudio, AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
emuNewFrameReady = true;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ uint32_t EmuWrapper::init(const QString& romPath, const QString& bootloaderPath,
|
||||
emuPaused = false;
|
||||
emuNewFrameReady = false;
|
||||
emuDoubleBufferVideo = new uint16_t[emuVideoWidth * emuVideoHeight];
|
||||
emuDoubleBufferAudio = new int16_t[AUDIO_SAMPLES * 2/*channels*/];
|
||||
emuDoubleBufferAudio = new int16_t[AUDIO_SAMPLES_PER_FRAME * 2/*channels*/];
|
||||
emuThread = std::thread(&EmuWrapper::emuThreadRun, this);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -28,7 +28,7 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
QAudioFormat format;
|
||||
format.setSampleRate(CRYSTAL_FREQUENCY);
|
||||
format.setSampleRate(AUDIO_SAMPLE_RATE);
|
||||
format.setChannelCount(2);
|
||||
format.setSampleSize(16);
|
||||
format.setCodec("audio/pcm");
|
||||
@@ -170,7 +170,7 @@ void MainWindow::updateDisplay(){
|
||||
ui->display->repaint();
|
||||
|
||||
//audio
|
||||
audioOut->write((const char*)emu.getAudioSamples(), AUDIO_SAMPLES * 2/*channels*/ * sizeof(int16_t));
|
||||
audioOut->write((const char*)emu.getAudioSamples(), AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
|
||||
//power LED
|
||||
ui->powerButtonLed->setStyleSheet(emu.getPowerButtonLed() ? "background: lime" : "");
|
||||
|
||||
@@ -40,8 +40,7 @@ sd_card_t palmSdCard;
|
||||
misc_hw_t palmMisc;
|
||||
uint16_t palmFramebuffer[160 * (160 + 60)];//really 160*160, the extra pixels are the silkscreened digitizer area
|
||||
uint16_t* palmExtendedFramebuffer;
|
||||
int16_t palmAudio[AUDIO_SAMPLES * 2];
|
||||
uint32_t palmAudioSampleIndex;
|
||||
int16_t palmAudio[AUDIO_SAMPLES_PER_FRAME * 2];
|
||||
uint32_t palmSpecialFeatures;
|
||||
double palmSysclksPerClk32;//how many SYSCLK cycles before toggling the 32.768 kHz crystal
|
||||
double palmCycleCounter;//can be greater then 0 if too many cycles where run
|
||||
@@ -95,7 +94,7 @@ uint32_t emulatorInit(buffer_t palmRomDump, buffer_t palmBootDump, uint32_t spec
|
||||
memset(palmExtendedFramebuffer, 0x00, 320 * 320 * sizeof(uint16_t));
|
||||
//add 320*320 silkscreen image later, 2xBRZ should be able to make 320*320 version of the 160*160 silkscreen
|
||||
}
|
||||
memset(palmAudio, 0x00, AUDIO_SAMPLES * 2/*channels*/ * sizeof(int16_t));
|
||||
memset(palmAudio, 0x00, AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
|
||||
m68328Reset();
|
||||
sed1376Reset();
|
||||
ads7846Reset();
|
||||
@@ -500,7 +499,6 @@ uint32_t emulatorInstallPrcPdb(buffer_t file){
|
||||
|
||||
void emulateFrame(){
|
||||
refreshInputState();
|
||||
palmAudioSampleIndex = 0;
|
||||
|
||||
for(; palmCycleCounter < (double)CRYSTAL_FREQUENCY / EMU_FPS; palmCycleCounter += 1.0)
|
||||
m68328Execute();
|
||||
|
||||
@@ -113,13 +113,13 @@ typedef struct{
|
||||
|
||||
//config options
|
||||
#define EMU_FPS 60
|
||||
#define AUDIO_DUTY_CYCLE_SIZE 20//the amount of frequencys the PWM can play
|
||||
#define EMU_SYSCLK_PRECISION 200//the amount of cycles to run before adding SYSCLKs, higher = faster, higher values may skip timer events and lower audio accuracy
|
||||
#define AUDIO_SAMPLE_RATE 48000
|
||||
#define SAVE_STATE_VERSION 0
|
||||
|
||||
//system constants
|
||||
#define CRYSTAL_FREQUENCY 32768
|
||||
#define AUDIO_SAMPLES (CRYSTAL_FREQUENCY * AUDIO_DUTY_CYCLE_SIZE / EMU_FPS)
|
||||
#define AUDIO_SAMPLES_PER_FRAME (AUDIO_SAMPLE_RATE / EMU_FPS)
|
||||
|
||||
//emulator data, some are GUI interface variables, some should be left alone
|
||||
extern uint8_t* palmRam;//dont touch
|
||||
@@ -131,7 +131,6 @@ extern misc_hw_t palmMisc;//read/write allowed
|
||||
extern uint16_t palmFramebuffer[];//read allowed if FEATURE_320x320 is off, or else invalid data will be displayed
|
||||
extern uint16_t* palmExtendedFramebuffer;//read allowed if FEATURE_320x320 is on, or else SIGSEGV
|
||||
extern int16_t palmAudio[];//read allowed, 2 channel signed 16 bit audio
|
||||
extern uint32_t palmAudioSampleIndex;//dont touch
|
||||
extern uint32_t palmSpecialFeatures;//read allowed
|
||||
extern double palmSysclksPerClk32;//dont touch
|
||||
extern double palmCycleCounter;//dont touch
|
||||
|
||||
Reference in New Issue
Block a user