API Reference Low level access - DhrBaksteen/ArduinoOPL2 GitHub Wiki
void OPL2::write(byte reg, byte data);
Write the a value to the given OPL register. Bare in mind that when write it called directly it will not update the shadow registers. You cannot rely on the getters and setters of the OPL2 library if you use this function directly.
byte OPL2::getChipRegister(short reg);
Get the value of a chip-wide register from the shadow registers.
-
bytereg- The chip-wide register to read {0x01,0x08,0xBD}
byte The value stored in the given register. If reg is out of range then the value of register 0x01 is returned
void OPL2::setChipRegister(short reg, byte value);
Set the value of a chip-wide register in the shadow registers and write it to the chip.
-
bytereg- The chip-wide register to alter {0x01,0x08,0xBD}
If
regis not one of the chip-wide registers then the value will be written to0x01.
byte OPL2::getChipRegisterOffset(short reg);
Get the offset of the chip-wide register within the shadow register array.
-
bytereg- The chip-wide register {0x01,0x08,0xBD}
byte The offset to the chip-wide register in the array of shadow registers. If reg is not a chip-wide register then 0 will be returned
byte OPL2::getChannelRegister(byte baseRegister, byte channel);
Get the value of a channel register using the given base register from shadow registers.
-
bytebaseRegister- The base register {0xA0,0xB0,0xC0} -
bytechannel- The channel [0,MAX_CHANNEL]
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0xA0. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels().
byte The value stored at the channel register
void OPL2::setChannelRegister(byte baseRegister, byte channel, byte value);
Set the value of a channel register in shadow registers and write it to the chip.
-
bytebaseRegister- The base register {0xA0,0xB0,0xC0} -
bytechannel- The channel [0,MAX_CHANNEL]
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0xA0. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels().
byte OPL2::getChannelRegisterOffset(byte baseRegister, byte channel);
Get the offset to the requested channel register within the shadow register array.
-
bytebaseRegister- The base register {0xA0,0xB0,0xC0} -
bytechannel- The channel [0,MAX_CHANNEL]
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0xA0. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels().
byte The offset to the channel register within the shadow register array
byte OPL2::getOperatorRegister(byte baseRegister, byte channel, byte op);
Get the value of an operator register from the shadow registers.
-
bytebaseRegister- The base register {0x20,0x40,0x60,0x80,0xE0} -
bytechannel- The channel [0,MAX_CHANNEL] -
byteop- The operator [0,1] or {OPERATOR1,OPERATOR2,MODULATOR,CARRIER}
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0x20. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels(). If then givenopis out of range thenopwill beop % 2.
byte The value stored at the requested operator register from shadow registers
void OPL2::setOperatorRegister(byte baseRegister, byte channel, byte op, byte value);
Set the value for the given operator register in the shadow registers and write it to the chip.
-
bytebaseRegister- The base register {0x20,0x40,0x60,0x80,0xE0} -
bytechannel- The channel [0,MAX_CHANNEL] -
byteop- The operator [0,1] or {OPERATOR1,OPERATOR2,MODULATOR,CARRIER} -
bytevalue- The value to set the operator register to
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0x20. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels(). If then givenopis out of range thenopwill beop % 2.
short getOperatorRegisterOffset(byte baseRegister, byte channel, byte operatorNum);
Get the offset of the given operator register within the shadow registers array.
-
bytebaseRegister- The base register {0x20,0x40,0x60,0x80,0xE0} -
bytechannel- The channel [0,MAX_CHANNEL] -
byteop- The operator [0,1] or {OPERATOR1,OPERATOR2,MODULATOR,CARRIER}
If the given
baseRegisteris not a channel register thenbaseRegisterwill be0x20. If the givenchannelis out of range thenchannelwill bechannel % getNumChannels(). If then givenopis out of range thenopwill beop % 2.
short The offset to requested operator register within the shadow registers array
byte getRegisterOffset(byte channel, byte operatorNum);
Get the offset to the operator register on the chip for a given channel operator.
-
bytechannel- The channel [0,MAX_CHANNEL] -
byteoperatorNum- The operator [0,1] or {OPERATOR1,OPERATOR2,MODULATOR,CARRIER}
If the given
channelis out of range thenchannelwill bechannel % getNumChannels(). If then givenoperatorNumis out of range thenoperatorNumwill beoperatorNum % 2.
byte The operator register offset for the given channel