mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
FM-TOWNS AUDIO: some cleanup in midi driver code
This commit is contained in:
parent
6287426db0
commit
85f7a01d2a
@ -833,9 +833,8 @@ const uint8 TownsMidiInputChannel::_programAdjustLevel[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
MidiDriver_TOWNS::MidiDriver_TOWNS(Audio::Mixer *mixer) : _timerProc(0), _timerProcPara(0), _channels(0), _out(0),
|
MidiDriver_TOWNS::MidiDriver_TOWNS(Audio::Mixer *mixer) : _timerProc(0), _timerProcPara(0), _channels(0), _out(0),
|
||||||
_chanState(0), _operatorLevelTable(0), _tickCounter1(0), _tickCounter2(0), _rand(1), _allocCurPos(0), _isOpen(false) {
|
_baseTempo(10080), _chanState(0), _operatorLevelTable(0), _tickCounter(0), _rand(1), _allocCurPos(0), _isOpen(false) {
|
||||||
// We set exteral mutex handling to true, since this driver is only suitable for use with the SCUMM engine
|
// We set exteral mutex handling to true to avoid lockups in SCUMM which has its own mutex.
|
||||||
// which has its own mutex. This causes lockups which cannot always be avoided.
|
|
||||||
_intf = new TownsAudioInterface(mixer, this, true);
|
_intf = new TownsAudioInterface(mixer, this, true);
|
||||||
|
|
||||||
_channels = new TownsMidiInputChannel*[32];
|
_channels = new TownsMidiInputChannel*[32];
|
||||||
@ -958,7 +957,7 @@ void MidiDriver_TOWNS::setTimerCallback(void *timer_param, Common::TimerManager:
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 MidiDriver_TOWNS::getBaseTempo() {
|
uint32 MidiDriver_TOWNS::getBaseTempo() {
|
||||||
return 10080;
|
return _baseTempo;
|
||||||
}
|
}
|
||||||
|
|
||||||
MidiChannel *MidiDriver_TOWNS::allocateChannel() {
|
MidiChannel *MidiDriver_TOWNS::allocateChannel() {
|
||||||
@ -986,12 +985,6 @@ void MidiDriver_TOWNS::timerCallback(int timerId) {
|
|||||||
case 1:
|
case 1:
|
||||||
updateParser();
|
updateParser();
|
||||||
updateOutputChannels();
|
updateOutputChannels();
|
||||||
|
|
||||||
/*_tickCounter1 += 10000;
|
|
||||||
while (_tickCounter1 >= 4167) {
|
|
||||||
_tickCounter1 -= 4167;
|
|
||||||
unkUpdate();
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1004,9 +997,9 @@ void MidiDriver_TOWNS::updateParser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MidiDriver_TOWNS::updateOutputChannels() {
|
void MidiDriver_TOWNS::updateOutputChannels() {
|
||||||
_tickCounter2 += 10000;
|
_tickCounter += _baseTempo;
|
||||||
while (_tickCounter2 >= 16667) {
|
while (_tickCounter >= 16667) {
|
||||||
_tickCounter2 -= 16667;
|
_tickCounter -= 16667;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
if (_out[i]->update())
|
if (_out[i]->update())
|
||||||
return;
|
return;
|
||||||
|
@ -69,14 +69,15 @@ private:
|
|||||||
|
|
||||||
TownsAudioInterface *_intf;
|
TownsAudioInterface *_intf;
|
||||||
|
|
||||||
uint32 _tickCounter1;
|
uint32 _tickCounter;
|
||||||
uint32 _tickCounter2;
|
|
||||||
uint8 _allocCurPos;
|
uint8 _allocCurPos;
|
||||||
uint8 _rand;
|
uint8 _rand;
|
||||||
|
|
||||||
bool _isOpen;
|
bool _isOpen;
|
||||||
|
|
||||||
uint8 *_operatorLevelTable;
|
uint8 *_operatorLevelTable;
|
||||||
|
|
||||||
|
const uint16 _baseTempo;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user