Skip to content

Commit cf26b64

Browse files
committed
format: use camel case for public function names
1 parent 053b2f6 commit cf26b64

19 files changed

+607
-606
lines changed

src/midi.c

Lines changed: 128 additions & 128 deletions
Large diffs are not rendered by default.

src/midi_fm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void midi_fm_reset(void)
5050
synth_init(presets[0]);
5151
}
5252

53-
u16 midi_fm_pitchCentsToFreqNum(u8 pitch, s8 cents)
53+
u16 midi_fm_pitch_cents_to_freq_num(u8 pitch, s8 cents)
5454
{
5555
u16 freq = lookup_freq_num(pitch, 0);
5656
u16 nextFreq = lookup_freq_num(pitch, 1);
@@ -60,8 +60,8 @@ u16 midi_fm_pitchCentsToFreqNum(u8 pitch, s8 cents)
6060
static void set_synth_pitch(u8 chan)
6161
{
6262
MidiFmChannel* fmChan = &fmChannels[chan];
63-
synth_pitch(chan, midi_fm_pitchToOctave(fmChan->pitch),
64-
midi_fm_pitchCentsToFreqNum(fmChan->pitch, fmChan->cents));
63+
synth_pitch(chan, midi_fm_pitch_to_octave(fmChan->pitch),
64+
midi_fm_pitch_cents_to_freq_num(fmChan->pitch, fmChan->cents));
6565
}
6666

6767
void midi_fm_note_on(u8 chan, u8 pitch, s8 cents, u8 velocity)
@@ -81,13 +81,13 @@ void midi_fm_note_on(u8 chan, u8 pitch, s8 cents, u8 velocity)
8181
fmChan->cents = cents;
8282

8383
set_synth_pitch(chan);
84-
synth_noteOn(chan);
84+
synth_note_on(chan);
8585
}
8686

8787
void midi_fm_note_off(u8 chan, u8 pitch)
8888
{
8989
(void)pitch;
90-
synth_noteOff(chan);
90+
synth_note_off(chan);
9191
}
9292

9393
void midi_fm_channel_volume(u8 chan, u8 volume)
@@ -133,7 +133,7 @@ static void update_pan(u8 chan)
133133
}
134134
}
135135

136-
u8 midi_fm_pitchToOctave(u8 pitch)
136+
u8 midi_fm_pitch_to_octave(u8 pitch)
137137
{
138138
return (pitch - MIN_MIDI_PITCH) / SEMITONES;
139139
}

src/midi_fm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ void midi_fm_pan(u8 chan, u8 pan);
2121
void midi_fm_program(u8 chan, u8 program);
2222
void midi_fm_all_notes_off(u8 chan);
2323
void midi_fm_percussive(u8 chan, bool enabled);
24-
u8 midi_fm_pitchToOctave(u8 pitch);
24+
u8 midi_fm_pitch_to_octave(u8 pitch);
2525
void midi_fm_pitch(u8 chan, u8 pitch, s8 cents);
26-
u16 midi_fm_pitchCentsToFreqNum(u8 pitch, s8 cents);
26+
u16 midi_fm_pitch_cents_to_freq_num(u8 pitch, s8 cents);

src/midi_fm_sm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static SpecialModeOperator smOperators[SM_OP_LEN];
1414
void midi_fm_sm_note_on(u8 op, u8 pitch, s8 cents, u8 velocity)
1515
{
1616
midi_fm_sm_pitch(op, pitch, cents);
17-
synth_specialModeVolume(op, velocity);
17+
synth_special_mode_volume(op, velocity);
1818
}
1919

2020
void midi_fm_sm_pitch(u8 op, u8 pitch, s8 cents)
@@ -23,8 +23,8 @@ void midi_fm_sm_pitch(u8 op, u8 pitch, s8 cents)
2323
smOp->pitch = pitch;
2424
smOp->cents = cents;
2525

26-
synth_specialModePitch(op, midi_fm_pitchToOctave(smOp->pitch),
27-
midi_fm_pitchCentsToFreqNum(smOp->pitch, smOp->cents));
26+
synth_special_mode_pitch(op, midi_fm_pitch_to_octave(smOp->pitch),
27+
midi_fm_pitch_cents_to_freq_num(smOp->pitch, smOp->cents));
2828
}
2929

3030
void midi_fm_sm_reset(void)

src/synth.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void synth_init(const FmChannel* initialPreset)
5555
write_special_mode_reg();
5656
for (u8 chan = 0; chan < MAX_FM_CHANS; chan++) {
5757
volumes[chan] = MAX_VOLUME;
58-
synth_noteOff(chan);
58+
synth_note_off(chan);
5959
memcpy(&fmChannels[chan], initialPreset, sizeof(FmChannel));
6060
update_channel(chan);
6161
}
@@ -86,13 +86,13 @@ static void init_global(void)
8686
global.dacEnable = false;
8787
}
8888

