extch3 bug
This commit is contained in:
parent
db1f29e227
commit
397a060633
|
@ -26,7 +26,8 @@ enum {
|
|||
MAX_FRAMES_PER_BUFFER = 4096,
|
||||
};
|
||||
|
||||
const double OPN_CLOCK_RATE = 3500000;
|
||||
//const double OPN_CLOCK_RATE = 3500000;
|
||||
const double OPN_CLOCK_RATE = 3540000;
|
||||
|
||||
PaStreamParameters outputParameters;
|
||||
PaStream* stream;
|
||||
|
@ -440,7 +441,7 @@ int main(int argc, char* argv[])
|
|||
// update console
|
||||
memset(console.buffer, 0, sizeof(CHAR_INFO) * console.bufsize.X * console.bufsize.Y);
|
||||
|
||||
tprintf(0, 0, "frame = %d", ff_pos);
|
||||
tprintf(0, 0, "frame = %d", opmctx.opm.pos.frame);
|
||||
|
||||
{
|
||||
int yy = 2;
|
||||
|
@ -485,7 +486,23 @@ int main(int argc, char* argv[])
|
|||
opn_reg_view[cc][0xA4 + co],
|
||||
opn_reg_view[cc][0xB0 + co]
|
||||
);
|
||||
|
||||
yy++;
|
||||
|
||||
if ((ch % 3) == 2) {
|
||||
tprintf(0, yy, "EC%d: [%02X %02X %02X %02X %02X %02X %02X %02X]",
|
||||
cc,
|
||||
opn_reg_view[cc][0xAD],
|
||||
opn_reg_view[cc][0xA9],
|
||||
opn_reg_view[cc][0xAC],
|
||||
opn_reg_view[cc][0xA8],
|
||||
opn_reg_view[cc][0xAE],
|
||||
opn_reg_view[cc][0xAA],
|
||||
opn_reg_view[cc][0xA6],
|
||||
opn_reg_view[cc][0xA2]
|
||||
);
|
||||
yy++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ struct opm_frame_record {
|
|||
enum {
|
||||
OPM_CHAN_NEWPATTERN = (1 << 0),
|
||||
OPM_CHAN_LOOP_POINT = (1 << 1),
|
||||
OPM_FRAME0 = (1 << 2),
|
||||
|
||||
OPM_CHAN_BACKREF = (1 << 8),
|
||||
};
|
||||
|
|
|
@ -348,6 +348,7 @@ int opm_requantize(opm_convert_context_t* ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// save total count of frames
|
||||
if (ctx->ch[0].opl.back().frame == currentFrame) {
|
||||
ctx->ch[0].opl.back().data.push_back(OPM_STREAM_END);
|
||||
|
@ -359,6 +360,7 @@ int opm_requantize(opm_convert_context_t* ctx) {
|
|||
endmarker.data.push_back(OPM_STREAM_END);
|
||||
ctx->ch[0].opl.push_back(endmarker);
|
||||
}
|
||||
#endif
|
||||
ctx->total_frames = currentFrame;
|
||||
|
||||
return 0;
|
||||
|
@ -448,10 +450,10 @@ int opm_group_control_stream(opm_convert_context_t* ctx, opm_channel_t* chctx, i
|
|||
|
||||
for (int f = 0; f < chctx->opl.size(); f++) {
|
||||
opm_channel_record_t chanrec;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
chanrec.frame_dist = f >= chctx->opl.size() - 1 ? 0 : chctx->opl[f + 1].frame - chctx->opl[f].frame;
|
||||
chanrec.flags = 0;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
if (chctx->opl[f].loop) chanrec.flags |= OPM_CHAN_LOOP_POINT;
|
||||
if (chctx->opl[f].frame == 0) chanrec.flags |= OPM_FRAME0;
|
||||
defrec.flags = 0;
|
||||
|
||||
// parse register writes
|
||||
|
@ -495,9 +497,9 @@ int opm_group_rhythm_stream(opm_convert_context_t* ctx, opm_channel_t* chctx, in
|
|||
for (int f = 0; f < chctx->opl.size(); f++) {
|
||||
opm_channel_record_t chanrec;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
chanrec.frame_dist = f >= chctx->opl.size() - 1 ? 0 : chctx->opl[f + 1].frame - chctx->opl[f].frame;
|
||||
chanrec.flags = 0;
|
||||
if (chctx->opl[f].loop) chanrec.flags |= OPM_CHAN_LOOP_POINT;
|
||||
if (chctx->opl[f].frame == 0) chanrec.flags |= OPM_FRAME0;
|
||||
defrec.flags = 0;
|
||||
|
||||
// parse register writes
|
||||
|
@ -541,9 +543,9 @@ int opm_group_fm_stream(opm_convert_context_t* ctx, opm_channel_t* chctx, int ch
|
|||
for (int f = 0; f < chctx->opl.size(); f++) {
|
||||
opm_channel_record_t chanrec;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
chanrec.frame_dist = f >= chctx->opl.size() - 1 ? 0 : chctx->opl[f + 1].frame - chctx->opl[f].frame;
|
||||
chanrec.flags = 0;
|
||||
if (chctx->opl[f].loop) chanrec.flags |= OPM_CHAN_LOOP_POINT;
|
||||
if (chctx->opl[f].frame == 0) chanrec.flags |= OPM_FRAME0;
|
||||
defrec.flags = 0;
|
||||
|
||||
// parse register writes
|
||||
|
@ -604,9 +606,9 @@ int opm_group_ssg_tone_stream(opm_convert_context_t* ctx, opm_channel_t* chctx,
|
|||
for (int f = 0; f < chctx->opl.size(); f++) {
|
||||
opm_channel_record_t chanrec;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
chanrec.frame_dist = f >= chctx->opl.size() - 1 ? 0 : chctx->opl[f + 1].frame - chctx->opl[f].frame;
|
||||
chanrec.flags = 0;
|
||||
if (chctx->opl[f].loop) chanrec.flags |= OPM_CHAN_LOOP_POINT;
|
||||
if (chctx->opl[f].frame == 0) chanrec.flags |= OPM_FRAME0;
|
||||
defrec.flags = 0;
|
||||
|
||||
// parse register writes
|
||||
|
@ -642,9 +644,9 @@ int opm_group_ssg_env_stream(opm_convert_context_t* ctx, opm_channel_t* chctx, i
|
|||
for (int f = 0; f < chctx->opl.size(); f++) {
|
||||
opm_channel_record_t chanrec;
|
||||
chanrec.frame = chctx->opl[f].frame;
|
||||
chanrec.frame_dist = f >= chctx->opl.size() - 1 ? 0 : chctx->opl[f + 1].frame - chctx->opl[f].frame;
|
||||
chanrec.flags = 0;
|
||||
if (chctx->opl[f].loop) chanrec.flags |= OPM_CHAN_LOOP_POINT;
|
||||
if (chctx->opl[f].frame == 0) chanrec.flags |= OPM_FRAME0;
|
||||
defrec.flags = 0;
|
||||
|
||||
// parse register writes
|
||||
|
@ -736,14 +738,16 @@ void opm_set_delay(std::vector<uint8_t>& vec, uint64_t delay) {
|
|||
|
||||
int opm_serialize_control_stream(opm_channel_t* chctx) {
|
||||
int old_delay = -1;
|
||||
for (auto& s : chctx->records) {
|
||||
for (int f = 0; f < chctx->records.size(); f++) {
|
||||
auto& s = chctx->records[f];
|
||||
s.rawdata.clear();
|
||||
|
||||
// set loop point
|
||||
if (s.flags & OPM_CHAN_LOOP_POINT) s.rawdata.push_back(OPM_STREAM_LOOP);
|
||||
|
||||
// set delay
|
||||
if (s.frame_dist != old_delay) {
|
||||
s.frame_dist = f >= chctx->records.size() - 1 ? 0 : chctx->records[f + 1].frame - chctx->records[f].frame;
|
||||
if (s.frame_dist != old_delay || (s.flags & OPM_CHAN_LOOP_POINT)) {
|
||||
old_delay = s.frame_dist;
|
||||
opm_set_delay(s.rawdata, s.frame_dist);
|
||||
}
|
||||
|
@ -810,14 +814,16 @@ int opm_serialize_control_stream(opm_channel_t* chctx) {
|
|||
|
||||
int opm_serialize_rhythm_stream(opm_channel_t* chctx) {
|
||||
int old_delay = -1;
|
||||
for (auto& s : chctx->records) {
|
||||
for (int f = 0; f < chctx->records.size(); f++) {
|
||||
auto& s = chctx->records[f];
|
||||
s.rawdata.clear();
|
||||
|
||||
// set loop point
|
||||
if (s.flags & OPM_CHAN_LOOP_POINT) s.rawdata.push_back(OPM_STREAM_LOOP);
|
||||
|
||||
// set delay
|
||||
if (s.frame_dist != old_delay) {
|
||||
s.frame_dist = f >= chctx->records.size() - 1 ? 0 : chctx->records[f + 1].frame - chctx->records[f].frame;
|
||||
if (s.frame_dist != old_delay || (s.flags & OPM_CHAN_LOOP_POINT)) {
|
||||
old_delay = s.frame_dist;
|
||||
opm_set_delay(s.rawdata, s.frame_dist);
|
||||
}
|
||||
|
@ -902,14 +908,16 @@ int opm_serialize_rhythm_stream(opm_channel_t* chctx) {
|
|||
|
||||
int opm_serialize_fm_stream(opm_channel_t* chctx) {
|
||||
int old_delay = -1;
|
||||
for (auto& s : chctx->records) {
|
||||
for (int f = 0; f < chctx->records.size(); f++) {
|
||||
auto& s = chctx->records[f];
|
||||
s.rawdata.clear();
|
||||
|
||||
// set loop point
|
||||
if (s.flags & OPM_CHAN_LOOP_POINT) s.rawdata.push_back(OPM_STREAM_LOOP);
|
||||
|
||||
// set delay
|
||||
if (s.frame_dist != old_delay) {
|
||||
s.frame_dist = f >= chctx->records.size() - 1 ? 0 : chctx->records[f + 1].frame - chctx->records[f].frame;
|
||||
if (s.frame_dist != old_delay || (s.flags & OPM_CHAN_LOOP_POINT)) {
|
||||
old_delay = s.frame_dist;
|
||||
opm_set_delay(s.rawdata, s.frame_dist);
|
||||
}
|
||||
|
@ -1015,14 +1023,16 @@ int opm_serialize_fm_stream(opm_channel_t* chctx) {
|
|||
|
||||
int opm_serialize_ssg_tone_stream(opm_channel_t* chctx) {
|
||||
int old_delay = -1;
|
||||
for (auto& s : chctx->records) {
|
||||
for (int f = 0; f < chctx->records.size(); f++) {
|
||||
auto& s = chctx->records[f];
|
||||
s.rawdata.clear();
|
||||
|
||||
// set loop point
|
||||
if (s.flags & OPM_CHAN_LOOP_POINT) s.rawdata.push_back(OPM_STREAM_LOOP);
|
||||
|
||||
// set delay
|
||||
if (s.frame_dist != old_delay) {
|
||||
s.frame_dist = f >= chctx->records.size() - 1 ? 0 : chctx->records[f + 1].frame - chctx->records[f].frame;
|
||||
if (s.frame_dist != old_delay || (s.flags & OPM_CHAN_LOOP_POINT)) {
|
||||
old_delay = s.frame_dist;
|
||||
opm_set_delay(s.rawdata, s.frame_dist);
|
||||
}
|
||||
|
@ -1083,14 +1093,16 @@ int opm_serialize_ssg_tone_stream(opm_channel_t* chctx) {
|
|||
|
||||
int opm_serialize_ssg_env_stream(opm_channel_t* chctx) {
|
||||
int old_delay = -1;
|
||||
for (auto& s : chctx->records) {
|
||||
for (int f = 0; f < chctx->records.size(); f++) {
|
||||
auto& s = chctx->records[f];
|
||||
s.rawdata.clear();
|
||||
|
||||
// set loop point
|
||||
if (s.flags & OPM_CHAN_LOOP_POINT) s.rawdata.push_back(OPM_STREAM_LOOP);
|
||||
|
||||
// set delay
|
||||
if (s.frame_dist != old_delay) {
|
||||
s.frame_dist = f >= chctx->records.size() - 1 ? 0 : chctx->records[f + 1].frame - chctx->records[f].frame;
|
||||
if (s.frame_dist != old_delay || (s.flags & OPM_CHAN_LOOP_POINT)) {
|
||||
old_delay = s.frame_dist;
|
||||
opm_set_delay(s.rawdata, s.frame_dist);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue