├── photos ├── synth.jpg ├── 20230112_212233.jpg ├── 20230113_110707.jpg ├── 20230113_140341.jpg ├── 20230113_140354.jpg ├── 20230113_140404.jpg ├── 20230115_155945.jpg ├── 20230115_155958.jpg ├── 20230119_172531.jpg ├── 20230120_211841.jpg ├── 20230121_161446.jpg ├── 20230121_161559.jpg ├── 20230121_221155.jpg ├── 20230122_144658.jpg ├── 20230122_203301.jpg ├── 20230123_171128.jpg ├── 20230123_171157.jpg ├── 20230123_195308.jpg ├── 20230123_204247.jpg ├── 20230123_204253.jpg ├── 20230124_180600.jpg ├── 20230124_181016.jpg ├── 20230125_140616.jpg ├── 20230125_140625.jpg ├── 20230125_160724.jpg ├── 20230125_203501.jpg ├── 20230126_164155.jpg ├── 20230129_130145.jpg ├── 20230129_132823.jpg ├── 20230129_185415.jpg ├── 20230129_185424.jpg ├── 20230129_200219.jpg ├── 20230201_124814.jpg ├── 20230201_124823.jpg ├── 20230201_231255.jpg ├── 20230202_223132.jpg ├── 20230203_212551.jpg ├── 20230205_132014.jpg └── 20230205_132043.jpg ├── Schematics ├── Noise.pdf ├── demux.pdf ├── Final VCA.pdf ├── LFO_VCA.pdf ├── pico-dco-fm.pdf ├── sample_hold.pdf ├── teensyboard.pdf ├── filter-AS3372.pdf ├── filter-control.pdf ├── pico-dco-dac.pdf ├── front panel pots.pdf ├── level conversion.pdf ├── DCO analogue board.pdf ├── YD-pico-dco-board.pdf ├── filter-pole_mixer.pdf └── VCAs and Wave Converters.pdf ├── name.c ├── YD_Code ├── 8_voices_1 │ ├── pico-dco.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ ├── usb_descriptors.c │ └── YD-dco-lfo.c ├── 8_voices_2 │ ├── pico-dco.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ ├── usb_descriptors.c │ └── YD-dco-lfo.c ├── 4_voices_1 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c ├── 4_voices_2 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c ├── 4_voices_DAC_1 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c ├── 4_voices_DAC_2 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c ├── 8_voices_DAC_1 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c └── 8_voices_DAC_2 │ ├── pico-dco-dac.pio │ ├── CMakeLists.txt │ ├── pico_sdk_import.cmake │ ├── tusb_config.h │ └── usb_descriptors.c ├── TButton.h ├── TButton.cpp ├── SettingsService.h ├── MidiCC.h ├── README.md ├── SettingsService.cpp ├── Constants.h ├── EepromMgr.h ├── PatchMgr.h ├── Parameters.h ├── Settings.h └── HWControls.h /photos/synth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/synth.jpg -------------------------------------------------------------------------------- /Schematics/Noise.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/Noise.pdf -------------------------------------------------------------------------------- /Schematics/demux.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/demux.pdf -------------------------------------------------------------------------------- /Schematics/Final VCA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/Final VCA.pdf -------------------------------------------------------------------------------- /Schematics/LFO_VCA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/LFO_VCA.pdf -------------------------------------------------------------------------------- /Schematics/pico-dco-fm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/pico-dco-fm.pdf -------------------------------------------------------------------------------- /Schematics/sample_hold.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/sample_hold.pdf -------------------------------------------------------------------------------- /Schematics/teensyboard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/teensyboard.pdf -------------------------------------------------------------------------------- /photos/20230112_212233.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230112_212233.jpg -------------------------------------------------------------------------------- /photos/20230113_110707.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230113_110707.jpg -------------------------------------------------------------------------------- /photos/20230113_140341.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230113_140341.jpg -------------------------------------------------------------------------------- /photos/20230113_140354.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230113_140354.jpg -------------------------------------------------------------------------------- /photos/20230113_140404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230113_140404.jpg -------------------------------------------------------------------------------- /photos/20230115_155945.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230115_155945.jpg -------------------------------------------------------------------------------- /photos/20230115_155958.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230115_155958.jpg -------------------------------------------------------------------------------- /photos/20230119_172531.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230119_172531.jpg -------------------------------------------------------------------------------- /photos/20230120_211841.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230120_211841.jpg -------------------------------------------------------------------------------- /photos/20230121_161446.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230121_161446.jpg -------------------------------------------------------------------------------- /photos/20230121_161559.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230121_161559.jpg -------------------------------------------------------------------------------- /photos/20230121_221155.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230121_221155.jpg -------------------------------------------------------------------------------- /photos/20230122_144658.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230122_144658.jpg -------------------------------------------------------------------------------- /photos/20230122_203301.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230122_203301.jpg -------------------------------------------------------------------------------- /photos/20230123_171128.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230123_171128.jpg -------------------------------------------------------------------------------- /photos/20230123_171157.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230123_171157.jpg -------------------------------------------------------------------------------- /photos/20230123_195308.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230123_195308.jpg -------------------------------------------------------------------------------- /photos/20230123_204247.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230123_204247.jpg -------------------------------------------------------------------------------- /photos/20230123_204253.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230123_204253.jpg -------------------------------------------------------------------------------- /photos/20230124_180600.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230124_180600.jpg -------------------------------------------------------------------------------- /photos/20230124_181016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230124_181016.jpg -------------------------------------------------------------------------------- /photos/20230125_140616.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230125_140616.jpg -------------------------------------------------------------------------------- /photos/20230125_140625.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230125_140625.jpg -------------------------------------------------------------------------------- /photos/20230125_160724.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230125_160724.jpg -------------------------------------------------------------------------------- /photos/20230125_203501.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230125_203501.jpg -------------------------------------------------------------------------------- /photos/20230126_164155.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230126_164155.jpg -------------------------------------------------------------------------------- /photos/20230129_130145.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230129_130145.jpg -------------------------------------------------------------------------------- /photos/20230129_132823.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230129_132823.jpg -------------------------------------------------------------------------------- /photos/20230129_185415.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230129_185415.jpg -------------------------------------------------------------------------------- /photos/20230129_185424.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230129_185424.jpg -------------------------------------------------------------------------------- /photos/20230129_200219.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230129_200219.jpg -------------------------------------------------------------------------------- /photos/20230201_124814.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230201_124814.jpg -------------------------------------------------------------------------------- /photos/20230201_124823.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230201_124823.jpg -------------------------------------------------------------------------------- /photos/20230201_231255.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230201_231255.jpg -------------------------------------------------------------------------------- /photos/20230202_223132.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230202_223132.jpg -------------------------------------------------------------------------------- /photos/20230203_212551.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230203_212551.jpg -------------------------------------------------------------------------------- /photos/20230205_132014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230205_132014.jpg -------------------------------------------------------------------------------- /photos/20230205_132043.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/photos/20230205_132043.jpg -------------------------------------------------------------------------------- /Schematics/filter-AS3372.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/filter-AS3372.pdf -------------------------------------------------------------------------------- /Schematics/filter-control.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/filter-control.pdf -------------------------------------------------------------------------------- /Schematics/pico-dco-dac.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/pico-dco-dac.pdf -------------------------------------------------------------------------------- /Schematics/front panel pots.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/front panel pots.pdf -------------------------------------------------------------------------------- /Schematics/level conversion.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/level conversion.pdf -------------------------------------------------------------------------------- /Schematics/DCO analogue board.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/DCO analogue board.pdf -------------------------------------------------------------------------------- /Schematics/YD-pico-dco-board.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/YD-pico-dco-board.pdf -------------------------------------------------------------------------------- /Schematics/filter-pole_mixer.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/filter-pole_mixer.pdf -------------------------------------------------------------------------------- /Schematics/VCAs and Wave Converters.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/craigyjp/PolyKit-16/HEAD/Schematics/VCAs and Wave Converters.pdf -------------------------------------------------------------------------------- /name.c: -------------------------------------------------------------------------------- 1 | #include "usb_names.h" 2 | 3 | #define MIDI_NAME {'P','O','L','Y',' ','1','6'} 4 | #define MIDI_NAME_LEN 7 5 | 6 | #define MANUFACTURER_NAME {'C','r','a','i','g',' ','B','a','r','n','e','s'} 7 | #define MANUFACTURER_NAME_LEN 12 8 | 9 | struct usb_string_descriptor_struct usb_string_product_name = { 10 | 2 + MIDI_NAME_LEN * 2, 11 | 3, 12 | MIDI_NAME 13 | }; 14 | 15 | struct usb_string_descriptor_struct usb_string_manufacturer_name = { 16 | 2 + MANUFACTURER_NAME_LEN * 2, 17 | 3, 18 | MANUFACTURER_NAME 19 | }; 20 | -------------------------------------------------------------------------------- /YD_Code/8_voices_1/pico-dco.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/8_voices_2/pico-dco.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/4_voices_1/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/4_voices_2/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_1/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_2/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_1/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_2/pico-dco-dac.pio: -------------------------------------------------------------------------------- 1 | .program frequency 2 | pull noblock 3 | out y, 32 4 | 5 | .wrap_target 6 | mov x, y 7 | set pins, 1 8 | 9 | lp1: 10 | jmp x-- lp1 11 | mov x, y 12 | set pins, 0 13 | 14 | lp2: 15 | jmp x-- lp2 16 | 17 | .wrap 18 | 19 | % c-sdk { 20 | void init_sm_pin(PIO pio, uint sm, uint offset, uint pin) { 21 | pio_gpio_init(pio, pin); 22 | pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true); 23 | pio_sm_config c = frequency_program_get_default_config(offset); 24 | sm_config_set_set_pins(&c, pin, 1); 25 | pio_sm_init(pio, sm, offset, &c); 26 | } 27 | %} 28 | -------------------------------------------------------------------------------- /YD_Code/8_voices_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-lfo C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-lfo 12 | YD-dco-lfo.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-lfo ${CMAKE_CURRENT_LIST_DIR}/pico-dco.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-lfo 0) 19 | pico_enable_stdio_uart(YD-dco-lfo 1) 20 | 21 | target_include_directories(YD-dco-lfo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-lfo PRIVATE pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-lfo PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-lfo) 30 | -------------------------------------------------------------------------------- /YD_Code/8_voices_2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-lfo C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-lfo 12 | YD-dco-lfo.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-lfo ${CMAKE_CURRENT_LIST_DIR}/pico-dco.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-lfo 0) 19 | pico_enable_stdio_uart(YD-dco-lfo 1) 20 | 21 | target_include_directories(YD-dco-lfo PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-lfo PRIVATE pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-lfo PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-lfo) 30 | -------------------------------------------------------------------------------- /YD_Code/4_voices_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /YD_Code/4_voices_2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | include(pico_sdk_import.cmake) 4 | 5 | project(YD-dco-dac C CXX ASM) 6 | set(CMAKE_C_STANDARD 11) 7 | set(CMAKE_CXX_STANDARD 17) 8 | 9 | pico_sdk_init() 10 | 11 | add_executable(YD-dco-dac 12 | YD-dco-dac.c 13 | usb_descriptors.c 14 | ) 15 | 16 | pico_generate_pio_header(YD-dco-dac ${CMAKE_CURRENT_LIST_DIR}/pico-dco-dac.pio) 17 | 18 | pico_enable_stdio_usb(YD-dco-dac 0) 19 | pico_enable_stdio_uart(YD-dco-dac 1) 20 | 21 | target_include_directories(YD-dco-dac PRIVATE ${CMAKE_CURRENT_LIST_DIR}) 22 | target_link_libraries(YD-dco-dac PRIVATE hardware_spi pico_stdlib hardware_pio hardware_adc hardware_pwm tinyusb_device tinyusb_board) 23 | 24 | target_compile_definitions(YD-dco-dac PRIVATE 25 | PICO_DEFAULT_UART_TX_PIN=0 26 | PICO_DEFAULT_UART_RX_PIN=1 27 | ) 28 | 29 | pico_add_extra_outputs(YD-dco-dac) 30 | -------------------------------------------------------------------------------- /TButton.h: -------------------------------------------------------------------------------- 1 | #ifndef TButton_H 2 | #define TButton_H 3 | 4 | #include 5 | #include 6 | 7 | /** 8 | * Wrap a pin to help detect different types of button activation. 9 | * To use call update() for each loop of your program, use numClicks(), 10 | * and held() to see if there was an activation. The activation will 11 | * be cleared on the next update() call to avoid triggering multiple 12 | * times. 13 | * 14 | * The following options are provided: 15 | * pin - which pin to read, pinMode is set for this pin automatically. 16 | * activeState - This should be something like HIGH or LOW. 17 | * holdThresh - Duration in milliseconds that a button must be active to trigger held(). 18 | * debounceWindow - Duration in milliseconds to consider for debounce. 19 | * clickTime - Duration in milliseconds to check for clicks. 20 | */ 21 | class TButton 22 | { 23 | private: 24 | Bounce pin; 25 | uint32_t _holdThresh; 26 | uint32_t _clickWindow; 27 | uint8_t _pressedState; 28 | uint8_t _currentState; 29 | uint32_t _windowStartTime; 30 | uint32_t _clicks; 31 | 32 | // cached state for accessing 33 | int clicks; 34 | boolean buttonHeld; 35 | 36 | public: 37 | TButton(uint8_t pin); 38 | TButton(uint8_t pin, uint32_t activeState); 39 | TButton(uint8_t pin, uint32_t activeState, uint32_t holdThresh, uint32_t debounceWindow, uint32_t clickTime); 40 | void update(); 41 | inline int numClicks(){ return clicks; }; 42 | inline int numClicksPending(){ return _clicks; }; 43 | bool pressed(){ return _currentState == _pressedState; }; 44 | bool held(){ return buttonHeld; }; 45 | }; 46 | 47 | #endif -------------------------------------------------------------------------------- /TButton.cpp: -------------------------------------------------------------------------------- 1 | #include "TButton.h" 2 | 3 | TButton::TButton(uint8_t pin): TButton(pin, LOW) 4 | { 5 | } 6 | 7 | TButton::TButton(uint8_t pin, uint32_t activeState): TButton(pin, activeState, 1000, 20, 150) 8 | { 9 | } 10 | 11 | TButton::TButton(uint8_t pin, uint32_t activeState, uint32_t holdThresh, uint32_t debounceWindow, uint32_t clickTime): 12 | pin(pin, debounceWindow), 13 | _holdThresh(holdThresh), 14 | _clickWindow(clickTime), 15 | _pressedState(activeState), 16 | _currentState(!activeState), 17 | _windowStartTime(0), 18 | _clicks(0), 19 | clicks(0), 20 | buttonHeld(false) 21 | { 22 | pinMode(pin, INPUT); 23 | } 24 | 25 | 26 | void TButton::update() 27 | { 28 | pin.update(); 29 | uint32_t newState = pin.read(); 30 | uint32_t now = millis(); 31 | 32 | // State changed. 33 | bool changed = newState != _currentState; 34 | _currentState = newState; 35 | bool activated = this->pressed(); 36 | 37 | // make sure button held resets 38 | buttonHeld = false; 39 | 40 | // Each new activation, increment the pending _clicks + reset window. 41 | if (activated && changed) { 42 | _windowStartTime = now; 43 | _clicks++; 44 | } 45 | 46 | uint32_t dur = now - this->_windowStartTime; 47 | 48 | // Apply (or reset) clicks. 49 | if (!activated && dur > _clickWindow) { 50 | clicks = _clicks; 51 | _clicks = 0; 52 | return; 53 | } 54 | 55 | // Apply held (and reset clicks). 56 | if (activated && dur > _holdThresh) { 57 | buttonHeld = true; 58 | _clicks = 0; 59 | return; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SettingsService.h: -------------------------------------------------------------------------------- 1 | // Global settings service. 2 | // 3 | // Settings can be appended from anywhere in the code and they are displayed 4 | // as part of the menu system. Callbacks are used to manage initializing and 5 | // setting values. 6 | // 7 | // Some features which are currently planned: 8 | // - Different types of SettingsOptions. Currently there is a single "Array" 9 | // option. It would be nice to have a "text" input type which allowed for 10 | // editing text instead of selecting a value. 11 | // - Multiple menus. For example "settings" opens the current menu, the encoder 12 | // opens the patch menu, holding the encoder opens the timbre menu. 13 | 14 | #pragma once 15 | 16 | #define SETTINGSOPTIONSNO 16 //No of options 17 | #define SETTINGSVALUESNO 26 //Maximum number of settings option values needed 18 | 19 | namespace settings { 20 | 21 | //Function to handle the values for this settings option 22 | typedef void (*updater)(int index, const char* value); 23 | 24 | //Function to array index of current value for this settings option 25 | typedef int (*index)(); 26 | 27 | struct SettingsOption 28 | { 29 | const char * option;//Settings option string 30 | const char * value[SETTINGSVALUESNO];//Array of strings of settings option values 31 | updater updateHandler; 32 | index currentIndex; 33 | }; 34 | 35 | // setting names 36 | const char* current_setting(); 37 | const char* previous_setting(); 38 | const char* next_setting(); 39 | 40 | const char* previous_setting_value(); 41 | const char* next_setting_value(); 42 | 43 | const char* current_setting_value(); 44 | const char* current_setting_previous_value(); 45 | const char* current_setting_next_value(); 46 | 47 | void increment_setting(); 48 | void decrement_setting(); 49 | 50 | void increment_setting_value(); 51 | void decrement_setting_value(); 52 | 53 | void save_current_value(); 54 | 55 | void append(SettingsOption option); 56 | void reset(); 57 | 58 | } -------------------------------------------------------------------------------- /MidiCC.h: -------------------------------------------------------------------------------- 1 | //MIDI CC control numbers 2 | //These broadly follow standard CC assignments 3 | #define CCmodwheel 1 //pitch LFO amount - less from mod wheel 4 | #define CCLfoDepth 3 //pitch LFO amount - panel control 5 | #define CCglideTime 5 6 | #define CCvolumeControl 7 7 | 8 | #define CCamDepth 11 9 | #define CCstack 12 10 | #define CCchorus1 13 11 | #define CCchorus2 14 12 | #define CCfmDepth 15 13 | #define CCosc1PW 16 14 | #define CCosc2PW 17 15 | #define CCosc1PWM 18 16 | #define CCosc2PWM 19 17 | 18 | #define CCvcaGate 21 19 | #define CCfilterLFO 22 20 | #define CCnoiseLevel 23 21 | #define CCfilterPoleSW 24 22 | #define CCkeyTrack 30 23 | #define CCupperSW 31 24 | #define CCwholemode 32 25 | #define CCdualmode 33 26 | #define CCsplitmode 34 27 | #define CCmonoMulti 37 28 | #define CCkeyTrackSW 38 29 | #define CCfilterType 39 30 | #define CCvcaDoubleLoop 40 31 | #define CCvcaLoop 41 32 | #define CCvcaVel 42 33 | #define CCfilterVel 43 34 | #define CCfilterRelease 44 35 | #define CCfilterAttack 45 36 | #define CCfilterSustain 46 37 | #define CCfilterDecay 47 38 | #define CCfilterLevel 48 39 | #define CCfilterEGinv 50 40 | #define CCfilterDoubleLoop 51 41 | #define CCfilterLoop 52 42 | #define CCfilterEGlevel 53 43 | #define CCosc1Range 55 44 | #define CCosc2Range 54 45 | #define CCampRelease 57 46 | #define CCampAttack 58 47 | #define CCampSustain 59 48 | #define CCampDecay 60 49 | #define CCosc2TriangleLevel 61 50 | #define CCosc1SubLevel 62 51 | #define CCLFODelay 63 52 | #define CCglideSW 65 53 | #define CCMWDepth 67 54 | #define CCAmpvelo 68 55 | #define CCosc2Detune 71 56 | #define CCfilterCutoff 74 57 | #define CClfoAlt 76 58 | #define CCLFORate 77 59 | #define CCosc1PulseLevel 80 60 | #define CCosc1SawLevel 81 61 | #define CCpwLFO 90 62 | #define CCLFOWaveform 91 63 | #define CCfilterRes 94 64 | #define CCosc2PulseLevel 102 65 | #define CCosc2SawLevel 103 66 | #define CCallnotesoff 123//Panic button 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PolyKit-16-polyphonic-synthesizer 2 | 3 | Based on the PolyKit DCO and PolyKit-x-voice board projects by PolyKit (Jan Knipper). This design takes Jan's work and expands it into a fully programmable 16 voice DCO based synthesizer. 4 | 5 | ![Synth](photos/synth.jpg) 6 | 7 | The synth is comparable to a dual Juno 106 combined with a Crumar Bit 01 rack unit but with full control. 8 | 9 | This repository contains my versions of the filter/adsr/lfo with added velocity, keytracking and additional 8 filter configurations and programmer section for the Polykit 16. 10 | 11 | 12 | ## Key features 13 | 14 | - Digitally controlled oscillators similar in design to the Roland Juno series using dual Raspberry Pi Pico's. 15 | - Dual DCO with Sawtooth, PWM, SUB oscillator & Triangle waveforms individual mixing of each. 16 | - Digital Noise source for White or Pink noise mix. 17 | - Multipole filters based on the Oberheim Matrix 12. 18 | - Dual LFOs for PWM and main synth, main LFO 16 waveforms, PWM LFO Sinewave only. 19 | - 16 voice polyphonic dual DCOs per voice. 20 | - Whole, Dual and Split modes of operation 21 | - Aftertouch control over DCO LFO depth, AM Depth, filter LFO depth or filter cutoff. 22 | - Log and lin envelopes. 23 | - Gated or LFO Looping envelopes. 24 | - Velocity sensitivity for filters and amplifiers. 25 | - Analogue chorus similar to Juno 60. 26 | - 999 memory locations to store patches. 27 | - 128 Performance patches 28 | - MIDI in/out/thru - channels 1-16 29 | - USB MIDI 30 | 31 | - How it sounds... 32 | 33 | [https://youtu.be/yFFuoJo9930](https://youtu.be/pIsAd5T5sVk) 34 | 35 | ## Things to fix/improve 36 | 37 | - Initial startup can cause issues in stack more and 32 foot mode, need to fix 38 | - DCO1 and DCO1 are the wrong way around. 39 | - Additional poly mode (POLY 2) available by press and holding the WHOLE button 40 | 41 | ## The source of the inspiration for these modifications and acknowledgements 42 | 43 | Polykit, also known as Jan Knipper 44 | 45 | https://github.com/polykit/pico-dco 46 | 47 | This is how it sounds: [Ramp sample](https://soundcloud.com/polykit/pico-dco-ramp) [Pulse sample](https://soundcloud.com/polykit/pico-dco-pulse) [Polyphonic sample](https://soundcloud.com/polykit/pico-dco-polyphonic) 48 | 49 | Freddie Renyard for his coding of the FM inputs and patience with me whilst I debugged the voice sync of two boards together. 50 | 51 | https://github.com/freddie-renyard 52 | 53 | ## Component sections used to build the final synth 54 | 55 | https://github.com/craigyjp/pico-dco 56 | 57 | https://github.com/craigyjp/Pico-DCO-DAC 58 | 59 | TC Electronics June-60 Chorus V2 60 | -------------------------------------------------------------------------------- /YD_Code/4_voices_1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/4_voices_2/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/8_voices_1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/8_voices_2/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_2/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_1/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_2/pico_sdk_import.cmake: -------------------------------------------------------------------------------- 1 | # This is a copy of /external/pico_sdk_import.cmake 2 | 3 | # This can be dropped into an external project to help locate this SDK 4 | # It should be include()ed prior to project() 5 | 6 | if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH)) 7 | set(PICO_SDK_PATH $ENV{PICO_SDK_PATH}) 8 | message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')") 9 | endif () 10 | 11 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT)) 12 | set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT}) 13 | message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')") 14 | endif () 15 | 16 | if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH)) 17 | set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH}) 18 | message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')") 19 | endif () 20 | 21 | set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the PICO SDK") 22 | set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of PICO SDK from git if not otherwise locatable") 23 | set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK") 24 | 25 | if (NOT PICO_SDK_PATH) 26 | if (PICO_SDK_FETCH_FROM_GIT) 27 | include(FetchContent) 28 | set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR}) 29 | if (PICO_SDK_FETCH_FROM_GIT_PATH) 30 | get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") 31 | endif () 32 | FetchContent_Declare( 33 | pico_sdk 34 | GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk 35 | GIT_TAG master 36 | ) 37 | if (NOT pico_sdk) 38 | message("Downloading PICO SDK") 39 | FetchContent_Populate(pico_sdk) 40 | set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR}) 41 | endif () 42 | set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE}) 43 | else () 44 | message(FATAL_ERROR 45 | "PICO SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git." 46 | ) 47 | endif () 48 | endif () 49 | 50 | get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") 51 | if (NOT EXISTS ${PICO_SDK_PATH}) 52 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found") 53 | endif () 54 | 55 | set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake) 56 | if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE}) 57 | message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the PICO SDK") 58 | endif () 59 | 60 | set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the PICO SDK" FORCE) 61 | 62 | include(${PICO_SDK_INIT_CMAKE_FILE}) 63 | -------------------------------------------------------------------------------- /YD_Code/4_voices_1/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/4_voices_2/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/8_voices_1/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/8_voices_2/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_1/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/4_voices_DAC_2/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_1/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /YD_Code/8_voices_DAC_2/tusb_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #ifndef _TUSB_CONFIG_H_ 27 | #define _TUSB_CONFIG_H_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | //-------------------------------------------------------------------- 34 | // COMMON CONFIGURATION 35 | //-------------------------------------------------------------------- 36 | 37 | // defined by compiler flags for flexibility 38 | #ifndef CFG_TUSB_MCU 39 | #error CFG_TUSB_MCU must be defined 40 | #endif 41 | 42 | #if CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \ 43 | CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56 44 | #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED) 45 | #else 46 | #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE 47 | #endif 48 | 49 | #ifndef CFG_TUSB_OS 50 | #define CFG_TUSB_OS OPT_OS_PICO 51 | #endif 52 | 53 | // CFG_TUSB_DEBUG is defined by compiler in DEBUG build 54 | // #define CFG_TUSB_DEBUG 0 55 | 56 | /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 57 | * Tinyusb use follows macros to declare transferring memory so that they can be put 58 | * into those specific section. 59 | * e.g 60 | * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 61 | * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 62 | */ 63 | #ifndef CFG_TUSB_MEM_SECTION 64 | #define CFG_TUSB_MEM_SECTION 65 | #endif 66 | 67 | #ifndef CFG_TUSB_MEM_ALIGN 68 | #define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) 69 | #endif 70 | 71 | //-------------------------------------------------------------------- 72 | // DEVICE CONFIGURATION 73 | //-------------------------------------------------------------------- 74 | 75 | #ifndef CFG_TUD_ENDPOINT0_SIZE 76 | #define CFG_TUD_ENDPOINT0_SIZE 64 77 | #endif 78 | 79 | //------------- CLASS -------------// 80 | #define CFG_TUD_CDC 0 81 | #define CFG_TUD_MSC 0 82 | #define CFG_TUD_HID 0 83 | #define CFG_TUD_MIDI 1 84 | #define CFG_TUD_VENDOR 0 85 | 86 | // MIDI FIFO size of TX and RX 87 | #define CFG_TUD_MIDI_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 88 | #define CFG_TUD_MIDI_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* _TUSB_CONFIG_H_ */ 95 | -------------------------------------------------------------------------------- /SettingsService.cpp: -------------------------------------------------------------------------------- 1 | #include "SettingsService.h" 2 | #include 3 | #include 4 | 5 | // global settings buffer 6 | std::vector settingsOptions; 7 | //CircularBuffer settingsOptions; 8 | 9 | // currently selected settings option value index 10 | int selectedSettingIndex = 0; 11 | int selectedSettingValueIndex = 0; 12 | 13 | // Helpers 14 | 15 | int currentSettingIndex() { 16 | return selectedSettingIndex; 17 | } 18 | 19 | int nextSettingIndex() { 20 | return (selectedSettingIndex + 1) % settingsOptions.size(); 21 | } 22 | 23 | int prevSettingIndex() { 24 | if (selectedSettingIndex == 0) { 25 | return settingsOptions.size() - 1; 26 | } 27 | return selectedSettingIndex - 1; 28 | } 29 | 30 | void refresh_current_value_index() { 31 | selectedSettingValueIndex = settingsOptions[currentSettingIndex()].currentIndex(); 32 | } 33 | 34 | // Add new option 35 | 36 | void settings::append(SettingsOption option) { 37 | settingsOptions.push_back(option); 38 | 39 | if (settingsOptions.size() == 1) { 40 | selectedSettingIndex = 0; 41 | refresh_current_value_index(); 42 | } 43 | } 44 | 45 | void settings::reset() { 46 | settingsOptions.clear(); 47 | } 48 | 49 | // Setting names 50 | 51 | const char* settings::current_setting() { 52 | return settingsOptions[currentSettingIndex()].option; 53 | } 54 | 55 | const char* settings::previous_setting() { 56 | return settingsOptions[prevSettingIndex()].option; 57 | } 58 | 59 | const char* settings::next_setting() { 60 | return settingsOptions[nextSettingIndex()].option; 61 | } 62 | 63 | // Values 64 | 65 | const char* settings::previous_setting_value() { 66 | return settingsOptions[prevSettingIndex()].value[settingsOptions[prevSettingIndex()].currentIndex()]; 67 | } 68 | const char* settings::next_setting_value() { 69 | return settingsOptions[nextSettingIndex()].value[settingsOptions[nextSettingIndex()].currentIndex()]; 70 | } 71 | 72 | const char* settings::current_setting_value() { 73 | return settingsOptions[currentSettingIndex()].value[selectedSettingValueIndex]; 74 | } 75 | 76 | const char* settings::current_setting_previous_value() { 77 | if (selectedSettingValueIndex == 0) { 78 | return ""; 79 | } 80 | return settingsOptions[currentSettingIndex()].value[selectedSettingValueIndex - 1]; 81 | } 82 | 83 | const char* settings::current_setting_next_value() { 84 | if (settingsOptions[currentSettingIndex()].value[selectedSettingValueIndex + 1][0] == '\0') { 85 | return ""; 86 | } 87 | return settingsOptions[currentSettingIndex()].value[selectedSettingValueIndex - 1]; 88 | } 89 | 90 | // Change settings 91 | 92 | void settings::increment_setting() { 93 | selectedSettingIndex = nextSettingIndex(); 94 | refresh_current_value_index(); 95 | } 96 | 97 | void settings::decrement_setting() { 98 | selectedSettingIndex = prevSettingIndex(); 99 | refresh_current_value_index(); 100 | } 101 | 102 | // Change setting values 103 | 104 | void settings::increment_setting_value() { 105 | if (settingsOptions[currentSettingIndex()].value[selectedSettingValueIndex + 1][0] == '\0') { 106 | return; 107 | } 108 | selectedSettingValueIndex++; 109 | } 110 | 111 | void settings::decrement_setting_value() { 112 | if (selectedSettingValueIndex == 0) { 113 | return; 114 | } 115 | selectedSettingValueIndex--; 116 | } 117 | 118 | void settings::save_current_value() { 119 | settingsOptions[currentSettingIndex()].updateHandler(selectedSettingValueIndex, current_setting_value()); 120 | } -------------------------------------------------------------------------------- /Constants.h: -------------------------------------------------------------------------------- 1 | const char* VERSION = "V1.9"; 2 | const float FILTERCUTOFF[128] = {20, 23, 26, 29, 32, 36, 40, 46, 53, 60, 69, 78, 87, 98, 109, 120, 132, 145, 157, 171, 186, 200, 215, 231, 247, 264, 282, 300, 319, 338, 357, 378, 399, 421, 444, 467, 491, 516, 541, 567, 594, 621, 650, 680, 710, 741, 774, 806, 841, 876, 912, 949, 987, 1027, 1068, 1110, 1152, 1196, 1242, 1290, 1338, 1388, 1439, 1491, 1547, 1603, 1661, 1723, 1783, 1843, 1915, 1975, 2047, 2119, 2191, 2263, 2347, 2419, 2503, 2587, 2683, 2767, 2863, 2959, 3055, 3163, 3259, 3367, 3487, 3595, 3715, 3835, 3967, 4099, 4231, 4363, 4507, 4663, 4807, 4963, 5131, 5287, 5467, 5635, 5815, 6007, 6199, 6403, 6607, 6823, 7039, 7267, 7495, 7735, 7987, 8239, 8503, 8779, 9055, 9343, 9643, 9955, 10267, 10603, 10939, 11287, 11647, 12000}; 3 | const float ENVTIMES[128] = {1, 2, 4, 6, 9, 14, 20, 26, 33, 41, 49, 58, 67, 78, 89, 99, 111, 124, 136, 150, 164, 178, 192, 209, 224, 241, 258, 276, 295, 314, 333, 353, 374, 395, 418, 440, 464, 489, 513, 539, 565, 592, 621, 650, 680, 710, 742, 774, 808, 843, 878, 915, 952, 991, 1031, 1073, 1114, 1158, 1202, 1250, 1297, 1346, 1396, 1448, 1502, 1558, 1614, 1676, 1735, 1794, 1864, 1923, 1994, 2065, 2136, 2207, 2289, 2360, 2443, 2525, 2620, 2702, 2797, 2891, 2985, 3092, 3186, 3292, 3410, 3516, 3634, 3752, 3882, 4012, 4142, 4272, 4413, 4567, 4708, 4862, 5027, 5180, 5357, 5522, 5699, 5888, 6077, 6278, 6478, 6691, 6903, 7127, 7351, 7587, 7835, 8083, 8343, 8614, 8885, 9169, 9464, 9770, 10077, 10408, 10738, 11080, 11434, 11700}; 4 | const float LFOTEMPO[128] = {0.050, 0.050, 0.055, 0.055, 0.060, 0.064, 0.064, 0.069, 0.072, 0.077, 0.077, 0.081, 0.080, 0.087, 0.087, 0.092, 0.100, 0.100, 0.100, 0.104, 0.109, 0.115, 0.115, 0.122, 0.130, 0.130, 0.139, 0.149, 0.160, 0.160, 0.172, 0.185, 0.196, 0.20, 0.20, 0.21, 0.22, 0.24, 0.24, 0.26, 0.27, 0.29, 0.29, 0.31, 0.34, 0.37, 0.37, 0.39, 0.4, 0.40, 0.42, 0.45, 0.47, 0.47, 0.50, 0.53, 0.57, 0.57, 0.6, 0.62, 0.62, 0.65, 0.69, 0.74, 0.74, 0.80, 0.80, 0.86, 0.86, 0.94, 1.00, 1.00, 1.10, 1.12, 1.14, 1.14, 1.17, 1.20, 1.30, 1.40, 1.50, 1.50, 1.60, 1.60, 1.7, 1.8, 1.9, 2.0, 2.2, 2.2, 2.4, 2.6, 2.8, 3.00, 3.00, 3.1, 3.2, 3.2, 3.4, 3.80, 3.80, 4.10, 4.40, 4.70, 4.70, 5.00, 5.40, 5.80, 6.00, 6.00, 6.20, 6.40, 6.40, 6.80, 6.80, 7.30, 7.60, 8.00, 8.60, 9.30, 9.90, 10.60, 10.60, 11.50, 12.20, 12.80, 12.80, 12.80}; 5 | const float PITCHBEND[128] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}; 6 | const float LINEAR[128] = {0, 0.008, 0.016, 0.024, 0.031, 0.039, 0.047, 0.055, 0.063, 0.071, 0.079, 0.087, 0.094, 0.102, 0.11, 0.118, 0.126, 0.134, 0.142, 0.15, 0.157, 0.165, 0.173, 0.181, 0.189, 0.197, 0.205, 0.213, 0.22, 0.228, 0.236, 0.244, 0.252, 0.26, 0.268, 0.276, 0.283, 0.291, 0.299, 0.307, 0.315, 0.323, 0.331, 0.339, 0.346, 0.354, 0.362, 0.37, 0.378, 0.386, 0.394, 0.402, 0.409, 0.417, 0.425, 0.433, 0.441, 0.449, 0.457, 0.465, 0.472, 0.48, 0.488, 0.496, 0.504, 0.512, 0.52, 0.528, 0.535, 0.543, 0.551, 0.559, 0.567, 0.575, 0.583, 0.591, 0.598, 0.606, 0.614, 0.622, 0.63, 0.638, 0.646, 0.654, 0.661, 0.669, 0.677, 0.685, 0.693, 0.701, 0.709, 0.717, 0.724, 0.732, 0.74, 0.748, 0.756, 0.764, 0.772, 0.78, 0.787, 0.795, 0.803, 0.811, 0.819, 0.827, 0.835, 0.843, 0.85, 0.858, 0.866, 0.874, 0.882, 0.89, 0.898, 0.906, 0.913, 0.921, 0.929, 0.937, 0.945, 0.953, 0.961, 0.969, 0.976, 0.984, 0.992, 1.00}; 7 | const float LINEARCENTREZERO[128] = { -1, -0.98, -0.97, -0.95, -0.93, -0.92, -0.9, -0.88, -0.87, -0.85, -0.83, -0.82, -0.8, -0.78, -0.77, -0.75, -0.73, -0.72, -0.7, -0.68, -0.67, -0.65, -0.63, -0.62, -0.6, -0.58, -0.57, -0.55, -0.53, -0.52, -0.5, -0.48, -0.47, -0.45, -0.43, -0.42, -0.4, -0.38, -0.37, -0.35, -0.33, -0.32, -0.3, -0.28, -0.27, -0.25, -0.23, -0.22, -0.2, -0.18, -0.17, -0.15, -0.13, -0.12, -0.1, -0.08, -0.07, -0.05, -0.03, -0.02, -0.01, 0, 0, 0, 0, 0, 0, 0.01, 0.02, 0.03, 0.05, 0.07, 0.08, 0.1, 0.12, 0.13, 0.15, 0.17, 0.18, 0.2, 0.22, 0.23, 0.25, 0.27, 0.28, 0.3, 0.32, 0.33, 0.35, 0.37, 0.38, 0.4, 0.42, 0.43, 0.45, 0.47, 0.48, 0.5, 0.52, 0.53, 0.55, 0.57, 0.58, 0.6, 0.62, 0.63, 0.65, 0.67, 0.68, 0.7, 0.72, 0.73, 0.75, 0.77, 0.78, 0.8, 0.82, 0.83, 0.85, 0.87, 0.88, 0.9, 0.92, 0.93, 0.95, 0.97, 0.98, 1}; 8 | const int LINEAR_FILTERMIXERSTR[128] = {0, 1, 2, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24, 24, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, 46, 46, 47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 61, 61, 62, 63, 64, 65, 65, 66, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 76, 76, 77, 78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 100}; 9 | const float PULSEWIDTH[128] = {0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50}; 10 | #define RE_READ -9 11 | #define NO_OF_VOICES 8 12 | #define NO_OF_PARAMS 70 13 | const char* INITPATCHNAME = "Initial Patch"; 14 | #define INITPERFORMANCENAME "New Perf" 15 | #define HOLD_DURATION 1000 16 | const uint32_t CLICK_DURATION = 250; 17 | #define PATCHES_LIMIT 999 18 | #define PERFORMANCE_LIMIT 128 19 | 20 | const String INITPATCH = "Solina,1,1,1,1,1,1,1,1,1,10,1,1,1,1,1,1,1,1,1,10,1,1,1,1,1,1,1,1,1,10,1,1,1,1,1,1,1,1,1,10,1,1,1,1,1,1,1"; 21 | -------------------------------------------------------------------------------- /EepromMgr.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define EEPROM_MIDI_CH 0 4 | #define EEPROM_SPLITTRANS 1 5 | #define EEPROM_ENCODER_DIR 2 6 | #define EEPROM_MODWHEEL_DEPTH 3 7 | #define EEPROM_FILTERENV_U 4 8 | #define EEPROM_FILTERENV_L 5 9 | #define EEPROM_AMPENV_U 6 10 | #define EEPROM_AMPENV_L 7 11 | #define EEPROM_LAST_PATCHU 8 12 | #define EEPROM_LAST_PATCHL 9 13 | #define EEPROM_AFTERTOUCH_U 10 14 | #define EEPROM_AFTERTOUCH_L 11 15 | #define EEPROM_SPLITPOINT 12 16 | #define EEPROM_KEYTRACK_U 13 17 | #define EEPROM_KEYTRACK_L 14 18 | #define EEPROM_PITCHBEND 15 19 | #define EEPROM_MONOMULTI_L 16 20 | #define EEPROM_MONOMULTI_U 17 21 | 22 | int getMIDIChannel() { 23 | byte midiChannel = EEPROM.read(EEPROM_MIDI_CH); 24 | if (midiChannel < 0 || midiChannel > 16) midiChannel = MIDI_CHANNEL_OMNI; //If EEPROM has no MIDI channel stored 25 | return midiChannel; 26 | } 27 | 28 | void storeMidiChannel(byte channel) { 29 | EEPROM.update(EEPROM_MIDI_CH, channel); 30 | } 31 | 32 | float getSplitPoint() { 33 | byte sp = EEPROM.read(EEPROM_SPLITPOINT); 34 | if (sp < 0 || sp > 24) sp = 12; 35 | return sp; 36 | } 37 | 38 | void storeSplitPoint(byte type) { 39 | EEPROM.update(EEPROM_SPLITPOINT, type); 40 | } 41 | 42 | float getSplitTrans() { 43 | int st = EEPROM.read(EEPROM_SPLITTRANS); 44 | if (st < 0 || st > 4) st = 2; 45 | return st; //If EEPROM has no key tracking stored 46 | } 47 | 48 | void storeSplitTrans(byte type) { 49 | EEPROM.update(EEPROM_SPLITTRANS, type); 50 | } 51 | 52 | boolean getMonoMultiL() { 53 | byte monoMultiL = EEPROM.read(EEPROM_MONOMULTI_L); 54 | if (monoMultiL < 0 || monoMultiL > 1) return true; 55 | return monoMultiL == 0 ? false : true; 56 | } 57 | 58 | void storeMonoMultiL(byte monoMultiL) { 59 | EEPROM.update(EEPROM_MONOMULTI_L, monoMultiL); 60 | } 61 | 62 | boolean getMonoMultiU() { 63 | byte monoMultiU = EEPROM.read(EEPROM_MONOMULTI_U); 64 | if (monoMultiU < 0 || monoMultiU > 1) return true; 65 | return monoMultiU == 0 ? false : true; 66 | } 67 | 68 | void storeMonoMultiU(byte monoMultiU) { 69 | EEPROM.update(EEPROM_MONOMULTI_U, monoMultiU); 70 | } 71 | 72 | float getAfterTouchU() { 73 | byte AfterTouchDestU = EEPROM.read(EEPROM_AFTERTOUCH_U); 74 | if (AfterTouchDestU < 0 || AfterTouchDestU > 4) AfterTouchDestU = 0; 75 | return AfterTouchDestU; //If EEPROM has no key tracking stored 76 | } 77 | 78 | void storeAfterTouchU(byte AfterTouchDestU) { 79 | EEPROM.update(EEPROM_AFTERTOUCH_U, AfterTouchDestU); 80 | } 81 | 82 | float getAfterTouchL() { 83 | byte AfterTouchDestL = EEPROM.read(EEPROM_AFTERTOUCH_L); 84 | if (AfterTouchDestL < 0 || AfterTouchDestL > 4) AfterTouchDestL = 0; 85 | return AfterTouchDestL; //If EEPROM has no key tracking stored 86 | } 87 | 88 | void storeAfterTouchL(byte AfterTouchDestL) { 89 | EEPROM.update(EEPROM_AFTERTOUCH_L, AfterTouchDestL); 90 | } 91 | 92 | int getPitchBendRange() { 93 | byte pitchBendRange = EEPROM.read(EEPROM_PITCHBEND); 94 | if (pitchBendRange < 1 || pitchBendRange > 12) pitchBendRange = 12; //If EEPROM has no pitchbend stored 95 | return pitchBendRange; 96 | } 97 | 98 | void storePitchBendRange(byte pitchBendRange) { 99 | EEPROM.update(EEPROM_PITCHBEND, pitchBendRange); 100 | } 101 | 102 | float getModWheelDepth() { 103 | int mw = EEPROM.read(EEPROM_MODWHEEL_DEPTH); 104 | if (mw < 1 || mw > 10) return modWheelDepth; //If EEPROM has no mod wheel depth stored 105 | return mw; 106 | } 107 | 108 | void storeModWheelDepth(float mwDepth) { 109 | int mw = mwDepth; 110 | EEPROM.update(EEPROM_MODWHEEL_DEPTH, mw); 111 | } 112 | 113 | boolean getEncoderDir() { 114 | byte ed = EEPROM.read(EEPROM_ENCODER_DIR); 115 | if (ed < 0 || ed > 1) return true; //If EEPROM has no encoder direction stored 116 | return ed == 1 ? true : false; 117 | } 118 | 119 | void storeEncoderDir(byte encoderDir) { 120 | EEPROM.update(EEPROM_ENCODER_DIR, encoderDir); 121 | } 122 | 123 | boolean getFilterEnvU() { 124 | byte fenv = EEPROM.read(EEPROM_FILTERENV_U); 125 | if (fenv < 0 || fenv > 1) return true; 126 | return fenv == 0 ? false : true; 127 | } 128 | 129 | boolean getFilterEnvL() { 130 | byte fenv = EEPROM.read(EEPROM_FILTERENV_L); 131 | if (fenv < 0 || fenv > 1) return true; 132 | return fenv == 0 ? false : true; 133 | } 134 | 135 | void storeFilterEnvU(byte filterLogLinU) { 136 | EEPROM.update(EEPROM_FILTERENV_U, filterLogLinU); 137 | } 138 | 139 | void storeFilterEnvL(byte filterLogLinL) { 140 | EEPROM.update(EEPROM_FILTERENV_L, filterLogLinL); 141 | } 142 | 143 | boolean getAmpEnvU() { 144 | byte aenv = EEPROM.read(EEPROM_AMPENV_U); 145 | if (aenv < 0 || aenv > 1) return true; 146 | return aenv == 0 ? false : true; 147 | } 148 | 149 | boolean getAmpEnvL() { 150 | byte aenv = EEPROM.read(EEPROM_AMPENV_L); 151 | if (aenv < 0 || aenv > 1) return true; 152 | return aenv == 0 ? false : true; 153 | } 154 | 155 | void storeAmpEnvU(byte ampLogLinU) { 156 | EEPROM.update(EEPROM_AMPENV_U, ampLogLinU); 157 | } 158 | 159 | void storeAmpEnvL(byte ampLogLinL) { 160 | EEPROM.update(EEPROM_AMPENV_L, ampLogLinL); 161 | } 162 | 163 | boolean getKeyTrackU() { 164 | byte keyTrackSWU = EEPROM.read(EEPROM_KEYTRACK_U); 165 | if (keyTrackSWU < 0 || keyTrackSWU > 1) return true; 166 | return keyTrackSWU == 0 ? false : true; 167 | } 168 | 169 | boolean getKeyTrackL() { 170 | byte keyTrackSWL = EEPROM.read(EEPROM_KEYTRACK_L); 171 | if (keyTrackSWL < 0 || keyTrackSWL > 1) return true; 172 | return keyTrackSWL == 0 ? false : true; 173 | } 174 | 175 | void storeKeyTrackU(byte keyTrackSWU) { 176 | EEPROM.update(EEPROM_KEYTRACK_U, keyTrackSWU); 177 | } 178 | 179 | void storeKeyTrackL(byte keyTrackSWL) { 180 | EEPROM.update(EEPROM_KEYTRACK_L, keyTrackSWL); 181 | } 182 | 183 | int getLastPatchU() { 184 | int lastPatchNumberU = EEPROM.read(EEPROM_LAST_PATCHU); 185 | if (lastPatchNumberU < 1 || lastPatchNumberU > 999) lastPatchNumberU = 1; 186 | return lastPatchNumberU; 187 | } 188 | 189 | int getLastPatchL() { 190 | int lastPatchNumberL = EEPROM.read(EEPROM_LAST_PATCHL); 191 | if (lastPatchNumberL < 1 || lastPatchNumberL > 999) lastPatchNumberL = 1; 192 | return lastPatchNumberL; 193 | } 194 | 195 | void storeLastPatchU(int lastPatchNumber) { 196 | EEPROM.update(EEPROM_LAST_PATCHU, lastPatchNumber); 197 | } 198 | 199 | void storeLastPatchL(int lastPatchNumber) { 200 | EEPROM.update(EEPROM_LAST_PATCHL, lastPatchNumber); 201 | } 202 | -------------------------------------------------------------------------------- /PatchMgr.h: -------------------------------------------------------------------------------- 1 | /* 2 | TSynth patch saving and recall works like an analogue polysynth from the late 70s (Prophet 5). 3 | When you recall a patch, all the front panel controls will be different values from those saved in the patch. Moving them will cause a jump to the current value. 4 | 5 | BACK 6 | Cancels current mode such as save, recall, delete and rename patches 7 | 8 | RECALL 9 | Recall shows list of patches. Use encoder to move through list. 10 | Enter button on encoder chooses highlighted patch or press Recall again. 11 | Recall also recalls the current patch settings if the panel controls have been altered. 12 | Holding Recall for 1.5s will initialise the synth with all the current panel control settings - the synth sounds the same as the controls are set. 13 | 14 | 15 | SAVE 16 | Save will save the current settings to a new patch at the end of the list or you can use the encoder to overwrite an existing patch. 17 | Press Save again to save it. If you want to name/rename the patch, press the encoder enter button and use the encoder and enter button to choose an alphanumeric name. 18 | Holding Save for 1.5s will go into a patch deletion mode. Use encoder and enter button to choose and delete patch. Patch numbers will be changed on the SD card to be consecutive again. 19 | */ 20 | //Agileware CircularBuffer available in libraries manager 21 | #include 22 | 23 | #define TOTALCHARS 63 24 | 25 | const char CHARACTERS[TOTALCHARS] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; 26 | int charIndex = 0; 27 | char currentCharacter = 0; 28 | String renamedPatch = ""; 29 | int upperPatchIndex = 0; 30 | int lowerPatchIndex = 0; 31 | 32 | struct PatchNoAndName 33 | { 34 | int patchNo; 35 | String patchName; 36 | }; 37 | 38 | CircularBuffer patches; 39 | 40 | size_t readField(File *file, char *str, size_t size, const char *delim) 41 | { 42 | char ch; 43 | size_t n = 0; 44 | while ((n + 1) < size && file->read(&ch, 1) == 1) 45 | { 46 | // Delete CR. 47 | if (ch == '\r') 48 | { 49 | continue; 50 | } 51 | str[n++] = ch; 52 | if (strchr(delim, ch)) 53 | { 54 | break; 55 | } 56 | } 57 | str[n] = '\0'; 58 | return n; 59 | } 60 | 61 | void recallPatchData(File patchFile, String data[]) 62 | { 63 | //Read patch data from file and set current patch parameters 64 | size_t n; // Length of returned field with delimiter. 65 | char str[20]; // Must hold longest field with delimiter and zero byte. 66 | int i = 0; 67 | while (patchFile.available() && i < NO_OF_PARAMS) 68 | { 69 | n = readField(&patchFile, str, sizeof(str), ",\n"); 70 | // done if Error or at EOF. 71 | if (n == 0) 72 | break; 73 | // Print the type of delimiter. 74 | if (str[n - 1] == ',' || str[n - 1] == '\n') 75 | { 76 | // Remove the delimiter. 77 | str[n - 1] = 0; 78 | } 79 | else 80 | { 81 | // At eof, too long, or read error. Too long is error. 82 | Serial.print(patchFile.available() ? F("error: ") : F("eof: ")); 83 | } 84 | // Print the field. 85 | // Serial.print(i); 86 | // Serial.print(" - "); 87 | // Serial.println(str); 88 | data[i++] = String(str); 89 | } 90 | } 91 | 92 | int compare(const void *a, const void *b) { 93 | return ((PatchNoAndName*)a)->patchNo - ((PatchNoAndName*)b)->patchNo; 94 | } 95 | 96 | void sortPatches() 97 | { 98 | int arraySize = patches.size(); 99 | //Sort patches buffer to be consecutive ascending patchNo order 100 | struct PatchNoAndName arrayToSort[arraySize]; 101 | 102 | for (int i = 0; i < arraySize; ++i) 103 | { 104 | arrayToSort[i] = patches[i]; 105 | } 106 | qsort(arrayToSort, arraySize, sizeof(PatchNoAndName), compare); 107 | patches.clear(); 108 | 109 | for (int i = 0; i < arraySize; ++i) 110 | { 111 | patches.push(arrayToSort[i]); 112 | } 113 | } 114 | 115 | void loadPatches() 116 | { 117 | File file = SD.open("/"); 118 | patches.clear(); 119 | while (true) 120 | { 121 | String data[NO_OF_PARAMS]; //Array of data read in 122 | File patchFile = file.openNextFile(); 123 | if (!patchFile) 124 | { 125 | break; 126 | } 127 | if (patchFile.isDirectory()) 128 | { 129 | Serial.println("Ignoring Dir"); 130 | } 131 | else 132 | { 133 | recallPatchData(patchFile, data); 134 | patches.push(PatchNoAndName{atoi(patchFile.name()), data[0]}); 135 | Serial.println(String(patchFile.name()) + ":" + data[0]); 136 | } 137 | patchFile.close(); 138 | } 139 | sortPatches(); 140 | } 141 | 142 | void savePatch(const char *patchNo, String patchData) 143 | { 144 | // Serial.print("savePatch Patch No:"); 145 | // Serial.println(patchNo); 146 | //Overwrite existing patch by deleting 147 | if (SD.exists(patchNo)) 148 | { 149 | SD.remove(patchNo); 150 | } 151 | File patchFile = SD.open(patchNo, FILE_WRITE); 152 | if (patchFile) 153 | { 154 | // Serial.print("Writing Patch No:"); 155 | // Serial.println(patchNo); 156 | //Serial.println(patchData); 157 | patchFile.println(patchData); 158 | patchFile.close(); 159 | } 160 | else 161 | { 162 | Serial.print("Error writing Patch file:"); 163 | Serial.println(patchNo); 164 | } 165 | } 166 | 167 | void savePatch(const char *patchNo, String patchData[]) 168 | { 169 | String dataString = patchData[0]; 170 | for (int i = 1; i < NO_OF_PARAMS; i++) 171 | { 172 | dataString = dataString + "," + patchData[i]; 173 | } 174 | savePatch(patchNo, dataString); 175 | } 176 | 177 | void deletePatch(const char *patchNo) 178 | { 179 | if (SD.exists(patchNo)) SD.remove(patchNo); 180 | } 181 | 182 | void renumberPatchesOnSD() { 183 | for (int i = 0; i < patches.size(); i++) 184 | { 185 | String data[NO_OF_PARAMS]; //Array of data read in 186 | File file = SD.open(String(patches[i].patchNo).c_str()); 187 | if (file) { 188 | recallPatchData(file, data); 189 | file.close(); 190 | savePatch(String(i + 1).c_str(), data); 191 | } 192 | } 193 | deletePatch(String(patches.size() + 1).c_str()); //Delete final patch which is duplicate of penultimate patch 194 | } 195 | 196 | void setPatchesOrdering(int no) { 197 | if (patches.size() < 2)return; 198 | while (patches.first().patchNo != no) { 199 | patches.push(patches.shift()); 200 | } 201 | } 202 | 203 | void resetPatchesOrdering() { 204 | setPatchesOrdering(1); 205 | } 206 | -------------------------------------------------------------------------------- /YD_Code/4_voices_1/usb_descriptors.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in 14 | * all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | * THE SOFTWARE. 23 | * 24 | */ 25 | 26 | #include "tusb.h" 27 | 28 | /* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug. 29 | * Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC. 30 | * 31 | * Auto ProductID layout's Bitmap: 32 | * [MSB] MIDI | HID | MSC | CDC [LSB] 33 | */ 34 | #define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) ) 35 | #define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \ 36 | _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) ) 37 | 38 | //--------------------------------------------------------------------+ 39 | // Device Descriptors 40 | //--------------------------------------------------------------------+ 41 | tusb_desc_device_t const desc_device = 42 | { 43 | .bLength = sizeof(tusb_desc_device_t), 44 | .bDescriptorType = TUSB_DESC_DEVICE, 45 | .bcdUSB = 0x0200, 46 | .bDeviceClass = 0x00, 47 | .bDeviceSubClass = 0x00, 48 | .bDeviceProtocol = 0x00, 49 | .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, 50 | 51 | .idVendor = 0xCafe, 52 | .idProduct = USB_PID, 53 | .bcdDevice = 0x0100, 54 | 55 | .iManufacturer = 0x01, 56 | .iProduct = 0x02, 57 | .iSerialNumber = 0x03, 58 | 59 | .bNumConfigurations = 0x01 60 | }; 61 | 62 | // Invoked when received GET DEVICE DESCRIPTOR 63 | // Application return pointer to descriptor 64 | uint8_t const * tud_descriptor_device_cb(void) 65 | { 66 | return (uint8_t const *) &desc_device; 67 | } 68 | 69 | 70 | //--------------------------------------------------------------------+ 71 | // Configuration Descriptor 72 | //--------------------------------------------------------------------+ 73 | 74 | enum 75 | { 76 | ITF_NUM_MIDI = 0, 77 | ITF_NUM_MIDI_STREAMING, 78 | ITF_NUM_TOTAL 79 | }; 80 | 81 | #define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_MIDI_DESC_LEN) 82 | 83 | #if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX 84 | // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number 85 | // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ... 86 | #define EPNUM_MIDI 0x02 87 | #else 88 | #define EPNUM_MIDI 0x01 89 | #endif 90 | 91 | uint8_t const desc_fs_configuration[] = 92 | { 93 | // Config number, interface count, string index, total length, attribute, power in mA 94 | TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), 95 | 96 | // Interface number, string index, EP Out & EP In address, EP size 97 | TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 64) 98 | }; 99 | 100 | #if TUD_OPT_HIGH_SPEED 101 | uint8_t const desc_hs_configuration[] = 102 | { 103 | // Config number, interface count, string index, total length, attribute, power in mA 104 | TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100), 105 | 106 | // Interface number, string index, EP Out & EP In address, EP size 107 | TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 512) 108 | }; 109 | #endif 110 | 111 | // Invoked when received GET CONFIGURATION DESCRIPTOR 112 | // Application return pointer to descriptor 113 | // Descriptor contents must exist long enough for transfer to complete 114 | uint8_t const * tud_descriptor_configuration_cb(uint8_t index) 115 | { 116 | (void) index; // for multiple configurations 117 | 118 | #if TUD_OPT_HIGH_SPEED 119 | // Although we are highspeed, host may be fullspeed. 120 | return (tud_speed_get() == TUSB_SPEED_HIGH) ? desc_hs_configuration : desc_fs_configuration; 121 | #else 122 | return desc_fs_configuration; 123 | #endif 124 | } 125 | 126 | //--------------------------------------------------------------------+ 127 | // String Descriptors 128 | //--------------------------------------------------------------------+ 129 | 130 | // array of pointer to string descriptors 131 | char const* string_desc_arr [] = 132 | { 133 | (const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409) 134 | "Polykit16", // 1: Manufacturer 135 | "YD DCO DAC", // 2: Product 136 | "123499", // 3: Serials, should use chip ID 137 | }; 138 | 139 | static uint16_t _desc_str[32]; 140 | 141 | // Invoked when received GET STRING DESCRIPTOR request 142 | // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete 143 | uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) 144 | { 145 | (void) langid; 146 | 147 | uint8_t chr_count; 148 | 149 | if ( index == 0) 150 | { 151 | memcpy(&_desc_str[1], string_desc_arr[0], 2); 152 | chr_count = 1; 153 | }else 154 | { 155 | // Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors. 156 | // https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors 157 | 158 | if ( !(index < sizeof(string_desc_arr)/sizeof(string_desc_arr[0])) ) return NULL; 159 | 160 | const char* str = string_desc_arr[index]; 161 | 162 | // Cap at max char 163 | chr_count = strlen(str); 164 | if ( chr_count > 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 31 ) chr_count = 31; 165 | 166 | // Convert ASCII string into UTF-16 167 | for(uint8_t i=0; i 5 | #include 6 | #include "TButton.h" 7 | #include 8 | #include 9 | 10 | ADC *adc = new ADC(); 11 | 12 | //Teensy 3.6 - Mux Pins 13 | #define MUX_0 30 14 | #define MUX_1 31 15 | #define MUX_2 32 16 | #define MUX_3 29 17 | 18 | #define MUX1_S A0 19 | #define MUX2_S A1 20 | #define MUX3_S A2 21 | 22 | #define DEMUX_0 36 23 | #define DEMUX_1 35 24 | #define DEMUX_2 34 25 | #define DEMUX_3 33 26 | 27 | #define DEMUX_EN_1 39 28 | #define DEMUX_EN_2 38 29 | 30 | 31 | //Note DAC 32 | #define DACMULT 25.9 33 | #define MIDICCTOPOT 8.62 34 | 35 | #define DAC_CS1 10 36 | 37 | //Mux 1 Connections 38 | #define MUX1_spare0 0 // 2V 39 | #define MUX1_pwLFO 1 // 5V 40 | #define MUX1_osc1PW 2 // 12V 41 | #define MUX1_osc2PW 3 // 12V 42 | #define MUX1_spare4 4 // 2V 43 | #define MUX1_fmDepth 5 // 2V 44 | #define MUX1_osc1PWM 6 // 2V 45 | #define MUX1_osc2PWM 7 // 2V 46 | 47 | 48 | #define MUX1_osc1Range 8 // 3.3V switches 49 | #define MUX1_noiseLevel 9 // 2V 50 | #define MUX1_osc2SawLevel 10 // 2V 51 | #define MUX1_osc2Detune 11 // 3.3V 52 | #define MUX1_osc2Range 12 // 3.3V switches 53 | #define MUX1_stack 13 // 3.3V 54 | #define MUX1_osc1SawLevel 14 // 2V 55 | #define MUX1_glideTime 15 // MIDI CC 56 | 57 | //Mux 2 Connections 58 | #define MUX2_filterType 0 // 5V switches 59 | #define MUX2_LFOWaveform 1 // 5V 60 | #define MUX2_LFODelay 2 // ? software 61 | #define MUX2_LFORate 3 // 5V 62 | #define MUX2_osc2TriangleLevel 4 // 2V 63 | #define MUX2_osc1PulseLevel 5 // 2V 64 | #define MUX2_osc2PulseLevel 6 // 2V 65 | #define MUX2_osc1SubLevel 7 // 2V 66 | 67 | #define MUX2_filterDecay 8 // 5V 68 | #define MUX2_ampAttack 9 // 5V 69 | #define MUX2_filterAttack 10 // 5V 70 | #define MUX2_filterRes 11 // 2.5V 71 | #define MUX2_filterCutoff 12 // 5V 72 | #define MUX2_filterEGlevel 13 // 5V 73 | #define MUX2_keyTrack 14 // 2V 74 | #define MUX2_filterLFO 15 // 5V 75 | 76 | //Mux 3 Connections 77 | #define MUX3_volumeControl 0 // 2V 78 | #define MUX3_amDepth 1 // 2V 79 | #define MUX3_ampSustain 2 // 5V 80 | #define MUX3_ampRelease 3 // 5V 81 | #define MUX3_filterRelease 4 // 5V 82 | #define MUX3_filterSustain 5 // 5V 83 | #define MUX3_ampDecay 6 // 5V 84 | 85 | 86 | //DeMux 1 Connections 87 | #define DEMUX1_noiseLevel 0 // 0-2v 88 | #define DEMUX1_osc2PulseLevel 1 // 0-2v 89 | #define DEMUX1_osc2Level 2 // 0-2v 90 | #define DEMUX1_LfoDepth 3 // 0-2v 91 | #define DEMUX1_osc1PWM 4 // 0-2v 92 | #define DEMUX1_PitchBend 5 // 0-2v 93 | #define DEMUX1_osc1PulseLevel 6 // 0-2v 94 | #define DEMUX1_osc1Level 7 // 0-2v 95 | #define DEMUX1_modwheel 8 // 0-2v 96 | #define DEMUX1_volumeControl 9 // 0-2v 97 | #define DEMUX1_osc2PWM 10 // 0-2v 98 | #define DEMUX1_spare 11 // spare VCA 0-2v 99 | #define DEMUX1_AmpEGLevel 12 // Amplevel 0-5v 100 | #define DEMUX1_MasterTune 13 // -15v to +15v control 12 +/-13v 101 | #define DEMUX1_osc2Detune 14 // -15v to +15v control 17 +/-13v 102 | #define DEMUX1_pitchEGLevel 15 // PitchEGlevel 0-5v 103 | 104 | //DeMux 2 Connections 105 | #define DEMUX2_Amprelease 0 // 0-5v 106 | #define DEMUX2_Ampsustain 1 // 0-5v 107 | #define DEMUX2_Ampdecay 2 // 0-5v 108 | #define DEMUX2_Ampattack 3 // 0-5v 109 | #define DEMUX2_LfoRate 4 // 0-5v 110 | #define DEMUX2_LFOMULTI 5 // 0-5v 111 | #define DEMUX2_LFOWaveform 6 // 0-5v 112 | #define DEMUX2_LfoDelay 7 // 0-5v 113 | #define DEMUX2_osc2PW 8 // 0-5v 114 | #define DEMUX2_osc1PW 9 // 0-5v 115 | #define DEMUX2_filterEGlevel 10 // FilterEGlevel 0-5v 116 | #define DEMUX2_ADSRMode 11 // 0-5v 117 | #define DEMUX2_pwLFO 12 // 0-5v 118 | #define DEMUX2_LfoSlope 13 // 0-5v 119 | #define DEMUX2_filterCutoff 14 // 0-10v 120 | #define DEMUX2_filterRes15 // 0-10v 121 | 122 | //DeMux 3 Connections 123 | #define DEMUX3_filterA 0 // filterA 0-5v switched 124 | #define DEMUX3_filterB 1 // filterB 0-5v switched 125 | #define DEMUX3_filterC 2 // filterC 0-5v switched 126 | #define DEMUX3_filterLoopA0 3 // syncA0 0-5v switched 127 | #define DEMUX3_filterLoopA1 4 // syncA1 0-5v switched 128 | #define DEMUX3_LFOalt 5 // lFOalt 0-5v switched 129 | #define DEMUX3_spare 6 // spare 0-5v switched 130 | #define DEMUX3_spare1 7 // spare 0-5v switched 131 | #define DEMUX3_pitchAttack 8 // Pitchattack 0-5v 132 | #define DEMUX3_pitchDecay 9 // Pitchdecay 0-5v 133 | #define DEMUX3_pitchSustain 10 // Pitchsustain 0-5v 134 | #define DEMUX3_PitchRelease 11 // Pitchrelease 0-5v 135 | #define DEMUX3_filterAttack 12 // FilterAattack 0-5v 136 | #define DEMUX3_filterDecay 13 // Filterdecay 0-5v 137 | #define DEMUX3_filterSustain 14 // Filtersustain 0-5v 138 | #define DEMUX3_filterEelease 14 // Filterrelease 0-5v 139 | 140 | // 595 outputs 141 | 142 | #define FILTERA_UPPER 0 143 | #define FILTERB_UPPER 1 144 | #define FILTERC_UPPER 2 145 | #define FILTER_POLE_UPPER 3 146 | #define FILTER_EG_INV_UPPER 4 147 | #define FILTER_VELOCITY_UPPER 5 148 | #define AMP_VELOCITY_UPPER 6 149 | #define LFO_ALT_UPPER 7 150 | 151 | #define CHORUS1_OUT_UPPER 8 152 | #define CHORUS2_OUT_UPPER 9 153 | #define FILTER_MODE_BIT0_UPPER 10 154 | #define FILTER_MODE_BIT1_UPPER 11 155 | #define AMP_MODE_BIT0_UPPER 12 156 | #define AMP_MODE_BIT1_UPPER 13 157 | #define FILTER_LIN_LOG_UPPER 14 158 | #define AMP_LIN_LOG_UPPER 15 159 | 160 | #define FILTER_KEYTRACK_UPPER 20 161 | #define UPPER1 21 162 | 163 | #define FILTERA_LOWER 24 164 | #define FILTERB_LOWER 25 165 | #define FILTERC_LOWER 26 166 | #define FILTER_POLE_LOWER 27 167 | #define FILTER_EG_INV_LOWER 28 168 | #define FILTER_VELOCITY_LOWER 29 169 | #define AMP_VELOCITY_LOWER 30 170 | #define LFO_ALT_LOWER 31 171 | 172 | #define CHORUS1_OUT_LOWER 32 173 | #define CHORUS2_OUT_LOWER 33 174 | #define FILTER_MODE_BIT0_LOWER 34 175 | #define FILTER_MODE_BIT1_LOWER 35 176 | #define AMP_MODE_BIT0_LOWER 36 177 | #define AMP_MODE_BIT1_LOWER 37 178 | #define FILTER_LIN_LOG_LOWER 38 179 | #define AMP_LIN_LOG_LOWER 39 180 | 181 | #define OCT1A_LOWER 40 182 | #define OCT1B_LOWER 41 183 | #define OCT2A_LOWER 42 184 | #define OCT2B_LOWER 43 185 | #define FILTER_KEYTRACK_LOWER 44 186 | #define UPPER2 45 187 | 188 | // 595 LEDs 189 | 190 | #define CHORUS1_LED 0 191 | #define CHORUS2_LED 1 192 | #define GLIDE_LED 2 193 | #define VCAGATE_LED 3 194 | #define VCALOOP_LED 4 195 | #define VCAVEL_LED 5 196 | #define LFO_ALT_LED 6 197 | #define FILTERPOLE_LED 7 198 | 199 | #define FILTERLOOP_LED 8 200 | #define FILTERINV_LED 9 201 | #define FILTERVEL_LED 10 202 | #define UPPER_LED 11 203 | #define SAVE_LED 12 204 | #define WHOLE_LED 13 205 | #define DUAL_LED 14 206 | #define SPLIT_LED 15 207 | 208 | #define VCALOOP_DOUBLE_LED 16 209 | #define FILTERLOOP_DOUBLE_LED 17 210 | #define LOWER_LED 18 211 | 212 | // Buttons 213 | // roxmux 74HC165 214 | 215 | #define CHORUS1_SW 0 216 | #define CHORUS2_SW 1 217 | #define GLIDE_SW 2 218 | #define VCAGATE_SW 3 219 | #define VCALOOP_SW 4 220 | #define VCAVEL_SW 5 221 | #define LFO_ALT_SW 6 222 | #define FILTERPOLE_SW 7 223 | 224 | #define FILTERLOOP_SW 8 225 | #define FILTERINV_SW 9 226 | #define FILTERVEL_SW 10 227 | #define UPPER_SW 11 228 | 229 | #define WHOLE_SW 14 230 | #define DUAL_SW 15 231 | #define SPLIT_SW 13 232 | 233 | // System Switches etc 234 | 235 | #define RECALL_SW 6 236 | #define SAVE_SW 24 237 | #define SETTINGS_SW 25 238 | #define BACK_SW 28 239 | 240 | #define ENCODER_PINA 4 241 | #define ENCODER_PINB 5 242 | 243 | #define MUXCHANNELS 16 244 | #define DEMUXCHANNELS 16 245 | #define QUANTISE_FACTOR 10 246 | 247 | #define DEBOUNCE 30 248 | 249 | static byte muxInput = 0; 250 | static byte muxOutput = 0; 251 | 252 | static int mux1ValuesPrev[MUXCHANNELS] = {}; 253 | static int mux2ValuesPrev[MUXCHANNELS] = {}; 254 | static int mux3ValuesPrev[MUXCHANNELS] = {}; 255 | 256 | static int mux1Read = 0; 257 | static int mux2Read = 0; 258 | static int mux3Read = 0; 259 | 260 | 261 | static long encPrevious = 0; 262 | 263 | TButton saveButton{ SAVE_SW, LOW, HOLD_DURATION, DEBOUNCE, CLICK_DURATION }; 264 | TButton settingsButton{ SETTINGS_SW, LOW, HOLD_DURATION, DEBOUNCE, CLICK_DURATION }; 265 | TButton backButton{ BACK_SW, LOW, HOLD_DURATION, DEBOUNCE, CLICK_DURATION }; 266 | TButton recallButton{ RECALL_SW, LOW, HOLD_DURATION, DEBOUNCE, CLICK_DURATION }; // on encoder 267 | 268 | Encoder encoder(ENCODER_PINB, ENCODER_PINA);//This often needs the pins swapping depending on the encoder 269 | 270 | void setupHardware() 271 | { 272 | //Volume Pot is on ADC0 273 | //Volume Pot is on ADC0 274 | adc->adc0->setAveraging(16); // set number of averages 0, 4, 8, 16 or 32. 275 | adc->adc0->setResolution(10); // set bits of resolution 8, 10, 12 or 16 bits. 276 | adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED); // change the conversion speed 277 | adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::MED_SPEED); // change the sampling speed 278 | 279 | //MUXs on ADC1 280 | adc->adc1->setAveraging(16); // set number of averages 0, 4, 8, 16 or 32. 281 | adc->adc1->setResolution(10); // set bits of resolution 8, 10, 12 or 16 bits. 282 | adc->adc1->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED); // change the conversion speed 283 | adc->adc1->setSamplingSpeed(ADC_SAMPLING_SPEED::MED_SPEED); // change the sampling speed 284 | 285 | analogReadResolution(10); 286 | 287 | 288 | //Mux address pins 289 | 290 | pinMode(DAC_CS1, OUTPUT); 291 | digitalWrite(DAC_CS1, HIGH); 292 | 293 | pinMode(MUX_0, OUTPUT); 294 | pinMode(MUX_1, OUTPUT); 295 | pinMode(MUX_2, OUTPUT); 296 | pinMode(MUX_3, OUTPUT); 297 | 298 | pinMode(DEMUX_0, OUTPUT); 299 | pinMode(DEMUX_1, OUTPUT); 300 | pinMode(DEMUX_2, OUTPUT); 301 | pinMode(DEMUX_3, OUTPUT); 302 | 303 | digitalWrite(MUX_0, LOW); 304 | digitalWrite(MUX_1, LOW); 305 | digitalWrite(MUX_2, LOW); 306 | digitalWrite(MUX_3, LOW); 307 | 308 | digitalWrite(DEMUX_0, LOW); 309 | digitalWrite(DEMUX_1, LOW); 310 | digitalWrite(DEMUX_2, LOW); 311 | digitalWrite(DEMUX_3, LOW); 312 | 313 | //Mux ADC 314 | pinMode(MUX1_S, INPUT_DISABLE); 315 | pinMode(MUX2_S, INPUT_DISABLE); 316 | pinMode(MUX3_S, INPUT_DISABLE); 317 | 318 | pinMode(DEMUX_EN_1, OUTPUT); 319 | pinMode(DEMUX_EN_2, OUTPUT); 320 | 321 | digitalWrite(DEMUX_EN_1, HIGH); 322 | digitalWrite(DEMUX_EN_2, HIGH); 323 | 324 | 325 | //Switches 326 | 327 | pinMode(RECALL_SW, INPUT_PULLUP); //On encoder 328 | pinMode(SAVE_SW, INPUT_PULLUP); 329 | pinMode(SETTINGS_SW, INPUT_PULLUP); 330 | pinMode(BACK_SW, INPUT_PULLUP); 331 | 332 | } 333 | -------------------------------------------------------------------------------- /YD_Code/8_voices_1/YD-dco-lfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "hardware/adc.h" 7 | #include "hardware/pio.h" 8 | #include "hardware/clocks.h" 9 | #include "pico-dco.pio.h" 10 | #include "hardware/pwm.h" 11 | #include "bsp/board.h" 12 | #include "tusb.h" 13 | #include "hardware/uart.h" 14 | 15 | #define NUM_VOICES 8 16 | #define MIDI_CHANNEL 1 17 | #define USE_ADC_STACK_VOICES // gpio 28 (adc 2) 18 | #define USE_ADC_DETUNE // gpio 27 (adc 1) 19 | #define USE_ADC_FM // gpio 26 (adc 0) 20 | #define USE_OCTAVE_SWITCH 21 | 22 | #define PIN_OCT1 20 23 | #define PIN_OCT2 21 24 | 25 | uint8_t OCT1 = 1; 26 | uint8_t OCT2 = 1; 27 | float OCT = 0; 28 | float LAST_OCT = 1.0f; 29 | 30 | uint STACK_VOICES = 1; 31 | float DETUNE = 0.0f, LAST_DETUNE = 0.0f; 32 | float FM_VALUE = 0.0f; 33 | float LAST_FM = 0.0f; 34 | 35 | // Scale factor for FM. Controls how intense the effect is at maximum input voltage. 36 | // Units: Hertz. 37 | float FM_INTENSITY = 15.0f; 38 | 39 | const float BASE_NOTE = 440.0f; 40 | const uint8_t RESET_PINS[NUM_VOICES] = {13, 8, 12, 9, 11, 10, 6, 5}; 41 | const uint8_t RANGE_PINS[NUM_VOICES] = {16, 19, 15, 18, 14, 17, 22, 29}; 42 | const uint8_t VOICE_TO_PIO[NUM_VOICES] = {0, 0, 0, 0, 1, 1, 1, 1}; 43 | const uint8_t VOICE_TO_SM[NUM_VOICES] = {0, 1, 2, 3, 0, 1, 2, 3}; 44 | const uint16_t DIV_COUNTER = 1250; 45 | uint8_t RANGE_PWM_SLICES[NUM_VOICES]; 46 | 47 | uint32_t VOICES[NUM_VOICES]; 48 | uint8_t VOICE_NOTES[NUM_VOICES]; 49 | uint8_t VOICE_GATE[NUM_VOICES]; 50 | 51 | uint8_t NEXT_VOICE = 0; 52 | uint32_t LED_BLINK_START = 0; 53 | PIO pio[2] = {pio0, pio1}; 54 | uint8_t midi_serial_status = 0; 55 | uint16_t midi_pitch_bend = 0x2000, last_midi_pitch_bend = 0x2000; 56 | bool portamento = false; 57 | uint8_t portamento_time = 0, portamento_start = 0, portamento_stop = 0; 58 | float portamento_cur_freq = 0.0f; 59 | 60 | void init_sm(PIO pio, uint sm, uint offset, uint pin); 61 | void set_frequency(PIO pio, uint sm, float freq); 62 | float get_freq_from_midi_note(uint8_t note); 63 | void led_blinking_task(); 64 | uint8_t get_free_voice(); 65 | void usb_midi_task(); 66 | void serial_midi_task(); 67 | void note_on(uint8_t note, uint8_t velocity); 68 | void note_off(uint8_t note); 69 | void voice_task(); 70 | void adc_task(); 71 | void octave_task(); 72 | long map(long x, long in_min, long in_max, long out_min, long out_max); 73 | 74 | int main() { 75 | board_init(); 76 | tusb_init(); 77 | 78 | // use more accurate PWM mode for buck-boost converter 79 | gpio_init(23); 80 | gpio_set_dir(23, GPIO_OUT); 81 | gpio_put(23, 1); 82 | 83 | // init serial midi 84 | uart_init(uart0, 31250); 85 | uart_set_fifo_enabled(uart0, true); 86 | gpio_set_function(0, GPIO_FUNC_UART); 87 | gpio_set_function(1, GPIO_FUNC_UART); 88 | 89 | // pwm init 90 | for (int i=0; i freq2) portamento_cur_freq = freq2; 169 | } else { 170 | portamento_cur_freq -= 1.0f/(portamento_time+1); 171 | if (portamento_cur_freq < freq2) portamento_cur_freq = freq2; 172 | } 173 | } 174 | return portamento_cur_freq; 175 | } 176 | 177 | return pow(2, (note-69)/12.0f) * BASE_NOTE; 178 | } 179 | 180 | void usb_midi_task() { 181 | if (tud_midi_available() < 4) return; 182 | 183 | uint8_t buff[4]; 184 | 185 | LED_BLINK_START = board_millis(); 186 | board_led_write(true); 187 | 188 | if (tud_midi_packet_read(buff)) { 189 | if (buff[1] == (0x90 | (MIDI_CHANNEL-1))) { 190 | if (buff[3] > 0) { 191 | note_on(buff[2], buff[3]); 192 | } else { 193 | note_off(buff[2]); 194 | } 195 | } 196 | 197 | if (buff[1] == (0x80 | (MIDI_CHANNEL-1))) { 198 | note_off(buff[2]); 199 | } 200 | 201 | if (buff[1] == (0xE0 | (MIDI_CHANNEL-1))) { 202 | midi_pitch_bend = buff[2] | (buff[3]<<7); 203 | } 204 | 205 | if (midi_serial_status == (0xB0 | (MIDI_CHANNEL-1))) { 206 | if (buff[2] == 5) { // portamento time 207 | portamento_time = buff[3]; 208 | } 209 | if (buff[2] == 65) { // portamento on/off 210 | portamento = buff[3] > 63; 211 | } 212 | } 213 | } 214 | } 215 | 216 | void serial_midi_task() { 217 | if (!uart_is_readable(uart0)) return; 218 | 219 | uint8_t lsb = 0, msb = 0; 220 | 221 | uint8_t data = uart_getc(uart0); 222 | 223 | LED_BLINK_START = board_millis(); 224 | board_led_write(true); 225 | 226 | // status 227 | if (data >= 0xF0 && data <= 0xF7) { 228 | midi_serial_status = 0; 229 | return; 230 | } 231 | 232 | // realtime message 233 | if (data >= 0xF8 && data <= 0xFF) { 234 | return; 235 | } 236 | 237 | if (data >= 0x80 && data <= 0xEF) { 238 | midi_serial_status = data; 239 | } 240 | 241 | if (midi_serial_status >= 0x80 && midi_serial_status <= 0x9F || 242 | midi_serial_status >= 0xB0 && midi_serial_status <= 0xBF || // cc messages 243 | midi_serial_status >= 0xE0 && midi_serial_status <= 0xEF) { 244 | 245 | lsb = uart_getc(uart0); 246 | msb = uart_getc(uart0); 247 | } 248 | 249 | if (midi_serial_status == (0x90 | (MIDI_CHANNEL-1))) { 250 | if (msb > 0) { 251 | note_on(lsb, msb); 252 | } else { 253 | note_off(lsb); 254 | } 255 | } 256 | 257 | if (midi_serial_status == (0x80 | (MIDI_CHANNEL-1))) { 258 | note_off(lsb); 259 | } 260 | 261 | if (midi_serial_status == (0xE0 | (MIDI_CHANNEL-1))) { 262 | midi_pitch_bend = lsb | (msb<<7); 263 | } 264 | 265 | if (midi_serial_status == (0xB0 | (MIDI_CHANNEL-1))) { 266 | if (lsb == 5) { // portamento time 267 | portamento_time = msb; 268 | } 269 | if (lsb == 65) { // portamento on/off 270 | portamento = msb > 63; 271 | } 272 | } 273 | } 274 | 275 | void note_on(uint8_t note, uint8_t velocity) { 276 | if (STACK_VOICES < 2) { 277 | for (int i=0; i> 0) & (OCT2 >> 0)){ 397 | OCT = 1; 398 | } 399 | if ((OCT1 == 0) & (OCT2 >> 0)){ 400 | OCT = 0.5; 401 | } 402 | if ((OCT2 == 0) & (OCT1 >> 0)){ 403 | OCT = 2; 404 | } 405 | #endif 406 | } 407 | 408 | long map(long x, long in_min, long in_max, long out_min, long out_max) { 409 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 410 | } 411 | 412 | void led_blinking_task() { 413 | if (board_millis() - LED_BLINK_START < 50) return; 414 | board_led_write(false); 415 | } 416 | -------------------------------------------------------------------------------- /YD_Code/8_voices_2/YD-dco-lfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "pico/stdlib.h" 5 | #include "hardware/gpio.h" 6 | #include "hardware/adc.h" 7 | #include "hardware/pio.h" 8 | #include "hardware/clocks.h" 9 | #include "pico-dco.pio.h" 10 | #include "hardware/pwm.h" 11 | #include "bsp/board.h" 12 | #include "tusb.h" 13 | #include "hardware/uart.h" 14 | 15 | #define NUM_VOICES 8 16 | #define MIDI_CHANNEL 2 17 | #define USE_ADC_STACK_VOICES // gpio 28 (adc 2) 18 | #define USE_ADC_DETUNE // gpio 27 (adc 1) 19 | #define USE_ADC_FM // gpio 26 (adc 0) 20 | #define USE_OCTAVE_SWITCH 21 | 22 | #define PIN_OCT1 20 23 | #define PIN_OCT2 21 24 | 25 | uint8_t OCT1 = 1; 26 | uint8_t OCT2 = 1; 27 | float OCT = 0; 28 | float LAST_OCT = 1.0f; 29 | 30 | uint STACK_VOICES = 1; 31 | float DETUNE = 0.0f, LAST_DETUNE = 0.0f; 32 | float FM_VALUE = 0.0f; 33 | float LAST_FM = 0.0f; 34 | 35 | // Scale factor for FM. Controls how intense the effect is at maximum input voltage. 36 | // Units: Hertz. 37 | float FM_INTENSITY = 15.0f; 38 | 39 | const float BASE_NOTE = 440.0f; 40 | const uint8_t RESET_PINS[NUM_VOICES] = {13, 8, 12, 9, 11, 10, 6, 5}; 41 | const uint8_t RANGE_PINS[NUM_VOICES] = {16, 19, 15, 18, 14, 17, 22, 29}; 42 | //const uint8_t GATE_PINS[NUM_VOICES] = {2, 3, 4, 5, 6, 7}; 43 | const uint8_t VOICE_TO_PIO[NUM_VOICES] = {0, 0, 0, 0, 1, 1, 1, 1}; 44 | const uint8_t VOICE_TO_SM[NUM_VOICES] = {0, 1, 2, 3, 0, 1, 2, 3}; 45 | const uint16_t DIV_COUNTER = 1250; 46 | uint8_t RANGE_PWM_SLICES[NUM_VOICES]; 47 | 48 | uint32_t VOICES[NUM_VOICES]; 49 | uint8_t VOICE_NOTES[NUM_VOICES]; 50 | uint8_t VOICE_GATE[NUM_VOICES]; 51 | 52 | uint8_t NEXT_VOICE = 0; 53 | uint32_t LED_BLINK_START = 0; 54 | PIO pio[2] = {pio0, pio1}; 55 | uint8_t midi_serial_status = 0; 56 | uint16_t midi_pitch_bend = 0x2000, last_midi_pitch_bend = 0x2000; 57 | bool portamento = false; 58 | uint8_t portamento_time = 0, portamento_start = 0, portamento_stop = 0; 59 | float portamento_cur_freq = 0.0f; 60 | 61 | void init_sm(PIO pio, uint sm, uint offset, uint pin); 62 | void set_frequency(PIO pio, uint sm, float freq); 63 | float get_freq_from_midi_note(uint8_t note); 64 | void led_blinking_task(); 65 | uint8_t get_free_voice(); 66 | void usb_midi_task(); 67 | void serial_midi_task(); 68 | void note_on(uint8_t note, uint8_t velocity); 69 | void note_off(uint8_t note); 70 | void voice_task(); 71 | void adc_task(); 72 | void octave_task(); 73 | long map(long x, long in_min, long in_max, long out_min, long out_max); 74 | 75 | int main() { 76 | board_init(); 77 | tusb_init(); 78 | 79 | // use more accurate PWM mode for buck-boost converter 80 | gpio_init(23); 81 | gpio_set_dir(23, GPIO_OUT); 82 | gpio_put(23, 1); 83 | 84 | // init serial midi 85 | uart_init(uart0, 31250); 86 | uart_set_fifo_enabled(uart0, true); 87 | gpio_set_function(0, GPIO_FUNC_UART); 88 | gpio_set_function(1, GPIO_FUNC_UART); 89 | 90 | // pwm init 91 | for (int i=0; i freq2) portamento_cur_freq = freq2; 170 | } else { 171 | portamento_cur_freq -= 1.0f/(portamento_time+1); 172 | if (portamento_cur_freq < freq2) portamento_cur_freq = freq2; 173 | } 174 | } 175 | return portamento_cur_freq; 176 | } 177 | 178 | return pow(2, (note-69)/12.0f) * BASE_NOTE; 179 | } 180 | 181 | void usb_midi_task() { 182 | if (tud_midi_available() < 4) return; 183 | 184 | uint8_t buff[4]; 185 | 186 | LED_BLINK_START = board_millis(); 187 | board_led_write(true); 188 | 189 | if (tud_midi_packet_read(buff)) { 190 | if (buff[1] == (0x90 | (MIDI_CHANNEL-1))) { 191 | if (buff[3] > 0) { 192 | note_on(buff[2], buff[3]); 193 | } else { 194 | note_off(buff[2]); 195 | } 196 | } 197 | 198 | if (buff[1] == (0x80 | (MIDI_CHANNEL-1))) { 199 | note_off(buff[2]); 200 | } 201 | 202 | if (buff[1] == (0xE0 | (MIDI_CHANNEL-1))) { 203 | midi_pitch_bend = buff[2] | (buff[3]<<7); 204 | } 205 | 206 | if (midi_serial_status == (0xB0 | (MIDI_CHANNEL-1))) { 207 | if (buff[2] == 5) { // portamento time 208 | portamento_time = buff[3]; 209 | } 210 | if (buff[2] == 65) { // portamento on/off 211 | portamento = buff[3] > 63; 212 | } 213 | } 214 | } 215 | } 216 | 217 | void serial_midi_task() { 218 | if (!uart_is_readable(uart0)) return; 219 | 220 | uint8_t lsb = 0, msb = 0; 221 | 222 | uint8_t data = uart_getc(uart0); 223 | 224 | LED_BLINK_START = board_millis(); 225 | board_led_write(true); 226 | 227 | // status 228 | if (data >= 0xF0 && data <= 0xF7) { 229 | midi_serial_status = 0; 230 | return; 231 | } 232 | 233 | // realtime message 234 | if (data >= 0xF8 && data <= 0xFF) { 235 | return; 236 | } 237 | 238 | if (data >= 0x80 && data <= 0xEF) { 239 | midi_serial_status = data; 240 | } 241 | 242 | if (midi_serial_status >= 0x80 && midi_serial_status <= 0x9F || 243 | midi_serial_status >= 0xB0 && midi_serial_status <= 0xBF || // cc messages 244 | midi_serial_status >= 0xE0 && midi_serial_status <= 0xEF) { 245 | 246 | lsb = uart_getc(uart0); 247 | msb = uart_getc(uart0); 248 | } 249 | 250 | if (midi_serial_status == (0x90 | (MIDI_CHANNEL-1))) { 251 | if (msb > 0) { 252 | note_on(lsb, msb); 253 | } else { 254 | note_off(lsb); 255 | } 256 | } 257 | 258 | if (midi_serial_status == (0x80 | (MIDI_CHANNEL-1))) { 259 | note_off(lsb); 260 | } 261 | 262 | if (midi_serial_status == (0xE0 | (MIDI_CHANNEL-1))) { 263 | midi_pitch_bend = lsb | (msb<<7); 264 | } 265 | 266 | if (midi_serial_status == (0xB0 | (MIDI_CHANNEL-1))) { 267 | if (lsb == 5) { // portamento time 268 | portamento_time = msb; 269 | } 270 | if (lsb == 65) { // portamento on/off 271 | portamento = msb > 63; 272 | } 273 | } 274 | } 275 | 276 | void note_on(uint8_t note, uint8_t velocity) { 277 | if (STACK_VOICES < 2) { 278 | for (int i=0; i> 0) & (OCT2 >> 0)){ 399 | OCT = 1; 400 | } 401 | if ((OCT1 == 0) & (OCT2 >> 0)){ 402 | OCT = 0.5; 403 | } 404 | if ((OCT2 == 0) & (OCT1 >> 0)){ 405 | OCT = 2; 406 | } 407 | #endif 408 | } 409 | 410 | long map(long x, long in_min, long in_max, long out_min, long out_max) { 411 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 412 | } 413 | 414 | void led_blinking_task() { 415 | if (board_millis() - LED_BLINK_START < 50) return; 416 | board_led_write(false); 417 | } 418 | --------------------------------------------------------------------------------