API Reference Definitions - DhrBaksteen/ArduinoOPL2 GitHub Wiki
Notation used in the API reference
- Arguments that are limited to a certain range are given as
[minValue, maxValue]
- Arguments that are one of a limited set are given as
{option1, option2 ... optionN}
- Channel arguments will show
MAX_CHANNEL
as the maximum channel number that can be used. This number will be different depending on the board you're using (9 for OPL3 Audio Board and 36 for OPL3 Duo). ThereforMAX_CHANNELS
should be read asgetNumChannels() - 1
.
Definitions for OPL2 Audio Board
OPL2 generic
#define OPL2_NUM_CHANNELS 9
#define NUM_OCTAVES 7
Default pins
Pins used by OPL2 Audio Board in default constructor.
#define PIN_LATCH 10
#define PIN_ADDR 9
#define PIN_RESET 8
Operators
Operator definitions for functions using the op
argument.
#define OPERATOR1 0
#define OPERATOR2 1
#define MODULATOR 0
#define CARRIER 1
2-Operator synthesis mode
Used by getSynthMode()
and setSynthMode()
functions
#define SYNTH_MODE_FM 0
#define SYNTH_MODE_AM 1
Notes
Defines note numbers that can be used with playNote()
.
#define NUM_NOTES 12
#define NOTE_C 0
#define NOTE_CS 1
#define NOTE_D 2
#define NOTE_DS 3
#define NOTE_E 4
#define NOTE_F 5
#define NOTE_FS 6
#define NOTE_G 7
#define NOTE_GS 8
#define NOTE_A 9
#define NOTE_AS 10
#define NOTE_B 11
Drum sounds
Drum sound definitions for playDrum()
.
#define NUM_DRUM_SOUNDS 5
#define DRUM_BASS 0
#define DRUM_SNARE 1
#define DRUM_TOM 2
#define DRUM_CYMBAL 3
#define DRUM_HI_HAT 4
Instrument types
Instrument type definitions used by instrument structures to distinguish between melodic instruments and various drum instruments.
#define INSTRUMENT_TYPE_MELODIC 0
#define INSTRUMENT_TYPE_BASS 6
#define INSTRUMENT_TYPE_SNARE 7
#define INSTRUMENT_TYPE_TOM 8
#define INSTRUMENT_TYPE_CYMBAL 9
#define INSTRUMENT_TYPE_HI_HAT 10
Instrument data source
Used by loadInstrument()
to either load from PROGMEM or SRAM.
#define INSTRUMENT_DATA_PROGMEM true
#define INSTRUMENT_DATA_SRAM false
Definitions for OPL3 Duo
These definitions are in addition to the ones given above.
OPL3 Duo generic
#define OPL3DUO_NUM_2OP_CHANNELS 36
#define OPL3DUO_NUM_4OP_CHANNELS 12
4-Operator synthesis mode
Synthesis modes used by get4OPSynthMode()
and set4OPSynthMode
.
#define SYNTH_MODE_FM_FM 0
#define SYNTH_MODE_FM_AM 1
#define SYNTH_MODE_AM_FM 2
#define SYNTH_MODE_AM_AM 3