mirror of
https://github.com/ZDoom/ZMusic.git
synced 2024-12-03 09:02:17 +00:00
72c23d98a3
## 1.5.0 2020-09-28 * Drum note length expanding is now supported in real-time mode (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) * Added support for OPNA chip with Neko Project II Kai YM2602 emulator usage (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) * Added VGM file dumper which allows to output OPN2 commands into VGM file. (A new MIDI to VGM tool is now created with basing on libOPNMIDI) * Fixed an incorrect work of CC-121 (See https://github.com/Wohlstand/libADLMIDI/issues/227 for details) * Internality has been refactored and improved
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
// ---------------------------------------------------------------------------
|
||
// FM sound generator common timer module
|
||
// Copyright (C) cisc 1998, 2000.
|
||
// ---------------------------------------------------------------------------
|
||
// $Id: fmtimer.h,v 1.2 2003/04/22 13:12:53 cisc Exp $
|
||
|
||
#ifndef FM_TIMER_H
|
||
#define FM_TIMER_H
|
||
|
||
#include "fmgen_types.h"
|
||
|
||
// ---------------------------------------------------------------------------
|
||
|
||
namespace FM
|
||
{
|
||
struct TimerData {
|
||
uint8 status;
|
||
uint8 regtc;
|
||
uint8 regta[2];
|
||
int32 timera, timera_count;
|
||
int32 timerb, timerb_count;
|
||
int32 timer_step;
|
||
};
|
||
|
||
class Timer
|
||
{
|
||
public:
|
||
void Reset();
|
||
bool Count(int32 us);
|
||
int32 GetNextEvent();
|
||
|
||
void DataSave(struct TimerData* data);
|
||
void DataLoad(struct TimerData* data);
|
||
|
||
protected:
|
||
virtual void SetStatus(uint bit) = 0;
|
||
virtual void ResetStatus(uint bit) = 0;
|
||
|
||
void SetTimerBase(uint clock);
|
||
void SetTimerA(uint addr, uint data);
|
||
void SetTimerB(uint data);
|
||
void SetTimerControl(uint data);
|
||
|
||
uint8 status;
|
||
uint8 regtc;
|
||
|
||
private:
|
||
virtual void TimerA() {}
|
||
uint8 regta[2];
|
||
|
||
int32 timera, timera_count;
|
||
int32 timerb, timerb_count;
|
||
int32 timer_step;
|
||
};
|
||
|
||
// ---------------------------------------------------------------------------
|
||
// <09>‰Šú‰»
|
||
//
|
||
inline void Timer::Reset()
|
||
{
|
||
timera_count = 0;
|
||
timerb_count = 0;
|
||
}
|
||
|
||
} // namespace FM
|
||
|
||
#endif // FM_TIMER_H
|