Skip to content

Commit

Permalink
audio refactor: replace deprecated PLAY_NOTE_ARRAY (#8484)
Browse files Browse the repository at this point in the history
* audio refactoring: replace deprecated macro PLAY_NOTE_ARRAY with PLAY_SONG

* audio refactoring: drop deprecated (and unused) PLAY_NOTE_ARRAY macro

* audio refactoring: replace deprecated PLAY_NOTE_ARRAY wit PLAY_SONG in documentation

* audio refactor: add Changelog entry for 'future'
  • Loading branch information
JohSchneider authored May 6, 2020
1 parent 1bbb113 commit 30dd34e
Show file tree
Hide file tree
Showing 22 changed files with 63 additions and 65 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog/20200530/PR8484.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
code cleanup regarding deprecated macro PLAY_NOTE_ARRAY by replacing it with PLAY_SONG
4 changes: 2 additions & 2 deletions docs/custom_quantum_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// Play a tone when enter is pressed
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // Let QMK send the enter press/release events
default:
Expand Down Expand Up @@ -438,7 +438,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// Play a tone when enter is pressed
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // Let QMK send the enter press/release events
case RGB_LYR: // This allows me to use underglow as layer indication, or as normal
Expand Down
4 changes: 2 additions & 2 deletions docs/ja/custom_quantum_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// enter が押された時に音を再生します
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // QMK に enter のプレスまたはリリースイベントを送信させます
default:
Expand Down Expand Up @@ -440,7 +440,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// enter が押された時に音を再生します
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // QMK に enter のプレスまたはリリースイベントを送信させます
case RGB_LYR: // これにより、アンダーグローをレイヤー表示として、あるいは通常通りに使うことができます。
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-cn/custom_quantum_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// 当按下回车时播放音符
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // 让QMK触发回车按下/释放事件
default:
Expand Down Expand Up @@ -413,7 +413,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_ENTER:
// 在按下回车时播放音符
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
PLAY_SONG(tone_qwerty);
}
return true; // 让QMK产生回车按下/释放事件
case RGB_LYR: // 本句让underglow作为层指示,或正常使用。
Expand Down
2 changes: 1 addition & 1 deletion keyboards/cu75/cu75.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void matrix_init_kb(void)

#ifdef AUDIO_ENABLE
audio_init();
PLAY_NOTE_ARRAY(test_sound, false, STACCATO);
PLAY_SONG(test_sound);
// Fix port B5
cbi(DDRB, 5);
sbi(PORTB, 5);
Expand Down
4 changes: 2 additions & 2 deletions keyboards/jd45/keymaps/mjt6u/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
persistent_default_layer_set(1UL << _QWERTY);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_fnpc, false, 0);
PLAY_SONG(tone_fnpc);
#endif
print("Space-FN");
}
Expand All @@ -130,7 +130,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
persistent_default_layer_set(1UL << _QWERTYNUMMODS);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_fnmac, false, 0);
PLAY_SONG(tone_fnmac);
#endif
print("Space-Numpad");
}
Expand Down
6 changes: 3 additions & 3 deletions keyboards/keebio/viterbi/keymaps/bakingpy/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
Expand All @@ -167,7 +167,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
Expand All @@ -176,7 +176,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/keebio/viterbi/keymaps/dwallace/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
Expand Down
4 changes: 2 additions & 2 deletions keyboards/keebio/viterbi/keymaps/mike808/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL << _QWERTY);
}
Expand All @@ -137,7 +137,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL << _DVORAK);
}
Expand Down
6 changes: 3 additions & 3 deletions keyboards/lets_split/keymaps/mjt/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
}
Expand All @@ -161,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
}
Expand All @@ -170,7 +170,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
}
Expand Down
6 changes: 3 additions & 3 deletions keyboards/meira/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
// persistent_default_layer_set(1UL<<_QWERTY);
}
Expand All @@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
// persistent_default_layer_set(1UL<<_COLEMAK);
}
Expand All @@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
// persistent_default_layer_set(1UL<<_DVORAK);
}
Expand Down
6 changes: 3 additions & 3 deletions keyboards/meira/keymaps/grahampheath/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,23 +243,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion keyboards/meira/keymaps/takmiya/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
// persistent_default_layer_set(1UL<<_QWERTY);
}
Expand Down
16 changes: 8 additions & 8 deletions keyboards/planck/keymaps/emilyh/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
Expand All @@ -196,7 +196,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
Expand All @@ -205,7 +205,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
Expand Down Expand Up @@ -246,7 +246,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
PLAY_SONG(tone_plover);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
Expand All @@ -264,7 +264,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
PLAY_SONG(tone_plover_gb);
#endif
layer_off(_PLOVER);
}
Expand All @@ -285,12 +285,12 @@ void matrix_init_user(void) {
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
PLAY_SONG(tone_startup);
}

void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
PLAY_SONG(tone_goodbye);
_delay_ms(150);
stop_all_notes();
}
Expand All @@ -302,7 +302,7 @@ void music_on_user(void)

void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
PLAY_SONG(music_scale);
}

#endif
16 changes: 8 additions & 8 deletions keyboards/planck/keymaps/ishtob/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
Expand All @@ -235,7 +235,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
PLAY_SONG(tone_colemak);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
Expand All @@ -244,7 +244,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
PLAY_SONG(tone_dvorak);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
Expand Down Expand Up @@ -285,7 +285,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
PLAY_SONG(tone_plover);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
Expand All @@ -303,7 +303,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
PLAY_SONG(tone_plover_gb);
#endif
layer_off(_PLOVER);
}
Expand All @@ -327,12 +327,12 @@ void startup_user()
rgblight_mode(RGB_MATRIX_CYCLE_ALL);
#endif //RGB_matrix
wait_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
PLAY_SONG(tone_startup);
}

void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
PLAY_SONG(tone_goodbye);
wait_ms(150);
stop_all_notes();
}
Expand All @@ -344,7 +344,7 @@ void music_on_user(void)

void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
PLAY_SONG(music_scale);
}

#endif
Expand Down
8 changes: 4 additions & 4 deletions keyboards/planck/keymaps/that_canadian/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
PLAY_SONG(tone_qwerty);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
Expand Down Expand Up @@ -185,12 +185,12 @@ void matrix_init_user(void) {
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
PLAY_SONG(tone_startup);
}

void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
PLAY_SONG(tone_goodbye);
_delay_ms(150);
stop_all_notes();
}
Expand All @@ -202,7 +202,7 @@ void music_on_user(void)

void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
PLAY_SONG(music_scale);
}

#endif
Loading

0 comments on commit 30dd34e

Please sign in to comment.