71#define MIDI_CHANNEL_COUNT 16
73#define POOL_VOICE_COUNT 24
75#define PERCUSSION_VOICES 8
77#define OSC_PER_VOICE 1
79#define NUM_GLOBAL_PLAYERS 2
88#define MIDI_FALSE 0x00
89#define MIDI_TO_BOOL(val) (val > 63)
90#define BOOL_TO_MIDI(val) (val ? MIDI_TRUE : MIDI_FALSE)
91#define MIDI_DEF_HEADROOM 0x2666
92#define PITCH_BEND_CENTER 0x2000
95#define SAMPLES_TO_MIDI_TICKS(n, tempo, div) ((n) * 1000000 * (div) / DAC_SAMPLE_RATE_HZ / (tempo))
98#define SAMPLES_TO_MS(samp) (((samp) * 1000) / DAC_SAMPLE_RATE_HZ)
101#define SAMPLES_TO_US(samp) (((samp) * 1000000) / DAC_SAMPLE_RATE_HZ)
104#define MS_TO_SAMPLES(ms) ((ms) * DAC_SAMPLE_RATE_HZ / 1000)
107#define MIDI_TICKS_TO_US(ticks, tempo, div) (int64_t)((int64_t)((int64_t)(ticks) * (int64_t)(tempo)) / ((int64_t)(div)))
472 const char* sampleName;
547 uint32_t percScratch[4];
552 uint32_t sampleError;
555 uint32_t sampleLoops;
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:31
Contains information for an entire MIDI event or non-MIDI meta-event.
Definition midiFileParser.h:233
Definition midiFileParser.h:107
Contains information which applies to the entire MIDI file.
Definition midiFileParser.h:84
int32_t releaseTime
Base time it takes to silence the note after release, in DAC samples.
Definition midiPlayer.h:379
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:1562
uint16_t midiGetControlValue14bit(midiPlayer_t *player, uint8_t channel, midiControl_t control)
Get the combined value of two MIDI control registers.
Definition midiPlayer.c:2195
midiEvent_t pendingEvent
The next event in the MIDI file, which occurs after the current time.
Definition midiPlayer.h:699
bool paused
True when playback of the current file is paused.
Definition midiPlayer.h:708
q24_8 sustainVolVel
This value will be multiplied by the note velocity and added to the attack time.
Definition midiPlayer.h:388
void midiSustain(midiPlayer_t *player, uint8_t channel, uint8_t val)
Set the hold pedal status.
Definition midiPlayer.c:1885
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:1053
void midiResetChannelControllers(midiPlayer_t *player, uint8_t channel)
Reset all controllers on a MIDI channel.
Definition midiPlayer.c:1461
bool registeredParameter
Whether selectedParameter represents a registered or non-registered parameter.
Definition midiPlayer.h:607
timbreType_t
The sample source for an instrument.
Definition midiPlayer.h:133
@ SAMPLE
Definition midiPlayer.h:136
@ WAVETABLE
Samples are generated by sampling a particular wave shape.
Definition midiPlayer.h:135
@ WAVE_SHAPE
Definition midiPlayer.h:138
@ NOISE
Definition midiPlayer.h:137
q24_8 releaseTimeVel
This value will be multiplied by the note velocity and added to the attack time.
Definition midiPlayer.h:382
envelope_t envelope
The ASDR characteristics of this timbre.
Definition midiPlayer.h:499
void midiGmOn(midiPlayer_t *player)
Activate General MIDI mode on a MIDI player.
Definition midiPlayer.c:1476
uint32_t tempo
The number of microseconds per quarter note.
Definition midiPlayer.h:705
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:1252
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:2500
uint32_t transitionTicksTotal
The number of samples remaining before the next volume adjustment.
Definition midiPlayer.h:519
uint32_t sustenuto
Bitfield of voices which are being held by the sustenuto pedal.
Definition midiPlayer.h:589
uint32_t held
Bitfield of voices which are being held by the pedal.
Definition midiPlayer.h:586
midiManufacturerId_t
Values that can be directly compared against midiSysexEvent_t::manufacturerId.
Definition midiPlayer.h:350
@ MMFR_EDUCATIONAL_USE
Definition midiPlayer.h:351
@ MMFR_UNIVERSAL_NON_REAL_TIME
Definition midiPlayer.h:352
@ MMFR_UNIVERSAL_REAL_TIME
Definition midiPlayer.h:353
int32_t midiPlayerStep(midiPlayer_t *player)
Calculate and return the next MIDI sample, stepping the player state forward by one sample.
Definition midiPlayer.c:1263
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:1756
voiceStates_t poolVoiceStates
The global voice pool state bitmaps.
Definition midiPlayer.h:662
uint8_t transitionStartVol
The volume at the start of the transition time.
Definition midiPlayer.h:522
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:1337
midiTimbre_t timbre
The actual current timbre definition which the program ID corresponds to.
Definition midiPlayer.h:613
int32_t attackTime
Base time taken to ramp up to full volume.
Definition midiPlayer.h:367
voiceStates_t percVoiceStates
The percussion voice state bitmaps.
Definition midiPlayer.h:649
const midiTimbre_t * timbre
A pointer to the timbre of this voice, which defines its musical characteristics.
Definition midiPlayer.h:560
q24_8 attackTimeVel
This value will be multiplied by the note velocity and added to the attack time,.
Definition midiPlayer.h:370
timbreType_t type
The source of samples for this instrument.
Definition midiPlayer.h:435
uint16_t oscillatorCount
The total number of oscillators in the allOscillators array.
Definition midiPlayer.h:668
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:2213
void midiSeek(midiPlayer_t *player, uint32_t ticks)
Seek to a given time offset within a file.
Definition midiPlayer.c:2366
void deinitGlobalMidiPlayer(void)
Deinitialize and free memory associated with the system-wide MIDI players.
Definition midiPlayer.c:2472
void globalMidiPlayerStop(bool reset)
Stop all songs currently being played by the system-wide MIDI players, optionally resetting their sta...
Definition midiPlayer.c:2566
bool held
Whether notes will be held after release.
Definition midiPlayer.h:625
uint32_t percSpecialStates
A bitmap to track which percussion voices have special notes playing This includes all 3 hi-hats (ope...
Definition midiPlayer.h:656
void midiSustenuto(midiPlayer_t *player, uint8_t channel, uint8_t val)
Set the sustenuto pedal status.
Definition midiPlayer.c:1932
void midiSetProgram(midiPlayer_t *player, uint8_t channel, uint8_t program)
Change the program (instrument) on a given MIDI channel.
Definition midiPlayer.c:1868
bool loop
If true, the playing file will automatically repeat when complete.
Definition midiPlayer.h:714
bool sustenuto
Whether certain notes will be held after release.
Definition midiPlayer.h:628
midiFileReader_t reader
A MIDI reader to use for file playback, when in MIDI_FILE mode.
Definition midiPlayer.h:674
uint8_t velocity
The MIDI note velocity of the playing note.
Definition midiPlayer.h:534
void midiPlayerInit(midiPlayer_t *player)
Initialize the MIDI player.
Definition midiPlayer.c:1202
uint8_t channel
The index of the MIDI channel that owns the currently playing note.
Definition midiPlayer.h:537
uint8_t sustainVol
The base volume of the sustained note, proportional to the sample volume.
Definition midiPlayer.h:385
void globalMidiPlayerResumeAll(void)
Resume all songs currently being played by the system-wide MIDI players.
Definition midiPlayer.c:2555
#define PERCUSSION_VOICES
Definition midiPlayer.h:75
int32_t headroom
The constant value to multiply each frame's samples by, before being shifted right 16 bits This value...
Definition midiPlayer.h:689
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:2488
void midiPitchWheel(midiPlayer_t *player, uint8_t channel, uint16_t value)
Set the pitch wheel value on a given MIDI channel.
Definition midiPlayer.c:2301
uint32_t attack
Bitfield of voices currently in the attack stage.
Definition midiPlayer.h:574
void midiGmOff(midiPlayer_t *player)
Deactivate General MIDI mode on a MIDI player.
Definition midiPlayer.c:1492
uint8_t note
The MIDI note number for the sound being played.
Definition midiPlayer.h:531
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:1806
#define POOL_VOICE_COUNT
Definition midiPlayer.h:73
midiPlayerMode_t
Represents the source of MIDI data.
Definition midiPlayer.h:121
@ MIDI_STREAMING
Streaming over USB.
Definition midiPlayer.h:123
@ MIDI_FILE
Reading from a midiFileReader_t.
Definition midiPlayer.h:126
uint32_t decay
Bitfield of voices currently in the decay stage.
Definition midiPlayer.h:580
bool percussion
Whether this channel is reserved for percussion.
Definition midiPlayer.h:622
void globalMidiPlayerPauseAll(void)
Pause all songs currently being played by the system-wide MIDI players.
Definition midiPlayer.c:2544
int32_t decayTime
Base time taken for the volume to fade to the sustain volume.
Definition midiPlayer.h:373
uint32_t clipped
Number of samples that were clipped Note: This is not set when using midiPlayerFillBufferMulti()
Definition midiPlayer.h:693
void midiAllSoundOff(midiPlayer_t *player)
Stop all sound immediately. This is not affected by the sustain pedal.
Definition midiPlayer.c:1406
const char * name
The name of this timbre, if any.
Definition midiPlayer.h:505
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:421
#define MIDI_CHANNEL_COUNT
Definition midiPlayer.h:71
bool eventAvailable
True if pendingEvent is valid, false if it must be updated.
Definition midiPlayer.h:702
midiTextCallback_t textMessageCallback
A callback to call when a text meta-message is received.
Definition midiPlayer.h:680
uint64_t sampleCount
The number of samples elapsed in the playing song.
Definition midiPlayer.h:696
q24_8 decayTimeVel
This value will be multiplied by the note velocity and added to the decay time.
Definition midiPlayer.h:376
uint32_t allocedVoices
A bitmap of which voices have been allocated to this channel.
Definition midiPlayer.h:616
uint16_t selectedParameter
The ID of the currently selected registered or non-registered parameter.
Definition midiPlayer.h:610
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:1544
uint32_t release
Bitfield of voices currently in the release stage.
Definition midiPlayer.h:583
bool seeking
True when the MIDI player is seeking, and will not produce sound.
Definition midiPlayer.h:711
uint8_t midiGetControlValue(midiPlayer_t *player, uint8_t channel, midiControl_t control)
Get the value of a MIDI control.
Definition midiPlayer.c:2157
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:2514
uint16_t bank
The bank to use for program changes on this channel.
Definition midiPlayer.h:601
uint32_t transitionTicks
The number of samples remaining before transitioning to the next state.
Definition midiPlayer.h:516
#define OSC_PER_VOICE
Definition midiPlayer.h:77
uint8_t program
The ID of the program (timbre) set for this channel.
Definition midiPlayer.h:604
uint32_t on
Whether this note is set to on via MIDI, regardless of if it's making sound.
Definition midiPlayer.h:571
void midiControlChange(midiPlayer_t *player, uint8_t channel, midiControl_t control, uint8_t val)
Set a MIDI control value.
Definition midiPlayer.c:1975
midiPlayerMode_t mode
Whether this player is playing a song or a MIDI stream.
Definition midiPlayer.h:671
uint16_t volume
The 14-bit volume level for this channel only.
Definition midiPlayer.h:598
void midiSetFile(midiPlayer_t *player, const midiFile_t *file)
Configure this MIDI player to read from a MIDI file.
Definition midiPlayer.c:2342
songFinishedCbFn songFinishedCallback
A callback to call when the playing song is finished.
Definition midiPlayer.h:683
void initGlobalMidiPlayer(void)
Initialize the system-wide MIDI players for both BGM and SFX.
Definition midiPlayer.c:2460
timbreFlags_t flags
Flags bitfield for this timbre.
Definition midiPlayer.h:438
void midiPause(midiPlayer_t *player, bool pause)
Set the paused state of a MIDI song.
Definition midiPlayer.c:2361
midiControl_t
Defines the MIDI continuous controller registers.
Definition midiPlayer.h:247
@ MCC_GP_BUTTON_1
Definition midiPlayer.h:308
@ MCC_PAN_LSB
Definition midiPlayer.h:278
@ MCC_OMNI_MODE_ON
Definition midiPlayer.h:339
@ MCC_EFFECT_1_MSB
Definition midiPlayer.h:260
@ MCC_DETUNE_LEVEL
Definition midiPlayer.h:319
@ MCC_BREATH_LSB
Definition midiPlayer.h:270
@ MCC_BANK_LSB
Definition midiPlayer.h:268
@ MCC_MODULATION_WHEEL_MSB
Definition midiPlayer.h:249
@ MCC_PORTAMENTO
Definition midiPlayer.h:286
@ MCC_SOUND_CONTROL_10
Definition midiPlayer.h:306
@ MCC_GP_SLIDER_4
Definition midiPlayer.h:266
@ MCC_FOOT_PEDAL_MSB
Definition midiPlayer.h:252
@ MCC_BALANCE_MSB
Definition midiPlayer.h:256
@ MCC_LOCAL_KEYBOARD
Definition midiPlayer.h:333
@ MCC_FOOT_PEDAL_LSB
Definition midiPlayer.h:272
@ MCC_PAN_MSB
Definition midiPlayer.h:258
@ MCC_SOUND_CONTROL_7
Definition midiPlayer.h:303
@ MCC_REGISTERED_PARAM_MSB
Definition midiPlayer.h:326
@ MCC_VOLUME_LSB
Definition midiPlayer.h:275
@ MCC_OMNI_MODE_OFF
Definition midiPlayer.h:337
@ MCC_HOLD_PEDAL
Definition midiPlayer.h:284
@ MCC_GP_BUTTON_2
Definition midiPlayer.h:310
@ MCC_NON_REGISTERED_PARAM_MSB
Definition midiPlayer.h:324
@ MCC_GP_SLIDER_2
Definition midiPlayer.h:264
@ MCC_ALL_SOUND_OFF
Definition midiPlayer.h:329
@ MCC_HOLD_2_PEDAL
Definition midiPlayer.h:294
@ MCC_PORTAMENTO_TIME_MSB
Definition midiPlayer.h:253
@ MCC_DATA_BUTTON_DEC
Definition midiPlayer.h:322
@ MCC_LEGATO_PEDAL
Definition midiPlayer.h:292
@ MCC_PORTAMENTO_TIME_LSB
Definition midiPlayer.h:273
@ MCC_SOUND_CONTROL_8
Definition midiPlayer.h:304
@ MCC_EFFECT_2_LSB
Definition midiPlayer.h:281
@ MCC_DATA_ENTRY_LSB
Definition midiPlayer.h:274
@ MCC_VOLUME_MSB
Definition midiPlayer.h:255
@ MCC_DATA_BUTTON_INC
Definition midiPlayer.h:321
@ MCC_BREATH_MSB
Definition midiPlayer.h:250
@ MCC_EFFECT_2_MSB
Definition midiPlayer.h:261
@ MCC_SOFT_PEDAL
Definition midiPlayer.h:290
@ MCC_SOUND_VARIATION
Definition midiPlayer.h:295
@ MCC_PHASER_LEVEL
Definition midiPlayer.h:320
@ MCC_CHORUS_LEVEL
Definition midiPlayer.h:318
@ MCC_EFFECT_1_LSB
Definition midiPlayer.h:280
@ MCC_DATA_ENTRY_MSB
Definition midiPlayer.h:254
@ MCC_ALL_CONTROLS_OFF
Definition midiPlayer.h:331
@ MCC_BANK_MSB
Definition midiPlayer.h:248
@ MCC_BALANCE_LSB
Definition midiPlayer.h:276
@ MCC_EXPRESSION_LSB
Definition midiPlayer.h:279
@ MCC_GP_BUTTON_4
Definition midiPlayer.h:314
@ MCC_SOUND_BRIGHTNESS
Definition midiPlayer.h:299
@ MCC_SOUND_TIMBRE
Definition midiPlayer.h:296
@ MCC_SOUND_CONTROL_9
Definition midiPlayer.h:305
@ MCC_MODULATION_WHEEL_LSB
Definition midiPlayer.h:269
@ MCC_GP_SLIDER_3
Definition midiPlayer.h:265
@ MCC_SOUND_ATTACK_TIME
Definition midiPlayer.h:298
@ MCC_SOUND_RELEASE_TIME
Definition midiPlayer.h:297
@ MCC_REGISTERED_PARAM_LSB
Definition midiPlayer.h:325
@ MCC_NON_REGISTERED_PARAM_LSB
Definition midiPlayer.h:323
@ MCC_MONO_OPERATION
Definition midiPlayer.h:341
@ MCC_ALL_NOTE_OFF
Definition midiPlayer.h:335
@ MCC_TREMOLO_LEVEL
Definition midiPlayer.h:317
@ MCC_EFFECTS_LEVEL
Definition midiPlayer.h:316
@ MCC_SOUND_CONTROL_6
Definition midiPlayer.h:301
@ MCC_SUSTENUTO_PEDAL
Definition midiPlayer.h:288
@ MCC_POLY_OPERATION
Definition midiPlayer.h:343
@ MCC_EXPRESSION_MSB
Definition midiPlayer.h:259
@ MCC_GP_SLIDER_1
Definition midiPlayer.h:263
@ MCC_GP_BUTTON_3
Definition midiPlayer.h:312
uint32_t sampleTick
The monotonic tick counter for playback of sampled timbres.
Definition midiPlayer.h:528
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:2274
void(* songFinishedCbFn)(void)
Callback function used to provide feedback when a song finishes playing.
Definition midiPlayer.h:110
bool ignore
If set, events on this channel will be completely ignored.
Definition midiPlayer.h:631
uint32_t sustain
Bitfield of voices currently in the sustain stage.
Definition midiPlayer.h:577
percussionNote_t
Defines the MIDI note numbers mapped to by the General MIDI percussion note names.
Definition midiPlayer.h:158
@ OPEN_TRIANGLE
This note supersedes any MUTE_TRIANGLE or OPEN_TRIANGLE notes playing.
Definition midiPlayer.h:226
@ COWBELL
Definition midiPlayer.h:193
@ ACOUSTIC_SNARE
Definition midiPlayer.h:172
@ CLOSED_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:177
@ LOW_BONGO
Definition midiPlayer.h:198
@ HIGH_BONGO
Definition midiPlayer.h:197
@ CHINESE_CYMBAL
Definition midiPlayer.h:189
@ RIDE_CYMBAL_2
Definition midiPlayer.h:196
@ LONG_GUIRO
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:215
@ RIDE_BELL
Definition midiPlayer.h:190
@ SHORT_GUIRO
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:213
@ HIGH_TOM
Definition midiPlayer.h:187
@ MUTE_CUICA
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:220
@ CABASA
Definition midiPlayer.h:206
@ CRASH_CYMBAL_2
Definition midiPlayer.h:194
@ CRASH_CYMBAL_1
Definition midiPlayer.h:186
@ LOW_MID_TOM
Definition midiPlayer.h:184
@ LOW_AGOGO
Definition midiPlayer.h:205
@ HIGH_TIMBALE
Definition midiPlayer.h:202
@ SIDE_STICK
Definition midiPlayer.h:171
@ RIDE_CYMBAL_1
Definition midiPlayer.h:188
@ ELECTRIC_SNARE_OR_RIMSHOT
Definition midiPlayer.h:174
@ CLAVES
Definition midiPlayer.h:216
@ OPEN_HIGH_CONGA
Definition midiPlayer.h:200
@ LONG_WHISTLE
This note supersedes any SHORT_WHISTLE or LONG_WHISTLE notes playing.
Definition midiPlayer.h:211
@ LOW_TOM
Definition midiPlayer.h:181
@ HIGH_AGOGO
Definition midiPlayer.h:204
@ TAMBOURINE
Definition midiPlayer.h:191
@ HIGH_MID_TOM
Definition midiPlayer.h:185
@ MUTE_HIGH_CONGA
Definition midiPlayer.h:199
@ SPLASH_CYMBAL
Definition midiPlayer.h:192
@ HIGH_WOODBLOCK
Definition midiPlayer.h:217
@ LOW_FLOOR_TOM
Definition midiPlayer.h:175
@ VIBRASLAP
Definition midiPlayer.h:195
@ SHORT_WHISTLE
This note supersedes any SHORT_WHISTLE or LONG_WHISTLE notes playing.
Definition midiPlayer.h:209
@ PEDAL_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:180
@ LOW_CONGA
Definition midiPlayer.h:201
@ LOW_TIMBALE
Definition midiPlayer.h:203
@ OPEN_CUICA
This note supersedes any SHORT_GUIRO or LONG_GUIRO notes playing.
Definition midiPlayer.h:222
@ ELECTRIC_BASS_DRUM_OR_HIGH_BASS_DRUM
Definition midiPlayer.h:170
@ LOW_WOODBLOCK
Definition midiPlayer.h:218
@ HIGH_FLOOR_TOM
Definition midiPlayer.h:178
@ MARACAS
Definition midiPlayer.h:207
@ HAND_CLAP
Definition midiPlayer.h:173
@ MUTE_TRIANGLE
This note supersedes any MUTE_TRIANGLE or OPEN_TRIANGLE notes playing.
Definition midiPlayer.h:224
@ OPEN_HI_HAT
This note supersedes any CLOSED_HI_HAT, PEDAL_HI_HAT, or OPEN_HI_HAT notes playing.
Definition midiPlayer.h:183
@ ACOUSTIC_BASS_DRUM_OR_LOW_BASS_DRUM
Definition midiPlayer.h:169
uint8_t chorus
The number of chorused voices to mix.
Definition midiPlayer.h:400
void globalMidiPlayerSetVolume(uint8_t trackType, int32_t volumeSetting)
Set the volume using a value from 0 to 13.
Definition midiPlayer.c:2523
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:1371
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:2584
uint16_t pitchBend
The 14-bit pitch wheel value.
Definition midiPlayer.h:619
bool(* midiStreamingCallback_t)(midiEvent_t *event)
A function to return MIDI events in streaming mode.
Definition midiPlayer.h:427
void midiSetTempo(midiPlayer_t *player, uint32_t tempo)
Change the MIDI playback tempo.
Definition midiPlayer.c:2334
void * globalMidiSave(void)
Stop all MIDI playback and return a pointer containing the full playback state. This state must be pa...
Definition midiFileParser.c:1018
uint8_t targetVol
The target volume of this tick.
Definition midiPlayer.h:525
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:412
void midiPlayerReset(midiPlayer_t *player)
Reset the MIDI player state.
Definition midiPlayer.c:1230
midiStreamingCallback_t streamingCallback
A callback function to retrieve the next event, when in MIDI_STREAMING mode.
Definition midiPlayer.h:677
timbreFlags_t
A bitfield which may contain various flags for a timbre.
Definition midiPlayer.h:145
@ TF_PERCUSSION
This timbre plays percussion sounds (percussionNote_t) rather than melodic notes.
Definition midiPlayer.h:149
@ TF_MONO
This timbre represents a monophonic instrument.
Definition midiPlayer.h:151
@ TF_NONE
No flags.
Definition midiPlayer.h:147
timbreEffects_t effects
Various effects applied to this timbre. May be ignored by percussion timbres.
Definition midiPlayer.h:502
Describes the characteristics of a particular timbre while.
Definition midiPlayer.h:365
Tracks the state of a single MIDI channel.
Definition midiPlayer.h:596
Tracks the state of the entire MIDI apparatus.
Definition midiPlayer.h:638
Defines the sound characteristics of a particular instrument.
Definition midiPlayer.h:433
Tracks the state of a single voice, playing a single note.
Definition midiPlayer.h:514
Definition midiPlayer.h:398
Holds several bitfields that track the state of each voice for fast access. This may be used for dyna...
Definition midiPlayer.h:569
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