89-
void synth_noteOn(u8 channel)
89+
void synth_note_on(u8 channel)
9090
{
9191
write_reg_safe(0, YM_KEY_ON_OFF, 0xF0 + key_on_off_reg_offset(channel));
9292
SET_BIT(noteOn, channel);
9393
}
9494

95-
void synth_noteOff(u8 channel)
95+
void synth_note_off(u8 channel)
9696
{
9797
write_reg_safe(0, YM_KEY_ON_OFF, key_on_off_reg_offset(channel));
9898
CLEAR_BIT(noteOn, channel);
@@ -138,7 +138,7 @@ void synth_feedback(u8 channel, u8 feedback)
138138
channel_parameter_updated(channel);
139139
}
140140

141-
void synth_operatorTotalLevel(u8 channel, u8 op, u8 totalLevel)
141+
void synth_operator_total_level(u8 channel, u8 op, u8 totalLevel)
142142
{
143143
Operator* oper = get_operator(channel, op);
144144
if (oper->totalLevel == totalLevel) {
@@ -149,84 +149,84 @@ void synth_operatorTotalLevel(u8 channel, u8 op, u8 totalLevel)
149149
channel_parameter_updated(channel);
150150
}
151151

152-
void synth_operatorMultiple(u8 channel, u8 op, u8 multiple)
152+
void synth_operator_multiple(u8 channel, u8 op, u8 multiple)
153153
{
154154
get_operator(channel, op)->multiple = multiple;
155155
write_operator_multiple_and_detune(channel, op);
156156
channel_parameter_updated(channel);
157157
}
158158

159-
void synth_operatorDetune(u8 channel, u8 op, u8 detune)
159+
void synth_operator_detune(u8 channel, u8 op, u8 detune)
160160
{
161161
get_operator(channel, op)->detune = detune;
162162
write_operator_multiple_and_detune(channel, op);
163163
channel_parameter_updated(channel);
164164
}
165165

166-
void synth_operatorRateScaling(u8 channel, u8 op, u8 rateScaling)
166+
void synth_operator_rate_scaling(u8 channel, u8 op, u8 rateScaling)
167167
{
168168
get_operator(channel, op)->rateScaling = rateScaling;
169169
write_operator_rate_scaling_and_attack_rate(channel, op);
170170
channel_parameter_updated(channel);
171171
}
172172

173-
void synth_operatorAttackRate(u8 channel, u8 op, u8 attackRate)
173+
void synth_operator_attack_rate(u8 channel, u8 op, u8 attackRate)
174174
{
175175
get_operator(channel, op)->attackRate = attackRate;
176176
write_operator_rate_scaling_and_attack_rate(channel, op);
177177
channel_parameter_updated(channel);
178178
}
179179

180-
void synth_operatorSustainRate(u8 channel, u8 op, u8 sustainRate)
180+
void synth_operator_sustain_rate(u8 channel, u8 op, u8 sustainRate)
181181
{
182182
get_operator(channel, op)->sustainRate = sustainRate;
183183
write_operator_sustain_rate(channel, op);
184184
channel_parameter_updated(channel);
185185
}
186186

187-
void synth_operatorReleaseRate(u8 channel, u8 op, u8 releaseRate)
187+
void synth_operator_release_rate(u8 channel, u8 op, u8 releaseRate)
188188
{
189189
get_operator(channel, op)->releaseRate = releaseRate;
190190
write_operator_release_rate_and_sustain_level(channel, op);
191191
channel_parameter_updated(channel);
192192
}
193193

194-
void synth_operatorSsgEg(u8 channel, u8 op, u8 ssgEg)
194+
void synth_operator_ssg_eg(u8 channel, u8 op, u8 ssgEg)
195195
{
196196
get_operator(channel, op)->ssgEg = ssgEg;
197197
write_operator_ssg_eg(channel, op);
198198
channel_parameter_updated(channel);
199199
}
200200

201-
void synth_operatorSustainLevel(u8 channel, u8 op, u8 sustainLevel)
201+
void synth_operator_sustain_level(u8 channel, u8 op, u8 sustainLevel)
202202
{
203203
get_operator(channel, op)->sustainLevel = sustainLevel;
204204
write_operator_release_rate_and_sustain_level(channel, op);
205205
channel_parameter_updated(channel);
206206
}
207207

208-
void synth_operatorDecayRate(u8 channel, u8 op, u8 decayRate)
208+
void synth_operator_decay_rate(u8 channel, u8 op, u8 decayRate)
209209
{
210210
get_operator(channel, op)->decayRate = decayRate;
211211
write_operator_amplitude_modulation_and_decay_rate(channel, op);
212212
channel_parameter_updated(channel);
213213
}
214214

215-
void synth_operatorAmplitudeModulation(u8 channel, u8 op, u8 amplitudeModulation)
215+
void synth_operator_amplitude_modulation(u8 channel, u8 op, u8 amplitudeModulation)
216216
{
217217
get_operator(channel, op)->amplitudeModulation = amplitudeModulation;
218218
write_operator_amplitude_modulation_and_decay_rate(channel, op);
219219
channel_parameter_updated(channel);
220220
}
221221

222-
void synth_enableLfo(u8 enable)
222+
void synth_enable_lfo(u8 enable)
223223
{
224224
global.lfoEnable = enable;
225225
write_global_lfo();
226226
other_parameter_updated(0, Lfo);
227227
}
228228

229-
void synth_globalLfoFrequency(u8 freq)
229+
void synth_global_lfo_frequency(u8 freq)
230230
{
231231
global.lfoFrequency = freq;
232232
write_global_lfo();
@@ -408,17 +408,17 @@ static u8 volume_adjusted_total_level(u8 channel, u8 totalLevel)
408408
return 0x7F - inverseNewTotalLevel;
409409
}
410410

411-
const FmChannel* synth_channelParameters(u8 channel)
411+
const FmChannel* synth_channel_parameters(u8 channel)
412412
{
413413
return &fmChannels[channel];
414414
}
415415

416-
const Global* synth_globalParameters()
416+
const Global* synth_global_parameters()
417417
{
418418
return &global;
419419
}
420420

421-
void synth_setParameterUpdateCallback(ParameterUpdatedCallback* cb)
421+
void synth_set_parameter_update_callback(ParameterUpdatedCallback* cb)
422422
{
423423
parameterUpdatedCallback = cb;
424424
}
@@ -428,21 +428,21 @@ static void write_special_mode_reg(void)
428428
write_reg_safe(0, YM_CH3_MODE, global.specialMode << 6);
429429
}
430430

