Started putting together window framework for sound configuration.

This commit is contained in:
Matthew Budd 2020-07-01 22:03:59 -04:00
parent ab664db06c
commit afc3a61014
5 changed files with 158 additions and 0 deletions

View File

@ -298,11 +298,13 @@ HEADERS += src/drivers/Qt/GameApp.h
HEADERS += src/drivers/Qt/GameViewerGL.h
HEADERS += src/drivers/Qt/GameViewerSDL.h
HEADERS += src/drivers/Qt/GamePadConf.h
HEADERS += src/drivers/Qt/GameSoundConf.h
SOURCES += src/drivers/Qt/main.cpp
SOURCES += src/drivers/Qt/GameApp.cpp
SOURCES += src/drivers/Qt/GameViewerGL.cpp
SOURCES += src/drivers/Qt/GameViewerSDL.cpp
SOURCES += src/drivers/Qt/GamePadConf.cpp
SOURCES += src/drivers/Qt/GameSoundConf.cpp
SOURCES += src/drivers/Qt/fceuWrapper.cpp
SOURCES += src/drivers/Qt/config.cpp
SOURCES += src/drivers/Qt/input.cpp

View File

@ -4,6 +4,7 @@
#include "Qt/GameApp.h"
#include "Qt/GamePadConf.h"
#include "Qt/GameSoundConf.h"
#include "Qt/fceuWrapper.h"
#include "Qt/keyscan.h"
@ -111,6 +112,14 @@ void gameWin_t::createMainMenu(void)
optMenu->addAction(gamePadConfig);
// Options -> Sound Config
gameSoundConfig = new QAction(tr("&Sound Config"), this);
//gameSoundConfig->setShortcut( QKeySequence(tr("Ctrl+C")));
gameSoundConfig->setStatusTip(tr("Sound Configure"));
connect(gameSoundConfig, SIGNAL(triggered()), this, SLOT(openGameSndConfWin(void)) );
optMenu->addAction(gameSoundConfig);
//-----------------------------------------------------------------------
// Help
helpMenu = menuBar()->addMenu(tr("&Help"));
@ -208,6 +217,22 @@ void gameWin_t::openGamePadConfWin(void)
//printf("GamePad Config Window Destroyed\n");
}
void gameWin_t::openGameSndConfWin(void)
{
GameSndConfDialog_t *sndConfWin;
printf("Open Sound Config Window\n");
sndConfWin = new GameSndConfDialog_t(this);
sndConfWin->show();
sndConfWin->exec();
delete sndConfWin;
printf("Sound Config Window Destroyed\n");
}
void gameWin_t::aboutQPlot(void)
{
printf("About QPlot\n");

View File

@ -39,6 +39,7 @@ class gameWin_t : public QMainWindow
QAction *closeROM;
QAction *quitAct;
QAction *gamePadConfig;
QAction *gameSoundConfig;
QAction *aboutAct;
QTimer *gameTimer;
@ -59,6 +60,7 @@ class gameWin_t : public QMainWindow
void closeROMCB(void);
void aboutQPlot(void);
void openGamePadConfWin(void);
void openGameSndConfWin(void);
void runGameFrame(void);
};

View File

@ -0,0 +1,90 @@
// GameSoundConf.cpp
//
#include "Qt/GameSoundConf.h"
#include "Qt/main.h"
#include "Qt/config.h"
#include "Qt/fceuWrapper.h"
//----------------------------------------------------
GameSndConfDialog_t::GameSndConfDialog_t(QWidget *parent)
: QDialog( parent )
{
QHBoxLayout *hbox1, *hbox2;
QVBoxLayout *vbox1;
QLabel *lbl;
setWindowTitle("Sound Config");
hbox1 = new QHBoxLayout();
vbox1 = new QVBoxLayout();
// Enable Sound Select
enaChkbox = new QCheckBox("Enable Sound");
// Enable Low Pass Filter Select
enaLowPass = new QCheckBox("Enable Low Pass Filter");
vbox1->addWidget( enaChkbox );
vbox1->addWidget( enaLowPass );
// Audio Quality Select
hbox2 = new QHBoxLayout();
lbl = new QLabel("Quality:");
qualitySelect = new QComboBox();
qualitySelect->addItem( tr("Low") , 0 );
qualitySelect->addItem( tr("High") , 1 );
qualitySelect->addItem( tr("Very High"), 2 );
hbox2->addWidget( lbl );
hbox2->addWidget( qualitySelect );
vbox1->addLayout( hbox2 );
// Sample Rate Select
hbox2 = new QHBoxLayout();
lbl = new QLabel("Rate:");
rateSelect = new QComboBox();
rateSelect->addItem( tr("11025"), 11025 );
rateSelect->addItem( tr("22050"), 22050 );
rateSelect->addItem( tr("44100"), 44100 );
rateSelect->addItem( tr("48000"), 48000 );
rateSelect->addItem( tr("96000"), 96000 );
hbox2->addWidget( lbl );
hbox2->addWidget( rateSelect );
vbox1->addLayout( hbox2 );
// Buffer Size Select
//
lbl = new QLabel("Buffer Size (in ms)");
bufSizeSlider = new QSlider( Qt::Horizontal );
bufSizeSlider->setMinimum( 15);
bufSizeSlider->setMaximum(200);
bufSizeSlider->setSliderPosition(128);
vbox1->addWidget( lbl );
vbox1->addWidget( bufSizeSlider );
// Swap Duty Cycles
swapDutyChkbox = new QCheckBox("Swap Duty Cycles");
vbox1->addWidget( swapDutyChkbox );
hbox1->addLayout( vbox1 );
// Set Final Layout
setLayout( hbox1 );
}
//----------------------------------------------------
GameSndConfDialog_t::~GameSndConfDialog_t(void)
{
}
//----------------------------------------------------

View File

@ -0,0 +1,39 @@
// GameSoundConf.h
//
#ifndef __GameSndH__
#define __GameSndH__
#include <QWidget>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QPushButton>
#include <QLabel>
#include <QSlider>
#include <QFrame>
#include <QGroupBox>
class GameSndConfDialog_t : public QDialog
{
Q_OBJECT
public:
GameSndConfDialog_t(QWidget *parent = 0);
~GameSndConfDialog_t(void);
protected:
QCheckBox *enaChkbox;
QCheckBox *enaLowPass;
QCheckBox *swapDutyChkbox;
QComboBox *qualitySelect;
QComboBox *rateSelect;
QSlider *bufSizeSlider;
private slots:
};
#endif