i think it would be more correct to apply a bitmask on each channel output, considering they are sequentially input to DAC, then sum up the channels, don't you think ? ( not sure why but i just noticed that i was even applying it at operator output, which seems wrong and might be a result of poor optimization attemptTmEE co.(TM) wrote:I do this in my core and it produces spectrally correct output compared to real chips, to the last details. I have not came up with any cleaner way to do this, maybe a bigass array to do translation so there's no compares and jumps...
Code: Select all
SELECT CASE OPNmode CASE 1 'YM3438 mode OPNbuf(i%, 0) = Lft AND &HFF80 OPNbuf(i%, 1) = Rit AND &HFF80 CASE 2 'YM2612 mode IF (Lft > 0) AND (Lft < 256) THEN OPNbuf(i%, 0) = Lft AND &HFF00 ELSE OPNbuf(i%, 0) = Lft AND &HFF80 END IF IF (Rit > 0) AND (Rit < 256) THEN OPNbuf(i%, 1) = Rit AND &HFF00 ELSE OPNbuf(i%, 1) = Rit AND &HFF80 END IF CASE ELSE 'Silky smooth mode OPNbuf(i%, 0) = Lft OPNbuf(i%, 1) = Rit END SELECT
EDIT: now looking at it, I need to do this crushing before panning stuff, will save cycles
also, not sure if i am missing something in your code but when sample value is within [0-255], having it masked with FF00h always result to zero so AND operation is uneeded