Skip to content

Commit

Permalink
Make pitch to freq function static
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Jun 27, 2024
1 parent 9cfee02 commit 6ace021
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/midi_fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static MidiFmChannel fmChannels[MAX_FM_CHANS];
static u8 pitchIsOutOfRange(u8 pitch);
static u8 effectiveVolume(MidiFmChannel* channelState);
static void updatePan(u8 chan);
static u16 pitchToFreq(u8 pitch);
void midi_fm_reset(void);

static const FmChannel** presets;
Expand Down Expand Up @@ -86,7 +87,7 @@ void midi_fm_channel_volume(u8 chan, u8 volume)

u16 midi_fm_pitchAndPitchBendToFreqNum(u8 pitch, u16 pitchBend)
{
u16 freq = midi_fm_pitchToFreqNumber(pitch);
u16 freq = pitchToFreq(pitch);
s16 bendRelative = pitchBend - MIDI_PITCH_BEND_CENTRE;
return freq + (bendRelative / 75);
}
Expand Down Expand Up @@ -141,7 +142,7 @@ u8 midi_fm_pitchToOctave(u8 pitch)
return (pitch - MIN_MIDI_PITCH) / SEMITONES;
}

u16 midi_fm_pitchToFreqNumber(u8 pitch)
static u16 pitchToFreq(u8 pitch)
{
return FREQS[((u8)(pitch - MIN_MIDI_PITCH)) % SEMITONES];
}
Expand Down
1 change: 0 additions & 1 deletion src/midi_fm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ void midi_fm_program(u8 chan, u8 program);
void midi_fm_all_notes_off(u8 chan);
void midi_fm_percussive(u8 chan, bool enabled);
u8 midi_fm_pitchToOctave(u8 pitch);
u16 midi_fm_pitchToFreqNumber(u8 pitch);
u16 midi_fm_pitchAndPitchBendToFreqNum(u8 pitch, u16 pitchBend);

0 comments on commit 6ace021

Please sign in to comment.