Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setInstrument does not support reading from SRAM on Arduino hardware #47

Closed
virtuaCode opened this issue Sep 30, 2019 · 1 comment
Closed

Comments

@virtuaCode
Copy link
Contributor

Hi @DhrBaksteen,
I'm working on a modified version of the TeensyMIDI example where I want to store part of the instruments in the EEPROM or SRAM, so I can modify and store them permanently on my Arduino Uno. Unfortunately setInstrument does not support reading from SRAM when the board type is set to OPL2_BOARD_TYPE_ARDUINO.

Here's my workaround for this problem:
virtuaCode/ArduinoOPL2@6664009

@DhrBaksteen
Copy link
Owner

Hi @virtuaCode this was done intentionally because fitting a full instrument library into SRAM would eat a lot of memory (especially for an Uno or Nano with just 2k). I didn't want to limit people's creativity when working with the example code by taking most of their memory :). However having said that I have a local change already where instruments can also be set directly from RAM along the lines of what you have, because it's still handy to have.

DhrBaksteen added a commit that referenced this issue Oct 17, 2019
This update adds structures and functions for simpler user defined instruments.
createInstrument - Creates a new empty instruement
getInstrument    - Creates a new instrument from the given OPL2 channel
loadInstrument   - Loads a predefined instrument
setInstrument    - Set an instrument to an OPL2 channel with optional
volume

Currently only melodic instruments are supported using this approach.
The current setInstrument function will be deprecated and will give a
warning when used.

Also note frequency umbers have been corrected as then were a semitone
too high.

Related to #47
DhrBaksteen added a commit that referenced this issue Oct 21, 2019
This fixes a bug in the new setInstrument function. Main issue was
setWaveFormSelect(true) was missing. Also small issues in MIDI example
fixed.

In referenct to #44, #47, #48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants