private static void ResetChannel(List <byte> bytes, int channel, YM2151State cs) { byte register, value = 0; //Minden operátor kuss. register = (byte)(0x08); value = 0b00000000; value += (byte)(channel & 0b00000111); addtobytes(bytes, register, value, cs); for (int i = 0; i < 4; i++) { int slot = i * 8 + channel; //$60-$7F -VVVVVVV Slot1 - 32. Volume V = Volume(TL)(0 = max) register = (byte)(0x60 + slot); value = 127; addtobytes(bytes, register, value, cs); } }
private static void addtobytes(List <byte> bytes, byte register, byte value, YM2151State cs) { if (register == 0) { cs.accumulatedtiming += value; if (cs.accumulatedtiming >= 255) { bytes.Add(0); bytes.Add(255); cs.accumulatedtiming -= 255; } } else { if (cs.accumulatedtiming != 0) { bytes.Add(0); bytes.Add((byte)cs.accumulatedtiming); cs.accumulatedtiming = 0; } bytes.Add(register); bytes.Add(value); } }