clean-up planck and preonic keymaps, move audio stuff around
parent
8edb67b082
commit
6a3c66776c
|
@ -15,6 +15,16 @@
|
||||||
*/
|
*/
|
||||||
#define MIDI_BASIC
|
#define MIDI_BASIC
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#define STARTUP_SONG SONG(PLANCK_SOUND)
|
||||||
|
// #define STARTUP_SONG SONG(NO_SOUND)
|
||||||
|
|
||||||
|
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||||
|
SONG(COLEMAK_SOUND), \
|
||||||
|
SONG(DVORAK_SOUND) \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* enable advanced MIDI features:
|
/* enable advanced MIDI features:
|
||||||
- MIDI notes can be added to the keymap
|
- MIDI notes can be added to the keymap
|
||||||
- Octave shift and transpose
|
- Octave shift and transpose
|
||||||
|
|
|
@ -1,20 +1,28 @@
|
||||||
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
|
/* Copyright 2015-2017 Jack Humbert
|
||||||
// this is the style you want to emulate.
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "planck.h"
|
#include "planck.h"
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
#include "eeconfig.h"
|
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
|
||||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
|
||||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
|
||||||
// entirely and just use numbers.
|
|
||||||
|
|
||||||
enum planck_layers {
|
enum planck_layers {
|
||||||
_QWERTY,
|
_QWERTY,
|
||||||
_COLEMAK,
|
_COLEMAK,
|
||||||
|
@ -36,10 +44,6 @@ enum planck_keycodes {
|
||||||
EXT_PLV
|
EXT_PLV
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fillers to make layering more clear
|
|
||||||
#define _______ KC_TRNS
|
|
||||||
#define XXXXXXX KC_NO
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* Qwerty
|
/* Qwerty
|
||||||
|
@ -173,50 +177,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
|
float plover_song[][2] = SONG(PLOVER_SOUND);
|
||||||
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
||||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
|
||||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
|
||||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
|
||||||
float tone_plover[][2] = SONG(PLOVER_SOUND);
|
|
||||||
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
|
||||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
|
||||||
|
|
||||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void persistent_default_layer_set(uint16_t default_layer) {
|
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set(default_layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case QWERTY:
|
case QWERTY:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_QWERTY);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case COLEMAK:
|
case COLEMAK:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_COLEMAK);
|
||||||
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_COLEMAK);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case DVORAK:
|
case DVORAK:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_DVORAK);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
@ -255,7 +236,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
stop_all_notes();
|
stop_all_notes();
|
||||||
PLAY_NOTE_ARRAY(tone_plover, false, 0);
|
PLAY_SONG(plover_song);
|
||||||
#endif
|
#endif
|
||||||
layer_off(_RAISE);
|
layer_off(_RAISE);
|
||||||
layer_off(_LOWER);
|
layer_off(_LOWER);
|
||||||
|
@ -273,7 +254,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
case EXT_PLV:
|
case EXT_PLV:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
|
PLAY_SONG(plover_gb_song);
|
||||||
#endif
|
#endif
|
||||||
layer_off(_PLOVER);
|
layer_off(_PLOVER);
|
||||||
}
|
}
|
||||||
|
@ -282,36 +263,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
startup_user();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
|
|
||||||
void startup_user()
|
|
||||||
{
|
|
||||||
_delay_ms(20); // gets rid of tick
|
|
||||||
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void shutdown_user()
|
|
||||||
{
|
|
||||||
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
|
||||||
_delay_ms(150);
|
|
||||||
stop_all_notes();
|
|
||||||
}
|
|
||||||
|
|
||||||
void music_on_user(void)
|
|
||||||
{
|
|
||||||
music_scale_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void music_scale_user(void)
|
|
||||||
{
|
|
||||||
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -15,6 +15,16 @@
|
||||||
*/
|
*/
|
||||||
#define MIDI_BASIC
|
#define MIDI_BASIC
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#define STARTUP_SONG SONG(PLANCK_SOUND)
|
||||||
|
// #define STARTUP_SONG SONG(NO_SOUND)
|
||||||
|
|
||||||
|
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||||
|
SONG(COLEMAK_SOUND), \
|
||||||
|
SONG(DVORAK_SOUND) \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* enable advanced MIDI features:
|
/* enable advanced MIDI features:
|
||||||
- MIDI notes can be added to the keymap
|
- MIDI notes can be added to the keymap
|
||||||
- Octave shift and transpose
|
- Octave shift and transpose
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/* Copyright 2015-2017 Jack Humbert
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "preonic.h"
|
#include "preonic.h"
|
||||||
#include "action_layer.h"
|
#include "action_layer.h"
|
||||||
#include "eeconfig.h"
|
#include "eeconfig.h"
|
||||||
|
@ -5,11 +21,6 @@
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
|
||||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
|
||||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
|
||||||
// entirely and just use numbers.
|
|
||||||
|
|
||||||
enum preonic_layers {
|
enum preonic_layers {
|
||||||
_QWERTY,
|
_QWERTY,
|
||||||
_COLEMAK,
|
_COLEMAK,
|
||||||
|
@ -28,10 +39,6 @@ enum preonic_keycodes {
|
||||||
BACKLIT
|
BACKLIT
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fillers to make layering more clear
|
|
||||||
#define _______ KC_TRNS
|
|
||||||
#define XXXXXXX KC_NO
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* Qwerty
|
/* Qwerty
|
||||||
|
@ -163,54 +170,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
float tone_startup[][2] = {
|
|
||||||
{NOTE_B5, 20},
|
|
||||||
{NOTE_B6, 8},
|
|
||||||
{NOTE_DS6, 20},
|
|
||||||
{NOTE_B6, 8}
|
|
||||||
};
|
|
||||||
|
|
||||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
|
||||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
|
||||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
|
||||||
|
|
||||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
|
||||||
|
|
||||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void persistent_default_layer_set(uint16_t default_layer) {
|
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set(default_layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case QWERTY:
|
case QWERTY:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_QWERTY);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case COLEMAK:
|
case COLEMAK:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_COLEMAK);
|
||||||
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_COLEMAK);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case DVORAK:
|
case DVORAK:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
#ifdef AUDIO_ENABLE
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_DVORAK);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
@ -248,36 +224,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
startup_user();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
|
|
||||||
void startup_user()
|
|
||||||
{
|
|
||||||
_delay_ms(20); // gets rid of tick
|
|
||||||
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void shutdown_user()
|
|
||||||
{
|
|
||||||
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
|
||||||
_delay_ms(150);
|
|
||||||
stop_all_notes();
|
|
||||||
}
|
|
||||||
|
|
||||||
void music_on_user(void)
|
|
||||||
{
|
|
||||||
music_scale_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void music_scale_user(void)
|
|
||||||
{
|
|
||||||
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
//#include <math.h>
|
//#include <math.h>
|
||||||
|
@ -119,9 +120,17 @@ audio_config_t audio_config;
|
||||||
uint16_t envelope_index = 0;
|
uint16_t envelope_index = 0;
|
||||||
bool glissando = true;
|
bool glissando = true;
|
||||||
|
|
||||||
|
#ifndef STARTUP_SONG
|
||||||
|
#define STARTUP_SONG SONG(STARTUP_SOUND)
|
||||||
|
#endif
|
||||||
|
float startup_song[][2] = STARTUP_SONG;
|
||||||
|
|
||||||
void audio_init()
|
void audio_init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (audio_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
// Check EEPROM
|
// Check EEPROM
|
||||||
if (!eeconfig_is_enabled())
|
if (!eeconfig_is_enabled())
|
||||||
{
|
{
|
||||||
|
@ -169,6 +178,11 @@ void audio_init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
audio_initialized = true;
|
audio_initialized = true;
|
||||||
|
|
||||||
|
if (audio_config.enable) {
|
||||||
|
PLAY_NOTE_ARRAY(startup_song, false, LEGATO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop_all_notes()
|
void stop_all_notes()
|
||||||
|
|
|
@ -99,7 +99,7 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
|
||||||
// The global float array for the song must be used here.
|
// The global float array for the song must be used here.
|
||||||
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
|
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
|
||||||
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
|
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
|
||||||
|
#define PLAY_SONG(song) PLAY_NOTE_ARRAY(song, false, STACCATO)
|
||||||
|
|
||||||
bool is_playing_notes(void);
|
bool is_playing_notes(void);
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,7 @@
|
||||||
#ifndef SONG_LIST_H
|
#ifndef SONG_LIST_H
|
||||||
#define SONG_LIST_H
|
#define SONG_LIST_H
|
||||||
|
|
||||||
#define COIN_SOUND \
|
#define NO_SOUND
|
||||||
E__NOTE(_A5 ),\
|
|
||||||
HD_NOTE(_E6 ),
|
|
||||||
|
|
||||||
#define ODE_TO_JOY \
|
#define ODE_TO_JOY \
|
||||||
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
|
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
|
||||||
|
@ -55,18 +53,29 @@
|
||||||
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
|
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
|
||||||
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
|
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
|
||||||
|
|
||||||
|
#define STARTUP_SOUND \
|
||||||
|
E__NOTE(_E6), \
|
||||||
|
E__NOTE(_A6), \
|
||||||
|
ED_NOTE(_E7),
|
||||||
|
|
||||||
#define GOODBYE_SOUND \
|
#define GOODBYE_SOUND \
|
||||||
E__NOTE(_E7), \
|
E__NOTE(_E7), \
|
||||||
E__NOTE(_A6), \
|
E__NOTE(_A6), \
|
||||||
ED_NOTE(_E6),
|
ED_NOTE(_E6),
|
||||||
|
|
||||||
#define STARTUP_SOUND \
|
#define PLANCK_SOUND \
|
||||||
ED_NOTE(_E7 ), \
|
ED_NOTE(_E7 ), \
|
||||||
E__NOTE(_CS7), \
|
E__NOTE(_CS7), \
|
||||||
E__NOTE(_E6 ), \
|
E__NOTE(_E6 ), \
|
||||||
E__NOTE(_A6 ), \
|
E__NOTE(_A6 ), \
|
||||||
M__NOTE(_CS7, 20),
|
M__NOTE(_CS7, 20),
|
||||||
|
|
||||||
|
#define PREONIC_SOUND \
|
||||||
|
M__NOTE(_B5, 20), \
|
||||||
|
E__NOTE(_B6), \
|
||||||
|
M__NOTE(_DS6, 20), \
|
||||||
|
E__NOTE(_B6),
|
||||||
|
|
||||||
#define QWERTY_SOUND \
|
#define QWERTY_SOUND \
|
||||||
E__NOTE(_GS6 ), \
|
E__NOTE(_GS6 ), \
|
||||||
E__NOTE(_A6 ), \
|
E__NOTE(_A6 ), \
|
||||||
|
@ -107,7 +116,8 @@
|
||||||
S__NOTE(_REST), \
|
S__NOTE(_REST), \
|
||||||
ED_NOTE(_E7 ),
|
ED_NOTE(_E7 ),
|
||||||
|
|
||||||
#define MUSIC_SCALE_SOUND \
|
|
||||||
|
#define MUSIC_ON_SOUND \
|
||||||
E__NOTE(_A5 ), \
|
E__NOTE(_A5 ), \
|
||||||
E__NOTE(_B5 ), \
|
E__NOTE(_B5 ), \
|
||||||
E__NOTE(_CS6), \
|
E__NOTE(_CS6), \
|
||||||
|
@ -117,6 +127,18 @@
|
||||||
E__NOTE(_GS6), \
|
E__NOTE(_GS6), \
|
||||||
E__NOTE(_A6 ),
|
E__NOTE(_A6 ),
|
||||||
|
|
||||||
|
#define MUSIC_SCALE_SOUND MUSIC_ON_SOUND
|
||||||
|
|
||||||
|
#define MUSIC_OFF_SOUND \
|
||||||
|
E__NOTE(_A6 ), \
|
||||||
|
E__NOTE(_GS6 ), \
|
||||||
|
E__NOTE(_FS6), \
|
||||||
|
E__NOTE(_E6 ), \
|
||||||
|
E__NOTE(_D6 ), \
|
||||||
|
E__NOTE(_CS6), \
|
||||||
|
E__NOTE(_B5), \
|
||||||
|
E__NOTE(_A5 ),
|
||||||
|
|
||||||
#define CAPS_LOCK_ON_SOUND \
|
#define CAPS_LOCK_ON_SOUND \
|
||||||
E__NOTE(_A3), \
|
E__NOTE(_A3), \
|
||||||
E__NOTE(_B3),
|
E__NOTE(_B3),
|
||||||
|
@ -141,6 +163,16 @@
|
||||||
E__NOTE(_E5), \
|
E__NOTE(_E5), \
|
||||||
E__NOTE(_D5),
|
E__NOTE(_D5),
|
||||||
|
|
||||||
|
#define AG_NORM_SOUND \
|
||||||
|
E__NOTE(_A5), \
|
||||||
|
E__NOTE(_A5),
|
||||||
|
|
||||||
|
#define AG_SWAP_SOUND \
|
||||||
|
SD_NOTE(_B5), \
|
||||||
|
SD_NOTE(_A5), \
|
||||||
|
SD_NOTE(_B5), \
|
||||||
|
SD_NOTE(_A5),
|
||||||
|
|
||||||
#define UNICODE_WINDOWS \
|
#define UNICODE_WINDOWS \
|
||||||
E__NOTE(_B5), \
|
E__NOTE(_B5), \
|
||||||
S__NOTE(_E6),
|
S__NOTE(_E6),
|
||||||
|
|
|
@ -100,4 +100,6 @@
|
||||||
|
|
||||||
#define API_SYSEX_MAX_SIZE 32
|
#define API_SYSEX_MAX_SIZE 32
|
||||||
|
|
||||||
|
#include "song_list.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,6 +39,15 @@ static uint8_t music_sequence_position = 0;
|
||||||
static uint16_t music_sequence_timer = 0;
|
static uint16_t music_sequence_timer = 0;
|
||||||
static uint16_t music_sequence_interval = 100;
|
static uint16_t music_sequence_interval = 100;
|
||||||
|
|
||||||
|
#ifndef MUSIC_ON_SONG
|
||||||
|
#define MUSIC_ON_SONG SONG(MUSIC_ON_SOUND)
|
||||||
|
#endif
|
||||||
|
#ifndef MUSIC_OFF_SONG
|
||||||
|
#define MUSIC_OFF_SONG SONG(MUSIC_OFF_SOUND)
|
||||||
|
#endif
|
||||||
|
float music_on_song[][2] = MUSIC_ON_SONG;
|
||||||
|
float music_off_song[][2] = MUSIC_OFF_SONG;
|
||||||
|
|
||||||
static void music_noteon(uint8_t note) {
|
static void music_noteon(uint8_t note) {
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
process_audio_noteon(note);
|
process_audio_noteon(note);
|
||||||
|
@ -79,12 +88,9 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keycode == MU_TOG && record->event.pressed) {
|
if (keycode == MU_TOG && record->event.pressed) {
|
||||||
if (music_activated)
|
if (music_activated) {
|
||||||
{
|
|
||||||
music_off();
|
music_off();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
music_on();
|
music_on();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -175,12 +181,14 @@ void music_toggle(void) {
|
||||||
|
|
||||||
void music_on(void) {
|
void music_on(void) {
|
||||||
music_activated = 1;
|
music_activated = 1;
|
||||||
|
PLAY_SONG(music_on_song);
|
||||||
music_on_user();
|
music_on_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
void music_off(void) {
|
void music_off(void) {
|
||||||
music_activated = 0;
|
|
||||||
music_all_notes_off();
|
music_all_notes_off();
|
||||||
|
music_activated = 0;
|
||||||
|
PLAY_SONG(music_off_song);
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_scan_music(void) {
|
void matrix_scan_music(void) {
|
||||||
|
|
|
@ -30,6 +30,28 @@ extern backlight_config_t backlight_config;
|
||||||
#include "fauxclicky.h"
|
#include "fauxclicky.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#ifndef GOODBYE_SONG
|
||||||
|
#define GOODBYE_SONG SONG(GOODBYE_SOUND)
|
||||||
|
#endif
|
||||||
|
#ifndef AG_NORM_SONG
|
||||||
|
#define AG_NORM_SONG SONG(AG_NORM_SOUND)
|
||||||
|
#endif
|
||||||
|
#ifndef AG_SWAP_SONG
|
||||||
|
#define AG_SWAP_SONG SONG(AG_SWAP_SOUND)
|
||||||
|
#endif
|
||||||
|
#ifndef DEFAULT_LAYER_SONGS
|
||||||
|
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
|
||||||
|
SONG(COLEMAK_SOUND) \
|
||||||
|
SONG(DVORAK_SOUND) \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
float goodbye_song[][2] = GOODBYE_SONG;
|
||||||
|
float ag_norm_song[][2] = AG_NORM_SONG;
|
||||||
|
float ag_swap_song[][2] = AG_SWAP_SONG;
|
||||||
|
float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
|
static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case QK_MODS ... QK_MODS_MAX:
|
case QK_MODS ... QK_MODS_MAX:
|
||||||
|
@ -116,9 +138,15 @@ void reset_keyboard(void) {
|
||||||
clear_keyboard();
|
clear_keyboard();
|
||||||
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
|
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
|
||||||
music_all_notes_off();
|
music_all_notes_off();
|
||||||
|
uint16_t timer_start = timer_read();
|
||||||
|
PLAY_SONG(goodbye_song);
|
||||||
shutdown_user();
|
shutdown_user();
|
||||||
#endif
|
while(timer_elapsed(timer_start) < 250)
|
||||||
|
wait_ms(1);
|
||||||
|
stop_all_notes();
|
||||||
|
#else
|
||||||
wait_ms(250);
|
wait_ms(250);
|
||||||
|
#endif
|
||||||
#ifdef CATERINA_BOOTLOADER
|
#ifdef CATERINA_BOOTLOADER
|
||||||
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
|
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
|
||||||
#endif
|
#endif
|
||||||
|
@ -351,6 +379,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||||
case MAGIC_SWAP_ALT_GUI:
|
case MAGIC_SWAP_ALT_GUI:
|
||||||
keymap_config.swap_lalt_lgui = true;
|
keymap_config.swap_lalt_lgui = true;
|
||||||
keymap_config.swap_ralt_rgui = true;
|
keymap_config.swap_ralt_rgui = true;
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
PLAY_SONG(ag_swap_song);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
|
case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
|
||||||
keymap_config.swap_control_capslock = false;
|
keymap_config.swap_control_capslock = false;
|
||||||
|
@ -379,6 +410,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||||
case MAGIC_UNSWAP_ALT_GUI:
|
case MAGIC_UNSWAP_ALT_GUI:
|
||||||
keymap_config.swap_lalt_lgui = false;
|
keymap_config.swap_lalt_lgui = false;
|
||||||
keymap_config.swap_ralt_rgui = false;
|
keymap_config.swap_ralt_rgui = false;
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
PLAY_SONG(ag_norm_song);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case MAGIC_TOGGLE_NKRO:
|
case MAGIC_TOGGLE_NKRO:
|
||||||
keymap_config.nkro = !keymap_config.nkro;
|
keymap_config.nkro = !keymap_config.nkro;
|
||||||
|
@ -521,6 +555,14 @@ void send_string_with_delay(const char *str, uint8_t interval) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_single_persistent_default_layer(uint8_t default_layer) {
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
PLAY_SONG(default_layer_songs[default_layer]);
|
||||||
|
#endif
|
||||||
|
eeconfig_update_default_layer(1U<<default_layer);
|
||||||
|
default_layer_set(1U<<default_layer);
|
||||||
|
}
|
||||||
|
|
||||||
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||||
layer_on(layer3);
|
layer_on(layer3);
|
||||||
|
@ -571,6 +613,9 @@ void matrix_init_quantum() {
|
||||||
#ifdef BACKLIGHT_ENABLE
|
#ifdef BACKLIGHT_ENABLE
|
||||||
backlight_init_ports();
|
backlight_init_ports();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
audio_init();
|
||||||
|
#endif
|
||||||
matrix_init_kb();
|
matrix_init_kb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ extern uint32_t default_layer_state;
|
||||||
#endif // MIDI_ENABLE
|
#endif // MIDI_ENABLE
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
|
#include "audio.h"
|
||||||
#include "process_audio.h"
|
#include "process_audio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -103,6 +104,8 @@ void send_string_with_delay(const char *str, uint8_t interval);
|
||||||
// For tri-layer
|
// For tri-layer
|
||||||
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
|
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
|
||||||
|
|
||||||
|
void set_single_persistent_default_layer(uint8_t default_layer);
|
||||||
|
|
||||||
void tap_random_base64(void);
|
void tap_random_base64(void);
|
||||||
|
|
||||||
#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
|
#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Fillers to make layering more clear
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
#define XXXXXXX KC_NO
|
||||||
|
|
||||||
enum quantum_keycodes {
|
enum quantum_keycodes {
|
||||||
// Ranges used in shortucuts - not to be used directly
|
// Ranges used in shortucuts - not to be used directly
|
||||||
QK_TMK = 0x0000,
|
QK_TMK = 0x0000,
|
||||||
|
|
Loading…
Reference in New Issue