431-
void synth_setSpecialMode(bool enable)
431+
void synth_set_special_mode(bool enable)
432432
{
433433
global.specialMode = enable;
434434
write_special_mode_reg();
435435
other_parameter_updated(0, SpecialMode);
436436
}
437437

438-
void synth_specialModePitch(u8 op, u8 octave, u16 freqNumber)
438+
void synth_special_mode_pitch(u8 op, u8 octave, u16 freqNumber)
439439
{
440440
u8 offset = (op + 1) % 3;
441441
write_reg_safe(0, YM_CH3SM_BASE_FREQ_MSB_BLK + offset, (freqNumber >> 8) | (octave << 3));
442442
write_reg_safe(0, YM_CH3SM_BASE_FREQ_LSB + offset, freqNumber);
443443
}
444444

445-
void synth_specialModeVolume(u8 operator, u8 volume)
445+
void synth_special_mode_volume(u8 operator, u8 volume)
446446
{
447447
Operator* op = get_operator(CH3_SPECIAL_MODE, operator);
448448
if (!is_output_operator(fmChannels[CH3_SPECIAL_MODE].algorithm, operator)) {
@@ -458,12 +458,12 @@ void synth_specialModeVolume(u8 operator, u8 volume)
458458
effective_total_level(CH3_SPECIAL_MODE, operator, newTotalLevel));
459459
}
460460

461-
void synth_directWriteYm2612(u8 part, u8 reg, u8 data)
461+
void synth_direct_write_ym2612(u8 part, u8 reg, u8 data)
462462
{
463463
write_reg_safe(part, reg, data);
464464
}
465465

