2015-01-06 03:13:44 +00:00
|
|
|
#pragma once
|
2015-01-06 13:25:51 +00:00
|
|
|
#include <map>
|
2015-01-06 03:13:44 +00:00
|
|
|
#include "hiopl.h"
|
2015-01-09 05:20:19 +00:00
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
2015-01-06 03:13:44 +00:00
|
|
|
|
|
|
|
class DROMultiplexer
|
|
|
|
{
|
|
|
|
public:
|
2015-01-06 13:25:51 +00:00
|
|
|
static const int MELODIC_CHANNELS = 15;
|
|
|
|
|
2015-01-06 03:13:44 +00:00
|
|
|
DROMultiplexer();
|
|
|
|
~DROMultiplexer();
|
|
|
|
|
|
|
|
void TwoOpMelodicNoteOn(Hiopl* opl, int ch);
|
|
|
|
void TwoOpMelodicNoteOff(Hiopl* opl, int ch);
|
2015-01-15 01:55:29 +00:00
|
|
|
void PercussionChange(Hiopl* opl, int perc);
|
2015-01-06 03:13:44 +00:00
|
|
|
|
|
|
|
void InitCaptureVariables();
|
|
|
|
bool IsAnInstanceRecording();
|
|
|
|
bool IsAnotherInstanceRecording();
|
2015-01-09 05:20:19 +00:00
|
|
|
bool StartCapture(const char* filepath, Hiopl* opl);
|
2015-01-06 03:13:44 +00:00
|
|
|
void StopCapture();
|
2015-01-06 13:25:51 +00:00
|
|
|
static DROMultiplexer* GetMaster();
|
2015-01-06 03:13:44 +00:00
|
|
|
|
2015-01-06 13:25:51 +00:00
|
|
|
private:
|
2015-01-06 03:13:44 +00:00
|
|
|
void _CaptureDelay(Bit16u delayMs);
|
|
|
|
void _CaptureRegWriteWithDelay(Bit32u reg, Bit8u value);
|
|
|
|
void _CaptureRegWrite(Bit32u reg, Bit8u value);
|
|
|
|
void _CaptureOpl3Enable();
|
2015-01-09 05:20:19 +00:00
|
|
|
int _FindFreeChannel(Hiopl* opl, int inCh);
|
2015-01-15 01:55:29 +00:00
|
|
|
void _CopyOplChannelSettings(Hiopl* opl, int inCh, int outCh);
|
|
|
|
void _CopyOplPercussionSettings(Hiopl* opl, int pIdx);
|
2015-01-09 06:53:33 +00:00
|
|
|
void _DebugOut(const char* str);
|
2015-01-06 03:13:44 +00:00
|
|
|
static DROMultiplexer* master;
|
2015-01-15 01:55:29 +00:00
|
|
|
Bit8u OxBD; // cached value of percussion register
|
2015-01-06 13:25:51 +00:00
|
|
|
|
2015-01-06 03:13:44 +00:00
|
|
|
FILE* captureHandle;
|
|
|
|
Bit64s captureStart;
|
|
|
|
Bit64s lastWrite;
|
|
|
|
Bit32u captureLengthBytes;
|
2015-01-09 05:20:19 +00:00
|
|
|
static CriticalSection lock;
|
2015-01-06 03:13:44 +00:00
|
|
|
|
2015-01-06 13:25:51 +00:00
|
|
|
typedef struct oplch {
|
|
|
|
Hiopl* opl;
|
|
|
|
int ch;
|
|
|
|
bool operator<(const oplch &o) const {
|
|
|
|
return opl < o.opl ||
|
|
|
|
(opl == o.opl && ch < o.ch);
|
|
|
|
};
|
|
|
|
bool operator==(const oplch &o) const {
|
|
|
|
return opl == o.opl && ch == o.ch;
|
|
|
|
};
|
|
|
|
} OplCh_t;
|
|
|
|
|
|
|
|
OplCh_t channels[MELODIC_CHANNELS];
|
|
|
|
std::map<OplCh_t, int> channelMap;
|
2015-01-06 03:13:44 +00:00
|
|
|
};
|
|
|
|
|