Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Wohlstand/OPN2BankEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
Wohlstand committed Aug 26, 2019
2 parents b37f8a3 + bf47acc commit e7e18ff
Show file tree
Hide file tree
Showing 12 changed files with 1,335 additions and 3,009 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ endif()
set(SOURCES
"src/audio.cpp"
"src/bank_editor.cpp"
"src/operator_editor.cpp"
"src/bank_comparison.cpp"
"src/controlls.cpp"
"src/proxystyle.cpp"
Expand All @@ -130,6 +131,7 @@ endif()

set(UIS
"src/bank_editor.ui"
"src/operator_editor.ui"
"src/bank_comparison.ui"
"src/formats_sup.ui"
"src/importer.ui"
Expand Down
5 changes: 4 additions & 1 deletion FMBankEdit.pro
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ QMAKE_CXXFLAGS += -fopenmp

TEMPLATE = app
TARGET = opn2_bank_editor
INCLUDEPATH += $$PWD/
INCLUDEPATH += $$PWD/src

android:{
ARCH=android_arm
Expand Down Expand Up @@ -98,6 +98,7 @@ SOURCES += \
src/audio.cpp \
src/bank.cpp \
src/bank_editor.cpp \
src/operator_editor.cpp \
src/bank_comparison.cpp \
src/common.cpp \
src/controlls.cpp \
Expand Down Expand Up @@ -137,6 +138,7 @@ SOURCES += \

HEADERS += \
src/bank_editor.h \
src/operator_editor.h \
src/bank_comparison.h \
src/bank.h \
src/common.h \
Expand Down Expand Up @@ -179,6 +181,7 @@ HEADERS += \

FORMS += \
src/bank_editor.ui \
src/operator_editor.ui \
src/bank_comparison.ui \
src/formats_sup.ui \
src/importer.ui \
Expand Down
2 changes: 1 addition & 1 deletion src/audio_config.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<item>
<widget class="QToolButton" name="btnChooseDevice">
<property name="text">
<string>...</string>
<string notr="true">...</string>
</property>
</widget>
</item>
Expand Down
84 changes: 22 additions & 62 deletions src/bank_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#include <QSettings>
#include <QUrl>
#include <QMimeData>
#include <QStandardItemModel>
#include <QClipboard>
#include <QtDebug>

#include "importer.h"
#include "formats_sup.h"
#include "bank_editor.h"
#include "ui_bank_editor.h"
#include "operator_editor.h"
#include "bank_comparison.h"
#include "audio_config.h"
#include "ins_names.h"
Expand Down Expand Up @@ -126,18 +126,13 @@ BankEditor::BankEditor(QWidget *parent) :
connect(ui->actionEmulatorMameOPNA, SIGNAL(triggered()), this, SLOT(toggleEmulator()));
connect(ui->actionEmulatorPMDWinOPNA, SIGNAL(triggered()), this, SLOT(toggleEmulator()));

/* Hide first 7 SSG-EG items */
OperatorEditor *op_editors[4] = {ui->op1edit, ui->op2edit, ui->op3edit, ui->op4edit};

for(size_t i = 0; i < 4; i++)
{
QComboBox *ssgegs[4] = {ui->op1_ssgeg, ui->op2_ssgeg, ui->op3_ssgeg, ui->op4_ssgeg};
for(size_t i = 0; i < 4; i++)
{
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(ssgegs[i]->model());
for(int j = 1; j < 8; j++)
{
QStandardItem* item = model->item(j);
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
}
}
OperatorEditor *ed = op_editors[i];
ed->setOperatorNumber(i);
connect(ed, SIGNAL(operatorChanged()), this, SLOT(onOperatorChanged()));
}

ui->instruments->installEventFilter(this);
Expand Down Expand Up @@ -339,6 +334,12 @@ void BankEditor::onBankEditorShown()
void BankEditor::onLanguageChanged()
{
ui->retranslateUi(this);
OperatorEditor *op_editors[4] = {ui->op1edit, ui->op2edit, ui->op3edit, ui->op4edit};
for(size_t i = 0; i < 4; i++)
{
OperatorEditor *ed = op_editors[i];
ed->onLanguageChanged();
}
ui->currentFile->setText(m_currentFilePath);
ui->version->setText(QString("%1, v.%2").arg(PROGRAM_NAME).arg(VERSION));
reloadBanks();
Expand Down Expand Up @@ -1082,53 +1083,9 @@ void BankEditor::loadInstrument()
ui->fmsens->setCurrentIndex(m_curInst->fm);
ui->algorithm->setCurrentIndex(m_curInst->algorithm);

ui->op1_attack->setValue( m_curInst->OP[OPERATOR1_HR].attack);
ui->op1_decay1->setValue( m_curInst->OP[OPERATOR1_HR].decay1);
ui->op1_decay2->setValue( m_curInst->OP[OPERATOR1_HR].decay2);
ui->op1_sustain->setValue( m_curInst->OP[OPERATOR1_HR].sustain);
ui->op1_release->setValue( m_curInst->OP[OPERATOR1_HR].release);
ui->op1_am->setChecked( m_curInst->OP[OPERATOR1_HR].am_enable);
ui->op1_freqmult->setValue( m_curInst->OP[OPERATOR1_HR].fmult);
ui->op1_level->setValue( m_curInst->OP[OPERATOR1_HR].level);
ui->op1_detune->setCurrentIndex(m_curInst->OP[OPERATOR1_HR].detune);
ui->op1_ratescale->setValue( m_curInst->OP[OPERATOR1_HR].ratescale);
ui->op1_ssgeg->setCurrentIndex( m_curInst->OP[OPERATOR1_HR].ssg_eg);

ui->op2_attack->setValue( m_curInst->OP[OPERATOR2_HR].attack);
ui->op2_decay1->setValue( m_curInst->OP[OPERATOR2_HR].decay1);
ui->op2_decay2->setValue( m_curInst->OP[OPERATOR2_HR].decay2);
ui->op2_sustain->setValue( m_curInst->OP[OPERATOR2_HR].sustain);
ui->op2_release->setValue( m_curInst->OP[OPERATOR2_HR].release);
ui->op2_am->setChecked( m_curInst->OP[OPERATOR2_HR].am_enable);
ui->op2_freqmult->setValue( m_curInst->OP[OPERATOR2_HR].fmult);
ui->op2_level->setValue( m_curInst->OP[OPERATOR2_HR].level);
ui->op2_detune->setCurrentIndex(m_curInst->OP[OPERATOR2_HR].detune);
ui->op2_ratescale->setValue( m_curInst->OP[OPERATOR2_HR].ratescale);
ui->op2_ssgeg->setCurrentIndex( m_curInst->OP[OPERATOR2_HR].ssg_eg);

ui->op3_attack->setValue( m_curInst->OP[OPERATOR3_HR].attack);
ui->op3_decay1->setValue( m_curInst->OP[OPERATOR3_HR].decay1);
ui->op3_decay2->setValue( m_curInst->OP[OPERATOR3_HR].decay2);
ui->op3_sustain->setValue( m_curInst->OP[OPERATOR3_HR].sustain);
ui->op3_release->setValue( m_curInst->OP[OPERATOR3_HR].release);
ui->op3_am->setChecked( m_curInst->OP[OPERATOR3_HR].am_enable);
ui->op3_freqmult->setValue( m_curInst->OP[OPERATOR3_HR].fmult);
ui->op3_level->setValue( m_curInst->OP[OPERATOR3_HR].level);
ui->op3_detune->setCurrentIndex(m_curInst->OP[OPERATOR3_HR].detune);
ui->op3_ratescale->setValue( m_curInst->OP[OPERATOR3_HR].ratescale);
ui->op3_ssgeg->setCurrentIndex( m_curInst->OP[OPERATOR3_HR].ssg_eg);

ui->op4_attack->setValue( m_curInst->OP[OPERATOR4_HR].attack);
ui->op4_decay1->setValue( m_curInst->OP[OPERATOR4_HR].decay1);
ui->op4_decay2->setValue( m_curInst->OP[OPERATOR4_HR].decay2);
ui->op4_sustain->setValue( m_curInst->OP[OPERATOR4_HR].sustain);
ui->op4_release->setValue( m_curInst->OP[OPERATOR4_HR].release);
ui->op4_am->setChecked( m_curInst->OP[OPERATOR4_HR].am_enable);
ui->op4_freqmult->setValue( m_curInst->OP[OPERATOR4_HR].fmult);
ui->op4_level->setValue( m_curInst->OP[OPERATOR4_HR].level);
ui->op4_detune->setCurrentIndex(m_curInst->OP[OPERATOR4_HR].detune);
ui->op4_ratescale->setValue( m_curInst->OP[OPERATOR4_HR].ratescale);
ui->op4_ssgeg->setCurrentIndex( m_curInst->OP[OPERATOR4_HR].ssg_eg);
OperatorEditor *op_editors[4] = {ui->op1edit, ui->op2edit, ui->op3edit, ui->op4edit};
for(unsigned i = 0; i < 4; ++i)
op_editors[i]->loadDataFromInst(*m_curInst);

m_lock = false;
}
Expand Down Expand Up @@ -1203,8 +1160,10 @@ void BankEditor::createLanguageChoices()

QStringList languages;
languages.push_back("en"); // generic english
foreach (const QString &entry, dir.entryList()) {
if (entry.startsWith(prefix, cs) && entry.endsWith(suffix, cs)) {
foreach(const QString &entry, dir.entryList())
{
if(entry.startsWith(prefix, cs) && entry.endsWith(suffix, cs))
{
QString lang = entry.mid(
prefix.size(), entry.size() - prefix.size() - suffix.size());
languages << lang;
Expand All @@ -1213,7 +1172,8 @@ void BankEditor::createLanguageChoices()

QMenu *menuLanguage = ui->menuLanguage;

foreach (const QString &lang, languages) {
foreach(const QString &lang, languages)
{
QLocale loc(lang);

QString name;
Expand Down
48 changes: 1 addition & 47 deletions src/bank_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,53 +482,7 @@ private slots:
void on_lfoEnable_clicked(bool checked);
void on_lfoFrequency_currentIndexChanged(int index);

void on_op1_attack_valueChanged(int arg1);
void on_op1_decay1_valueChanged(int arg1);
void on_op1_decay2_valueChanged(int arg1);
void on_op1_sustain_valueChanged(int arg1);
void on_op1_release_valueChanged(int arg1);
void on_op1_am_toggled(bool checked);
void on_op1_level_valueChanged(int arg1);
void on_op1_freqmult_valueChanged(int arg1);
void on_op1_detune_currentIndexChanged(int index);
void on_op1_ratescale_valueChanged(int arg1);
void on_op1_ssgeg_currentIndexChanged(int index);

void on_op2_attack_valueChanged(int arg1);
void on_op2_decay1_valueChanged(int arg1);
void on_op2_decay2_valueChanged(int arg1);
void on_op2_sustain_valueChanged(int arg1);
void on_op2_release_valueChanged(int arg1);
void on_op2_am_toggled(bool checked);
void on_op2_level_valueChanged(int arg1);
void on_op2_freqmult_valueChanged(int arg1);
void on_op2_detune_currentIndexChanged(int index);
void on_op2_ratescale_valueChanged(int arg1);
void on_op2_ssgeg_currentIndexChanged(int index);

void on_op3_attack_valueChanged(int arg1);
void on_op3_decay1_valueChanged(int arg1);
void on_op3_decay2_valueChanged(int arg1);
void on_op3_sustain_valueChanged(int arg1);
void on_op3_release_valueChanged(int arg1);
void on_op3_am_toggled(bool checked);
void on_op3_level_valueChanged(int arg1);
void on_op3_freqmult_valueChanged(int arg1);
void on_op3_detune_currentIndexChanged(int index);
void on_op3_ratescale_valueChanged(int arg1);
void on_op3_ssgeg_currentIndexChanged(int index);

void on_op4_attack_valueChanged(int arg1);
void on_op4_decay1_valueChanged(int arg1);
void on_op4_decay2_valueChanged(int arg1);
void on_op4_sustain_valueChanged(int arg1);
void on_op4_release_valueChanged(int arg1);
void on_op4_am_toggled(bool checked);
void on_op4_level_valueChanged(int arg1);
void on_op4_freqmult_valueChanged(int arg1);
void on_op4_detune_currentIndexChanged(int index);
void on_op4_ratescale_valueChanged(int arg1);
void on_op4_ssgeg_currentIndexChanged(int index);
void onOperatorChanged();

void on_pitchBendSlider_valueChanged(int value);
void on_pitchBendSlider_sliderReleased();
Expand Down
Loading

0 comments on commit e7e18ff

Please sign in to comment.