aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi.cpp
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-10-05 22:29:37 +0200
committerJP Cimalando <jpcima@users.noreply.github.com>2018-10-05 22:29:37 +0200
commitc542a7576de33ecc9c9744cf5a4df7d094af5c47 (patch)
tree7972745dc36ca6c0fdfe2c05ba1173bb4d6bdca6 /src/adlmidi.cpp
parent6bb43bedde33404428f1baa75c1f0f97896a5cc7 (diff)
downloadlibADLMIDI-c542a7576de33ecc9c9744cf5a4df7d094af5c47.tar.gz
libADLMIDI-c542a7576de33ecc9c9744cf5a4df7d094af5c47.tar.bz2
libADLMIDI-c542a7576de33ecc9c9744cf5a4df7d094af5c47.zip
typedef OPL3 as Synth
Diffstat (limited to 'src/adlmidi.cpp')
-rw-r--r--src/adlmidi.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp
index cddfca2..541dbb4 100644
--- a/src/adlmidi.cpp
+++ b/src/adlmidi.cpp
@@ -120,7 +120,7 @@ ADLMIDI_EXPORT int adl_setNumChips(ADL_MIDIPlayer *device, int numChips)
else if(play->m_setup.numFourOps < -1)
play->m_setup.numFourOps = -1;
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
if(!synth.setupLocked())
{
synth.m_numChips = play->m_setup.numChips;
@@ -180,7 +180,7 @@ ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank)
return -1;
}
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.bankId = static_cast<uint32_t>(bankno);
synth.setEmbeddedBank(play->m_setup.bankId);
play->applySetup();
@@ -213,7 +213,7 @@ ADLMIDI_EXPORT int adl_reserveBanks(ADL_MIDIPlayer *device, unsigned banks)
return -1;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth->m_insBanks;
+ Synth::BankMap &map = play->m_synth->m_insBanks;
map.reserve(banks);
return (int)map.capacity();
}
@@ -226,13 +226,13 @@ ADLMIDI_EXPORT int adl_getBank(ADL_MIDIPlayer *device, const ADL_BankId *idp, in
ADL_BankId id = *idp;
if(id.lsb > 127 || id.msb > 127 || id.percussive > 1)
return -1;
- size_t idnumber = ((id.msb << 8) | id.lsb | (id.percussive ? size_t(OPL3::PercussionTag) : 0));
+ size_t idnumber = ((id.msb << 8) | id.lsb | (id.percussive ? size_t(Synth::PercussionTag) : 0));
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth->m_insBanks;
+ Synth::BankMap &map = play->m_synth->m_insBanks;
- OPL3::BankMap::iterator it;
+ Synth::BankMap::iterator it;
if(!(flags & ADLMIDI_Bank_Create))
{
it = map.find(idnumber);
@@ -241,16 +241,16 @@ ADLMIDI_EXPORT int adl_getBank(ADL_MIDIPlayer *device, const ADL_BankId *idp, in
}
else
{
- std::pair<size_t, OPL3::Bank> value;
+ std::pair<size_t, Synth::Bank> value;
value.first = idnumber;
memset(&value.second, 0, sizeof(value.second));
for (unsigned i = 0; i < 128; ++i)
value.second.ins[i].flags = adlinsdata::Flag_NoSound;
- std::pair<OPL3::BankMap::iterator, bool> ir;
+ std::pair<Synth::BankMap::iterator, bool> ir;
if(flags & ADLMIDI_Bank_CreateRt)
{
- ir = map.insert(value, OPL3::BankMap::do_not_expand_t());
+ ir = map.insert(value, Synth::BankMap::do_not_expand_t());
if(ir.first == map.end())
return -1;
}
@@ -268,11 +268,11 @@ ADLMIDI_EXPORT int adl_getBankId(ADL_MIDIPlayer *device, const ADL_Bank *bank, A
if(!device || !bank)
return -1;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
- OPL3::BankMap::key_type idnumber = it->first;
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap::key_type idnumber = it->first;
id->msb = (idnumber >> 8) & 127;
id->lsb = idnumber & 127;
- id->percussive = (idnumber & OPL3::PercussionTag) ? 1 : 0;
+ id->percussive = (idnumber & Synth::PercussionTag) ? 1 : 0;
return 0;
}
@@ -283,8 +283,8 @@ ADLMIDI_EXPORT int adl_removeBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth->m_insBanks;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap &map = play->m_synth->m_insBanks;
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
size_t size = map.size();
map.erase(it);
return (map.size() != size) ? 0 : -1;
@@ -297,9 +297,9 @@ ADLMIDI_EXPORT int adl_getFirstBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth->m_insBanks;
+ Synth::BankMap &map = play->m_synth->m_insBanks;
- OPL3::BankMap::iterator it = map.begin();
+ Synth::BankMap::iterator it = map.begin();
if(it == map.end())
return -1;
@@ -314,9 +314,9 @@ ADLMIDI_EXPORT int adl_getNextBank(ADL_MIDIPlayer *device, ADL_Bank *bank)
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3::BankMap &map = play->m_synth->m_insBanks;
+ Synth::BankMap &map = play->m_synth->m_insBanks;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
if(++it == map.end())
return -1;
@@ -329,7 +329,7 @@ ADLMIDI_EXPORT int adl_getInstrument(ADL_MIDIPlayer *device, const ADL_Bank *ban
if(!device || !bank || index > 127 || !ins)
return -1;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
cvt_FMIns_to_ADLI(*ins, it->second.ins[index]);
ins->version = 0;
return 0;
@@ -343,7 +343,7 @@ ADLMIDI_EXPORT int adl_setInstrument(ADL_MIDIPlayer *device, ADL_Bank *bank, uns
if(ins->version != 0)
return -1;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
cvt_ADLI_to_FMIns(it->second.ins[index], *ins);
return 0;
}
@@ -366,11 +366,11 @@ ADLMIDI_EXPORT int adl_loadEmbeddedBank(struct ADL_MIDIPlayer *device, ADL_Bank
if(num < 0 || num >= maxAdlBanks())
return -1;
- OPL3::BankMap::iterator it = OPL3::BankMap::iterator::from_ptrs(bank->pointer);
+ Synth::BankMap::iterator it = Synth::BankMap::iterator::from_ptrs(bank->pointer);
size_t id = it->first;
for (unsigned i = 0; i < 128; ++i) {
- size_t insno = i + ((id & OPL3::PercussionTag) ? 128 : 0);
+ size_t insno = i + ((id & Synth::PercussionTag) ? 128 : 0);
size_t adlmeta = ::banks[num][insno];
it->second.ins[i] = adlinsdata2::from_adldata(::adlins[adlmeta]);
}
@@ -393,7 +393,7 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4)
return -1;
}
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.numFourOps = ops4;
if(!synth.setupLocked())
{
@@ -431,7 +431,7 @@ ADLMIDI_EXPORT void adl_setPercMode(ADL_MIDIPlayer *device, int percmod)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.rhythmMode = percmod;
if(!synth.setupLocked())
{
@@ -447,7 +447,7 @@ ADLMIDI_EXPORT void adl_setHVibrato(ADL_MIDIPlayer *device, int hvibro)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.deepVibratoMode = hvibro;
if(!synth.setupLocked())
{
@@ -471,7 +471,7 @@ ADLMIDI_EXPORT void adl_setHTremolo(ADL_MIDIPlayer *device, int htremo)
if(!device) return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.deepTremoloMode = htremo;
if(!synth.setupLocked())
{
@@ -496,7 +496,7 @@ ADLMIDI_EXPORT void adl_setScaleModulators(ADL_MIDIPlayer *device, int smod)
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.scaleModulators = smod;
if(!synth.setupLocked())
{
@@ -544,7 +544,7 @@ ADLMIDI_EXPORT void adl_setLogarithmicVolumes(struct ADL_MIDIPlayer *device, int
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.logarithmicVolumes = (logvol != 0);
if(!synth.setupLocked())
{
@@ -561,12 +561,12 @@ ADLMIDI_EXPORT void adl_setVolumeRangeModel(struct ADL_MIDIPlayer *device, int v
return;
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.volumeScaleModel = volumeModel;
if(!synth.setupLocked())
{
if(play->m_setup.volumeScaleModel == ADLMIDI_VolumeModel_AUTO)//Use bank default volume model
- synth.m_volumeScale = (OPL3::VolumesScale)synth.m_insBankSetup.volumeModel;
+ synth.m_volumeScale = (Synth::VolumesScale)synth.m_insBankSetup.volumeModel;
else
synth.setVolumeScaleModel(static_cast<ADLMIDI_VolumeModels>(volumeModel));
}
@@ -692,7 +692,7 @@ ADLMIDI_EXPORT const char *adl_chipEmulatorName(struct ADL_MIDIPlayer *device)
#ifndef ADLMIDI_HW_OPL
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
if(!synth.m_chips.empty())
return synth.m_chips[0]->emulatorName();
#else
@@ -726,7 +726,7 @@ ADLMIDI_EXPORT int adl_setRunAtPcmRate(ADL_MIDIPlayer *device, int enabled)
{
MidiPlayer *play = GET_MIDI_PLAYER(device);
assert(play);
- OPL3 &synth = *play->m_synth;
+ Synth &synth = *play->m_synth;
play->m_setup.runAtPcmRate = (enabled != 0);
if(!synth.setupLocked())
play->partialReset();
@@ -1309,7 +1309,7 @@ ADLMIDI_EXPORT int adl_playFormat(ADL_MIDIPlayer *device, int sampleCount,
//fill buffer with zeros
int32_t *out_buf = player->m_outBuf;
std::memset(out_buf, 0, static_cast<size_t>(in_generatedPhys) * sizeof(out_buf[0]));
- OPL3 &synth = *player->m_synth;
+ Synth &synth = *player->m_synth;
unsigned int chips = synth.m_numChips;
if(chips == 1)
{
@@ -1400,7 +1400,7 @@ ADLMIDI_EXPORT int adl_generateFormat(struct ADL_MIDIPlayer *device, int sampleC
//fill buffer with zeros
int32_t *out_buf = player->m_outBuf;
std::memset(out_buf, 0, static_cast<size_t>(in_generatedPhys) * sizeof(out_buf[0]));
- OPL3 &synth = *player->m_synth;
+ Synth &synth = *player->m_synth;
unsigned int chips = synth.m_numChips;
if(chips == 1)
synth.m_chips[0]->generate32(out_buf, (size_t)in_generatedStereo);