62#include "cnfs_image.h"
72#define MIDI_CHANNEL_COUNT 16
74#define POOL_VOICE_COUNT 24
76#define PERCUSSION_VOICES 8
78#define OSC_PER_VOICE 1
80#define NUM_GLOBAL_PLAYERS 2
89#define MIDI_FALSE 0x00
90#define MIDI_TO_BOOL(val) (val > 63)
91#define BOOL_TO_MIDI(val) (val ? MIDI_TRUE : MIDI_FALSE)
92#define MIDI_DEF_HEADROOM 0x2666
93#define PITCH_BEND_CENTER 0x2000
96#define SAMPLES_TO_MIDI_TICKS(n, tempo, div) ((int64_t)(n) * 1000000 * (div) / DAC_SAMPLE_RATE_HZ / (tempo))
99#define TICKS_TO_SAMPLES(ticks, tempo, div) ((int64_t)(ticks) * DAC_SAMPLE_RATE_HZ / (1000000) * (tempo) / (div))
102#define SAMPLES_TO_MS(samp) (((samp) * 1000) / DAC_SAMPLE_RATE_HZ)
105#define SAMPLES_TO_US(samp) (((samp) * 1000000) / DAC_SAMPLE_RATE_HZ)
108#define MS_TO_SAMPLES(ms) ((ms) * DAC_SAMPLE_RATE_HZ / 1000)
111#define MIDI_TICKS_TO_US(ticks, tempo, div) (int64_t)((int64_t)((int64_t)(ticks) * (int64_t)(tempo)) / ((int64_t)(div)))
uint32_t uq8_24
unsigned 8 bits integer, 24 bits fraction
Definition fp_math.h:43
int32_t q24_8
24 bits integer, 8 bits fraction
Definition fp_math.h:36
metaEventType_t
The possible types of meta-events.
Definition midiFileParser.h:34
Contains information for an entire MIDI event or non-MIDI meta-event.
Definition midiFileParser.h:236
Definition midiFileParser.h:110
Contains information which applies to the entire MIDI file.
Definition midiFileParser.h:87
int32_t releaseTime
Base time it takes to silence the note after release, in DAC samples.
Definition midiPlayer.h:383
void midiNoteOn(midiPlayer_t *player, uint8_t channel, uint8_t note, uint8_t velocity)
Begin playing a note on a given MIDI channel.
Definition midiPlayer.c:1556
uint16_t midiGetControlValue14bit(midiPlayer_t *player, uint8_t channel, midiControl_t control)
Get the combined value of two MIDI control registers.
Definition midiPlayer.c:2194
midiEvent_t pendingEvent
The next event in the MIDI file, which occurs after the current time.
Definition midiPlayer.h:703
bool paused
True when playback of the current file is paused.
Definition midiPlayer.h:712
uint32_t sampleError
The number of fractional samples remaining.
q24_8 sustainVolVel
This value will be multiplied by the note velocity and added to the attack time.
Definition midiPlayer.h:392
void midiSustain(midiPlayer_t *player, uint8_t channel, uint8_t val)
Set the hold pedal status.
Definition midiPlayer.c:1884
void globalMidiRestore(void *data)
Resume MIDI playback from the state stored in the given pointer. The data will be freed after this ca...
Definition midiFileParser.c:1071
void midiResetChannelControllers(midiPlayer_t *player, uint8_t channel)
Reset all controllers on a MIDI channel.
Definition midiPlayer.c:1455
bool registeredParameter
Whether selectedParameter represents a registered or non-registered parameter.
Definition midiPlayer.h:611
timbreType_t
The sample source for an instrument.
Definition midiPlayer.h:137
@ SAMPLE
Definition midiPlayer.h:140
@ WAVETABLE
Samples are generated by sampling a particular wave shape.
Definition midiPlayer.h:139
@ WAVE_SHAPE
Definition midiPlayer.h:142
@ NOISE
Definition midiPlayer.h:141
q24_8 releaseTimeVel
This value will be multiplied by the note velocity and added to the attack time.
Definition midiPlayer.h:386
envelope_t envelope
The ASDR characteristics of this timbre.
Definition midiPlayer.h:503
void midiGmOn(midiPlayer_t *player)
Activate General MIDI mode on a MIDI player.
Definition midiPlayer.c:1470
uint32_t tempo
The number of microseconds per quarter note.
Definition midiPlayer.h:709
void midiPlayerResetNewSong(midiPlayer_t *player)
Reset the MIDI player state by only doing the bare minimum. This is useful when playing multiple soun...
Definition midiPlayer.c:1246
void globalMidiPlayerPlaySong(midiFile_t *song, uint8_t trackType)
Play a song on one of the system-wide MIDI players, either BGM or SFX.
Definition midiPlayer.c:2499
uint32_t transitionTicksTotal
The number of samples remaining before the next volume adjustment.
Definition midiPlayer.h:523
uint32_t sustenuto
Bitfield of voices which are being held by the sustenuto pedal.
Definition midiPlayer.h:593
uint32_t held
Bitfield of voices which are being held by the pedal.
Definition midiPlayer.h:590
midiManufacturerId_t
Values that can be directly compared against midiSysexEvent_t::manufacturerId.
Definition midiPlayer.h:354
@ MMFR_EDUCATIONAL_USE
Definition midiPlayer.h:355
@ MMFR_UNIVERSAL_NON_REAL_TIME
Definition midiPlayer.h:356
@ MMFR_UNIVERSAL_REAL_TIME
Definition midiPlayer.h:357
int32_t midiPlayerStep(midiPlayer_t *player)
Calculate and return the next MIDI sample, stepping the player state forward by one sample.
Definition midiPlayer.c:1257
synthOscillator_t * allOscillators[(POOL_VOICE_COUNT+PERCUSSION_VOICES) *OSC_PER_VOICE]
An array holding a pointer to every oscillator.
Definition midiPlayer.h:669
void midiAfterTouch(midiPlayer_t *player, uint8_t channel, uint8_t note, uint8_t velocity)
Change the velocity of a note on a given MIDI channel, after the note starts playing.
Definition midiPlayer.c:1750
voiceStates_t poolVoiceStates
The global voice pool state bitmaps.
Definition midiPlayer.h:666
uint8_t transitionStartVol
The volume at the start of the transition time.
Definition midiPlayer.h:526
void midiPlayerFillBuffer(midiPlayer_t *player, uint8_t *samples, int16_t len)
Fill a buffer with the next set of samples from the MIDI player. This should be called by the callbac...
Definition midiPlayer.c:1331
midiTimbre_t timbre
The actual current timbre definition which the program ID corresponds to.
Definition midiPlayer.h:617
waveFunc_t waveFunc
The function to use to retrieve wavetable samples.
int32_t attackTime
Base time taken to ramp up to full volume.
Definition midiPlayer.h:371
midiVoice_t percVoices[PERCUSSION_VOICES]
The voices reserved for percussion.
Definition midiPlayer.h:650
voiceStates_t percVoiceStates
The percussion voice state bitmaps.
Definition midiPlayer.h:653
const midiTimbre_t * timbre
A pointer to the timbre of this voice, which defines its musical characteristics.
Definition midiPlayer.h:564
q24_8 attackTimeVel
This value will be multiplied by the note velocity and added to the attack time,.
Definition midiPlayer.h:374
timbreType_t type
The source of samples for this instrument.
Definition midiPlayer.h:439
uint16_t oscillatorCount
The total number of oscillators in the allOscillators array.
Definition midiPlayer.h:672
void midiSetParameter(midiPlayer_t *player, uint8_t channel, bool registered, uint16_t param, uint16_t value)
Set a registered or non-registered parameter value.
Definition midiPlayer.c:2212
void midiSeek(midiPlayer_t *player, uint32_t ticks)
Seek to a given time offset within a file.
Definition midiPlayer.c:2365
void deinitGlobalMidiPlayer(void)
Deinitialize and free memory associated with the system-wide MIDI players.
Definition midiPlayer.c:2471
void globalMidiPlayerStop(bool reset)
Stop all songs currently being played by the system-wide MIDI players, optionally resetting their sta...
Definition midiPlayer.c:2565
bool held
Whether notes will be held after release.
Definition midiPlayer.h:629
uint32_t percSpecialStates
A bitmap to track which percussion voices have special notes playing This includes all 3 hi-hats (ope...
Definition midiPlayer.h:660
void midiSustenuto(midiPlayer_t *player, uint8_t channel, uint8_t val)
Set the sustenuto pedal status.
Definition midiPlayer.c:1931
void midiSetProgram(midiPlayer_t *player, uint8_t channel, uint8_t program)
Change the program (instrument) on a given MIDI channel.
Definition midiPlayer.c:1867
cnfsFileIdx_t fIdx
The name of the sample to load into data.
bool loop
If true, the playing file will automatically repeat when complete.
Definition midiPlayer.h:718
bool sustenuto
Whether certain notes will be held after release.
Definition midiPlayer.h:632
midiFileReader_t reader
A MIDI reader to use for file playback, when in MIDI_FILE mode.
Definition midiPlayer.h:678
uint8_t velocity
The MIDI note velocity of the playing note.
Definition midiPlayer.h:538
void midiPlayerInit(midiPlayer_t *player)
Initialize the MIDI player.
Definition midiPlayer.c:1196
uint8_t channel
The index of the MIDI channel that owns the currently playing note.
Definition midiPlayer.h:541
uint8_t sustainVol
The base volume of the sustained note, proportional to the sample volume.
Definition midiPlayer.h:389
uint32_t sampleLoops
The number of loops remaining.
synthOscillator_t oscillators[OSC_PER_VOICE]
The synthesizer oscillators used to generate the sounds.
Definition midiPlayer.h:544
void globalMidiPlayerResumeAll(void)
Resume all songs currently being played by the system-wide MIDI players.
Definition midiPlayer.c:2554
#define PERCUSSION_VOICES
Definition midiPlayer.h:76
int32_t headroom
The constant value to multiply each frame's samples by, before being shifted right 16 bits This value...
Definition midiPlayer.h:693
void globalMidiPlayerFillBuffer(uint8_t *samples, int16_t len)
Fill the given sample buffer with samples from both the BGM and SFX system-wide MIDI players.
Definition midiPlayer.c:2487
void midiPitchWheel(midiPlayer_t *player, uint8_t channel, uint16_t value)
Set the pitch wheel value on a given MIDI channel.
Definition midiPlayer.c:2300
uint32_t attack
Bitfield of voices currently in the attack stage.
Definition midiPlayer.h:578
void midiGmOff(midiPlayer_t *player)
Deactivate General MIDI mode on a MIDI player.
Definition midiPlayer.c:1486
uint8_t note
The MIDI note number for the sound being played.
Definition midiPlayer.h:535
void midiNoteOff(midiPlayer_t *player, uint8_t channel, uint8_t note, uint8_t velocity)
Stop playing a particular note on a given MIDI channel.
Definition midiPlayer.c:1800
#define POOL_VOICE_COUNT
Definition midiPlayer.h:74
midiPlayerMode_t
Represents the source of MIDI data.
Definition midiPlayer.h:125
@ MIDI_STREAMING
Streaming over USB.
Definition midiPlayer.h:127
@ MIDI_FILE
Reading from a midiFileReader_t.
Definition midiPlayer.h:130
midiVoice_t poolVoices[POOL_VOICE_COUNT]
The global voice pool for non-percussion channels.
Definition midiPlayer.h:663
uint32_t decay
Bitfield of voices currently in the decay stage.
Definition midiPlayer.h:584
bool percussion
Whether this channel is reserved for percussion.
Definition midiPlayer.h:626
void globalMidiPlayerPauseAll(void)
Pause all songs currently being played by the system-wide MIDI players.
Definition midiPlayer.c:2543
int32_t decayTime
Base time taken for the volume to fade to the sustain volume.
Definition midiPlayer.h:377
uint32_t clipped
Number of samples that were clipped Note: This is not set when using midiPlayerFillBufferMulti()
Definition midiPlayer.h:697
const uint8_t * data
A pointer to this timbre's sample data.
void midiAllSoundOff(midiPlayer_t *player)
Stop all sound immediately. This is not affected by the sustain pedal.
Definition midiPlayer.c:1400
const char * name
The name of this timbre, if any.
Definition midiPlayer.h:509
percussionFunc_t playFunc
A callback to call for drum data.
void(* midiTextCallback_t)(metaEventType_t type, const char *text, uint32_t length)
A function to handle text meta-messages from playing MIDI files.
Definition midiPlayer.h:425
#define MIDI_CHANNEL_COUNT
Definition midiPlayer.h:72
bool eventAvailable
True if pendingEvent is valid, false if it must be updated.
Definition midiPlayer.h:706
midiTextCallback_t textMessageCallback
A callback to call when a text meta-message is received.
Definition midiPlayer.h:684
uint64_t sampleCount
The number of samples elapsed in the playing song.
Definition midiPlayer.h:700
q24_8 decayTimeVel
This value will be multiplied by the note velocity and added to the decay time.
Definition midiPlayer.h:380
uint32_t allocedVoices
A bitmap of which voices have been allocated to this channel.
Definition midiPlayer.h:620
uint16_t selectedParameter
The ID of the currently selected registered or non-registered parameter.
Definition midiPlayer.h:614
void midiAllNotesOff(midiPlayer_t *player, uint8_t channel)
Tun off all notes which are currently on, as though midiNoteOff() were called for each note....
Definition midiPlayer.c:1538
uint32_t release
Bitfield of voices currently in the release stage.
Definition midiPlayer.h:587
bool seeking
True when the MIDI player is seeking, and will not produce sound.
Definition midiPlayer.h:715
uint8_t midiGetControlValue(midiPlayer_t *player, uint8_t channel, midiControl_t control)
Get the value of a MIDI control.
Definition midiPlayer.c:2156
midiChannel_t channels[MIDI_CHANNEL_COUNT]
The state of all MIDI channels.
Definition midiPlayer.h:647
void globalMidiPlayerPlaySongCb(midiFile_t *song, uint8_t trackType, songFinishedCbFn cb)
Play a song on noe of the system-wide MIDI players, with a callback once the song finishes.
Definition midiPlayer.c:2513
uint16_t bank
The bank to use for program changes on this channel.
Definition midiPlayer.h:605
uint16_t waveIndex
The index of this timbre's wave in the table, when type is WAVETABLE.
uint32_t transitionTicks
The number of samples remaining before transitioning to the next state.
Definition midiPlayer.h:520
#define OSC_PER_VOICE
Definition midiPlayer.h:78
uint8_t program
The ID of the program (timbre) set for this channel.
Definition midiPlayer.h:608
uint32_t on
Whether this note is set to on via MIDI, regardless of if it's making sound.
Definition midiPlayer.h:575
void midiControlChange(midiPlayer_t *player, uint8_t channel, midiControl_t control, uint8_t val)
Set a MIDI control value.
Definition midiPlayer.c:1974
midiPlayerMode_t mode
Whether this player is playing a song or a MIDI stream.
Definition midiPlayer.h:675
uint16_t volume
The 14-bit volume level for this channel only.
Definition midiPlayer.h:602
void midiSetFile(midiPlayer_t *player, const midiFile_t *file)
Configure this MIDI player to read from a MIDI file.
Definition midiPlayer.c:2341
songFinishedCbFn songFinishedCallback
A callback to call when the playing song is finished.
Definition midiPlayer.h:687
void initGlobalMidiPlayer(void)
Initialize the system-wide MIDI players for both BGM and SFX.
Definition midiPlayer.c:2459
timbreFlags_t flags
Flags bitfield for this timbre.
Definition midiPlayer.h:442
uint32_t percScratch[4]
An array of scratch data for percussion functions to use.
void midiPause(midiPlayer_t *player, bool pause)
Set the paused state of a MIDI song.
Definition midiPlayer.c:2360
midiControl_t
Defines the MIDI continuous controller registers.
Definition midiPlayer.h:251
@ MCC_GP_BUTTON_1
Definition midiPlayer.h:312
@ MCC_PAN_LSB
Definition midiPlayer.h:282
@ MCC_OMNI_MODE_ON
Definition midiPlayer.h:343
@ MCC_EFFECT_1_MSB
Definition midiPlayer.h:264
@ MCC_DETUNE_LEVEL
Definition midiPlayer.h:323
@ MCC_BREATH_LSB
Definition midiPlayer.h:274
@ MCC_BANK_LSB
Definition midiPlayer.h:272
@ MCC_MODULATION_WHEEL_MSB
Definition midiPlayer.h:253
@ MCC_PORTAMENTO
Definition midiPlayer.h:290
@ MCC_SOUND_CONTROL_10
Definition midiPlayer.h:310
@ MCC_GP_SLIDER_4
Definition midiPlayer.h:270
@ MCC_FOOT_PEDAL_MSB
Definition midiPlayer.h:256
@ MCC_BALANCE_MSB
Definition midiPlayer.h:260
@ MCC_LOCAL_KEYBOARD
Definition midiPlayer.h:337
@ MCC_FOOT_PEDAL_LSB
Definition midiPlayer.h:276
@ MCC_PAN_MSB
Definition midiPlayer.h:262
@ MCC_SOUND_CONTROL_7
Definition midiPlayer.h:307
@ MCC_REGISTERED_PARAM_MSB
Definition midiPlayer.h:330
@ MCC_VOLUME_LSB
Definition midiPlayer.h:279
@ MCC_OMNI_MODE_OFF
Definition midiPlayer.h:341
@ MCC_HOLD_PEDAL
Definition midiPlayer.h:288
@ MCC_GP_BUTTON_2
Definition midiPlayer.h:314
@ MCC_NON_REGISTERED_PARAM_MSB
Definition midiPlayer.h:328
@ MCC_GP_SLIDER_2
Definition midiPlayer.h:268
@ MCC_ALL_SOUND_OFF
Definition midiPlayer.h:333
@ MCC_HOLD_2_PEDAL
Definition midiPlayer.h:298
@ MCC_PORTAMENTO_TIME_MSB
Definition midiPlayer.h:257
@ MCC_DATA_BUTTON_DEC
Definition midiPlayer.h:326
@ MCC_LEGATO_PEDAL
Definition midiPlayer.h:296
@ MCC_PORTAMENTO_TIME_LSB
Definition midiPlayer.h:277
@ MCC_SOUND_CONTROL_8
Definition midiPlayer.h:308
@ MCC_EFFECT_2_LSB
Definition midiPlayer.h:285
@ MCC_DATA_ENTRY_LSB
Definition midiPlayer.h:278
@ MCC_VOLUME_MSB
Definition midiPlayer.h:259
@ MCC_DATA_BUTTON_INC
Definition midiPlayer.h:325
@ MCC_BREATH_MSB
Definition midiPlayer.h:254
@ MCC_EFFECT_2_MSB
Definition midiPlayer.h:265
@ MCC_SOFT_PEDAL
Definition midiPlayer.h:294
@ MCC_SOUND_VARIATION
Definition midiPlayer.h:299
@ MCC_PHASER_LEVEL
Definition midiPlayer.h:324
@ MCC_CHORUS_LEVEL
Definition midiPlayer.h:322
@ MCC_EFFECT_1_LSB
Definition midiPlayer.h:284
@ MCC_DATA_ENTRY_MSB
Definition midiPlayer.h:258
@ MCC_ALL_CONTROLS_OFF
Definition midiPlayer.h:335
@ MCC_BANK_MSB
Definition midiPlayer.h:252
@ MCC_BALANCE_LSB
Definition midiPlayer.h:280
@ MCC_EXPRESSION_LSB
Definition midiPlayer.h:283
@ MCC_GP_BUTTON_4
Definition midiPlayer.h:318
@ MCC_SOUND_BRIGHTNESS
Definition midiPlayer.h:303
@ MCC_SOUND_TIMBRE
Definition midiPlayer.h:300
@ MCC_SOUND_CONTROL_9
Definition midiPlayer.h:309
@ MCC_MODULATION_WHEEL_LSB
Definition midiPlayer.h:273
@ MCC_GP_SLIDER_3
Definition midiPlayer.h:269
@ MCC_SOUND_ATTACK_TIME
Definition midiPlayer.h:302
@ MCC_SOUND_RELEASE_TIME
Definition midiPlayer.h:301
@ MCC_REGISTERED_PARAM_LSB
Definition midiPlayer.h:329
@ MCC_NON_REGISTERED_PARAM_LSB
Definition midiPlayer.h:327
@ MCC_MONO_OPERATION
Definition midiPlayer.h:345
@ MCC_ALL_NOTE_OFF
Definition midiPlayer.h:339
@ MCC_TREMOLO_LEVEL
Definition midiPlayer.h:321
@ MCC_EFFECTS_LEVEL
Definition midiPlayer.h:320
@ MCC_SOUND_CONTROL_6
Definition midiPlayer.h:305
@ MCC_SUSTENUTO_PEDAL
Definition midiPlayer.h:292
@ MCC_POLY_OPERATION
Definition midiPlayer.h:347
@ MCC_EXPRESSION_MSB
Definition midiPlayer.h:263
@ MCC_GP_SLIDER_1
Definition midiPlayer.h:267
@ MCC_GP_BUTTON_3
Definition midiPlayer.h:316
uint32_t sampleTick
The monotonic tick counter for playback of sampled timbres.
Definition midiPlayer.h:532
uint16_t midiGetParameterValue(midiPlayer_t *player, uint8_t channel, bool registered, uint16_t param)
Get the value of a registered or non-registered parameter.
Definition midiPlayer.c:2273
void(* songFinishedCbFn)(void)
Callback function used to provide feedback when a song finishes playing.
Definition midiPlayer.h:114
bool ignore
If set, events on this channel will be completely ignored.
Definition midiPlayer.h:635
uint32_t sustain
Bitfield of voices currently in the sustain stage.
Definition midiPlayer.h:581
percussionNote_t
Defines the MIDI note numbers mapped to by the General MIDI percussion note names.
Definition midiPlayer.h:162
@ OPEN_TRIANGLE
This note supersedes any MUTE_TRIANGLE or OPEN_TRIANGLE notes playing.
Definition midiPlayer.h:230
@ COWBELL
Definition midiPlayer.h:197
@ ACOUSTIC_SNARE
Definition midiPlayer.h:176
@ CLOSED_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:181
@ LOW_BONGO
Definition midiPlayer.h:202
@ HIGH_BONGO
Definition midiPlayer.h:201
@ CHINESE_CYMBAL
Definition midiPlayer.h:193
@ RIDE_CYMBAL_2
Definition midiPlayer.h:200
@ LONG_GUIRO
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:219
@ RIDE_BELL
Definition midiPlayer.h:194
@ SHORT_GUIRO
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:217
@ HIGH_TOM
Definition midiPlayer.h:191
@ MUTE_CUICA
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:224
@ CABASA
Definition midiPlayer.h:210
@ CRASH_CYMBAL_2
Definition midiPlayer.h:198
@ CRASH_CYMBAL_1
Definition midiPlayer.h:190
@ LOW_MID_TOM
Definition midiPlayer.h:188
@ LOW_AGOGO
Definition midiPlayer.h:209
@ HIGH_TIMBALE
Definition midiPlayer.h:206
@ SIDE_STICK
Definition midiPlayer.h:175
@ RIDE_CYMBAL_1
Definition midiPlayer.h:192
@ ELECTRIC_SNARE_OR_RIMSHOT
Definition midiPlayer.h:178
@ CLAVES
Definition midiPlayer.h:220
@ OPEN_HIGH_CONGA
Definition midiPlayer.h:204
@ LONG_WHISTLE
This note supersedes any SHORT_WHISTLE or LONG_WHISTLE notes playing.
Definition midiPlayer.h:215
@ LOW_TOM
Definition midiPlayer.h:185
@ HIGH_AGOGO
Definition midiPlayer.h:208
@ TAMBOURINE
Definition midiPlayer.h:195
@ HIGH_MID_TOM
Definition midiPlayer.h:189
@ MUTE_HIGH_CONGA
Definition midiPlayer.h:203
@ SPLASH_CYMBAL
Definition midiPlayer.h:196
@ HIGH_WOODBLOCK
Definition midiPlayer.h:221
@ LOW_FLOOR_TOM
Definition midiPlayer.h:179
@ VIBRASLAP
Definition midiPlayer.h:199
@ SHORT_WHISTLE
This note supersedes any SHORT_WHISTLE or LONG_WHISTLE notes playing.
Definition midiPlayer.h:213
@ PEDAL_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:184
@ LOW_CONGA
Definition midiPlayer.h:205
@ LOW_TIMBALE
Definition midiPlayer.h:207
@ OPEN_CUICA
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:226
@ ELECTRIC_BASS_DRUM_OR_HIGH_BASS_DRUM
Definition midiPlayer.h:174
@ LOW_WOODBLOCK
Definition midiPlayer.h:222
@ HIGH_FLOOR_TOM
Definition midiPlayer.h:182
@ MARACAS
Definition midiPlayer.h:211
@ HAND_CLAP
Definition midiPlayer.h:177
@ MUTE_TRIANGLE
This note supersedes any MUTE_TRIANGLE or OPEN_TRIANGLE notes playing.
Definition midiPlayer.h:228
@ OPEN_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:187
@ ACOUSTIC_BASS_DRUM_OR_LOW_BASS_DRUM
Definition midiPlayer.h:173
uint8_t chorus
The number of chorused voices to mix.
Definition midiPlayer.h:404
void globalMidiPlayerSetVolume(uint8_t trackType, int32_t volumeSetting)
Set the volume using a value from 0 to 13.
Definition midiPlayer.c:2522
void midiPlayerFillBufferMulti(midiPlayer_t *players, uint8_t playerCount, uint8_t *samples, int16_t len)
Fill a buffer with the next set of samples from an array of MIDI players.
Definition midiPlayer.c:1365
uint32_t count
The length of the sample in bytes.
midiPlayer_t * globalMidiPlayerGet(uint8_t trackType)
Return a pointer to the system-wide MIDI player for the given track type, either MIDI_SFX or MIDI_BGM...
Definition midiPlayer.c:2583
uint16_t pitchBend
The 14-bit pitch wheel value.
Definition midiPlayer.h:623
bool(* midiStreamingCallback_t)(midiEvent_t *event)
A function to return MIDI events in streaming mode.
Definition midiPlayer.h:431
void midiSetTempo(midiPlayer_t *player, uint32_t tempo)
Change the MIDI playback tempo.
Definition midiPlayer.c:2333
void * globalMidiSave(void)
Stop all MIDI playback and return a pointer containing the full playback state. This state must be pa...
Definition midiFileParser.c:1036
uint8_t targetVol
The target volume of this tick.
Definition midiPlayer.h:529
int8_t(* percussionFunc_t)(percussionNote_t drum, uint32_t idx, bool *done, uint32_t scratch[4], void *data)
A function that returns samples for a percussion timbre rather than a melodic one.
Definition midiPlayer.h:416
void midiPlayerReset(midiPlayer_t *player)
Reset the MIDI player state.
Definition midiPlayer.c:1224
midiStreamingCallback_t streamingCallback
A callback function to retrieve the next event, when in MIDI_STREAMING mode.
Definition midiPlayer.h:681
timbreFlags_t
A bitfield which may contain various flags for a timbre.
Definition midiPlayer.h:149
@ TF_PERCUSSION
This timbre plays percussion sounds (percussionNote_t) rather than melodic notes.
Definition midiPlayer.h:153
@ TF_MONO
This timbre represents a monophonic instrument.
Definition midiPlayer.h:155
@ TF_NONE
No flags.
Definition midiPlayer.h:151
timbreEffects_t effects
Various effects applied to this timbre. May be ignored by percussion timbres.
Definition midiPlayer.h:506
Describes the characteristics of a particular timbre while.
Definition midiPlayer.h:369
Tracks the state of a single MIDI channel.
Definition midiPlayer.h:600
Tracks the state of the entire MIDI apparatus.
Definition midiPlayer.h:642
Defines the sound characteristics of a particular instrument.
Definition midiPlayer.h:437
Tracks the state of a single voice, playing a single note.
Definition midiPlayer.h:518
Definition midiPlayer.h:402
Holds several bitfields that track the state of each voice for fast access. This may be used for dyna...
Definition midiPlayer.h:573
oscillatorShape_t
The different wave shapes that can be generated.
Definition swSynth.h:65
int8_t(* waveFunc_t)(uint16_t idx, void *data)
Function typedef to return a sample from a wave.
Definition swSynth.h:97
A software oscillator with controllable frequency, amplitude, and shape.
Definition swSynth.h:107