-
Notifications
You must be signed in to change notification settings - Fork 39
API Reference Low level access
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.
-
byte
reg
- 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.
-
byte
reg
- The chip-wide register to alter {0x01
,0x08
,0xBD
}
If
reg
is 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.
-
byte
reg
- 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.
-
byte
baseRegister
- The base register {0xA0
,0xB0
,0xC0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
]
If the given
baseRegister
is not a channel register thenbaseRegister
will be0xA0
. If the givenchannel
is out of range thenchannel
will 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.
-
byte
baseRegister
- The base register {0xA0
,0xB0
,0xC0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
]
If the given
baseRegister
is not a channel register thenbaseRegister
will be0xA0
. If the givenchannel
is out of range thenchannel
will bechannel % getNumChannels()
.
byte OPL2::getChannelRegisterOffset(byte baseRegister, byte channel);
Get the offset to the requested channel register within the shadow register array.
-
byte
baseRegister
- The base register {0xA0
,0xB0
,0xC0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
]
If the given
baseRegister
is not a channel register thenbaseRegister
will be0xA0
. If the givenchannel
is out of range thenchannel
will 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.
-
byte
baseRegister
- The base register {0x20
,0x40
,0x60
,0x80
,0xE0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
] -
byte
op
- The operator [0
,1
] or {OPERATOR1
,OPERATOR2
,MODULATOR
,CARRIER
}
If the given
baseRegister
is not a channel register thenbaseRegister
will be0x20
. If the givenchannel
is out of range thenchannel
will bechannel % getNumChannels()
. If then givenop
is out of range thenop
will 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.
-
byte
baseRegister
- The base register {0x20
,0x40
,0x60
,0x80
,0xE0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
] -
byte
op
- The operator [0
,1
] or {OPERATOR1
,OPERATOR2
,MODULATOR
,CARRIER
} -
byte
value
- The value to set the operator register to
If the given
baseRegister
is not a channel register thenbaseRegister
will be0x20
. If the givenchannel
is out of range thenchannel
will bechannel % getNumChannels()
. If then givenop
is out of range thenop
will beop % 2
.
short getOperatorRegisterOffset(byte baseRegister, byte channel, byte operatorNum);
Get the offset of the given operator register within the shadow registers array.
-
byte
baseRegister
- The base register {0x20
,0x40
,0x60
,0x80
,0xE0
} -
byte
channel
- The channel [0
,MAX_CHANNEL
] -
byte
op
- The operator [0
,1
] or {OPERATOR1
,OPERATOR2
,MODULATOR
,CARRIER
}
If the given
baseRegister
is not a channel register thenbaseRegister
will be0x20
. If the givenchannel
is out of range thenchannel
will bechannel % getNumChannels()
. If then givenop
is out of range thenop
will 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.
-
byte
channel
- The channel [0
,MAX_CHANNEL
] -
byte
operatorNum
- The operator [0
,1
] or {OPERATOR1
,OPERATOR2
,MODULATOR
,CARRIER
}
If the given
channel
is out of range thenchannel
will bechannel % getNumChannels()
. If then givenoperatorNum
is out of range thenoperatorNum
will beoperatorNum % 2
.
byte
The operator register offset for the given channel
- OPL2 Audio Board assembly guide
- Connecting the OPL2 Audio Board
- Connecting the OPL3 Duo!
- Troubleshooting
- Definitions
- Constructors and initialization
- Utility functions and helpers
- Instrument functions
- Register getters and setters
- OPL3Duo extensions
- Low level access
- Running OPL2 Audio Board example code on your OPL3 Duo!
- In-depth OPL2 and OPL3 programming guide
- Making a sound
- Working with instruments
- Using the OPL3BankEditor
- DosBox configuration (MIDI only)
- DosBox-X configuration
- Nuke.YKT's serial OPL2/OPL3 protocol
- Bonus project: Touch sensor piano