466-
void synth_enableDac(bool enable)
466+
void synth_enable_dac(bool enable)
467467
{
468468
global.dacEnable = enable;
469469
write_dac_reg();

src/synth.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,35 +48,35 @@ typedef enum ParameterUpdated { Channel, Lfo, SpecialMode } ParameterUpdated;
4848
typedef void ParameterUpdatedCallback(u8 fmChan, ParameterUpdated parameterUpdated);
4949

5050
void synth_init(const FmChannel* initialPreset);
51-
void synth_noteOn(u8 channel);
52-
void synth_noteOff(u8 channel);
51+
void synth_note_on(u8 channel);
52+
void synth_note_off(u8 channel);
5353
void synth_pitch(u8 channel, u8 octave, u16 freqNumber);
5454
void synth_volume(u8 channel, u8 volume);
5555
void synth_stereo(u8 channel, u8 mode);
5656
void synth_algorithm(u8 channel, u8 algorithm);
5757
void synth_feedback(u8 channel, u8 feedback);
58-
void synth_operatorTotalLevel(u8 channel, u8 op, u8 totalLevel);
59-
void synth_operatorMultiple(u8 channel, u8 op, u8 multiple);
60-
void synth_operatorDetune(u8 channel, u8 op, u8 detune);
61-
void synth_operatorRateScaling(u8 channel, u8 op, u8 rateScaling);
62-
void synth_operatorAttackRate(u8 channel, u8 op, u8 attackRate);
63-
void synth_operatorDecayRate(u8 channel, u8 op, u8 decayRate);
64-
void synth_operatorSustainRate(u8 channel, u8 op, u8 sustainRate);
65-
void synth_operatorSustainLevel(u8 channel, u8 op, u8 sustainLevel);
66-
void synth_operatorAmplitudeModulation(u8 channel, u8 op, u8 amplitudeModulation);
67-
void synth_operatorReleaseRate(u8 channel, u8 op, u8 releaseRate);
68-
void synth_operatorSsgEg(u8 channel, u8 op, u8 ssgEg);
69-
void synth_enableLfo(u8 enable);
70-
void synth_globalLfoFrequency(u8 freq);
58+
void synth_operator_total_level(u8 channel, u8 op, u8 totalLevel);
59+
void synth_operator_multiple(u8 channel, u8 op, u8 multiple);
60+
void synth_operator_detune(u8 channel, u8 op, u8 detune);
61+
void synth_operator_rate_scaling(u8 channel, u8 op, u8 rateScaling);
62+
void synth_operator_attack_rate(u8 channel, u8 op, u8 attackRate);
63+
void synth_operator_decay_rate(u8 channel, u8 op, u8 decayRate);
64+
void synth_operator_sustain_rate(u8 channel, u8 op, u8 sustainRate);
65+
void synth_operator_sustain_level(u8 channel, u8 op, u8 sustainLevel);
66+
void synth_operator_amplitude_modulation(u8 channel, u8 op, u8 amplitudeModulation);
67+
void synth_operator_release_rate(u8 channel, u8 op, u8 releaseRate);
68+
void synth_operator_ssg_eg(u8 channel, u8 op, u8 ssgEg);
69+
void synth_enable_lfo(u8 enable);
70+
void synth_global_lfo_frequency(u8 freq);
7171
void synth_ams(u8 channel, u8 ams);
7272
void synth_fms(u8 channel, u8 fms);
7373
u8 synth_busy(void);
7474
void synth_preset(u8 channel, const FmChannel* preset);
75-
const FmChannel* synth_channelParameters(u8 channel);
76-
const Global* synth_globalParameters();
77-
void synth_setParameterUpdateCallback(ParameterUpdatedCallback* cb);
78-
void synth_setSpecialMode(bool enable);
79-
void synth_specialModePitch(u8 op, u8 octave, u16 freqNumber);
80-
void synth_specialModeVolume(u8 op, u8 volume);
81-
void synth_directWriteYm2612(u8 part, u8 reg, u8 data);
82-
void synth_enableDac(bool enable);
75+
const FmChannel* synth_channel_parameters(u8 channel);
76+
const Global* synth_global_parameters();
77+
void synth_set_parameter_update_callback(ParameterUpdatedCallback* cb);
78+
void synth_set_special_mode(bool enable);
79+
void synth_special_mode_pitch(u8 op, u8 octave, u16 freqNumber);
80+
void synth_special_mode_volume(u8 op, u8 volume);
81+
void synth_direct_write_ym2612(u8 part, u8 reg, u8 data);
82+
void synth_enable_dac(bool enable);

src/ui_fm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static bool update_fm_value(
3333

3434
void ui_fm_init(void)
3535
{
36-
synth_setParameterUpdateCallback(synth_parameter_updated);
36+
synth_set_parameter_update_callback(synth_parameter_updated);
3737
init_algorithm_sprites();
3838
}
3939

@@ -259,8 +259,8 @@ static void update_op_values(const FmChannel* channel, bool forceRefresh)
259259

260260
static void update_fm_values(void)
261261
{
262-
const FmChannel* channel = synth_channelParameters(chanParasFmChan);
263-
const Global* global = synth_globalParameters();
262+
const FmChannel* channel = synth_channel_parameters(chanParasFmChan);
263+
const Global* global = synth_global_parameters();
264264

265265
const u8 COL1_VALUE_X = FM_HEADING_X + 4;
266266
const u8 COL2_VALUE_X = FM_HEADING_X + 11;

0 commit comments

Comments
 (0)