Skip to content
Snippets Groups Projects
Commit f736b4e0 authored by Erik Strand's avatar Erik Strand
Browse files

Clean up midi test

parent cf382268
No related branches found
No related tags found
No related merge requests found
// //
// sampler.c // midi_test.c
// based on hello.ftdi.44.echo.c // based on hello.ftdi.44.echo.c
// //
// 115200 baud FTDI character echo, with flash string // 115200 baud FTDI MIDI controller
// //
// set lfuse to 0x5E for 20 MHz xtal // set lfuse to 0x5E for 20 MHz xtal
// //
// Neil Gershenfeld // Neil Gershenfeld
// 12/8/10 // 12/8/10
// Erik Strand // Erik Strand
// 11/6/2018 // 11/13/2018
// //
// (c) Massachusetts Institute of Technology 2010 // (c) Massachusetts Institute of Technology 2010
// This work may be reproduced, modified, distributed, // This work may be reproduced, modified, distributed,
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#define pin_test(pins,pin) (pins & pin) // test for port pin #define pin_test(pins,pin) (pins & pin) // test for port pin
#define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set #define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set
#define bit_delay_time 8.4 // bit delay for 115200 with overhead #define bit_delay_time 8.4 // bit delay for 115200 with overhead
//#define bit_delay_time 31.82 // bit delay for 31250 with overhead
#define bit_delay() _delay_us(bit_delay_time) // RS232 bit delay #define bit_delay() _delay_us(bit_delay_time) // RS232 bit delay
#define half_bit_delay() _delay_us(bit_delay_time/2) // RS232 half bit delay #define half_bit_delay() _delay_us(bit_delay_time/2) // RS232 half bit delay
#define char_delay() _delay_ms(10) // char delay #define char_delay() _delay_ms(10) // char delay
...@@ -132,46 +131,7 @@ int main(void) { ...@@ -132,46 +131,7 @@ int main(void) {
// 120 ticks per quarter note // 120 ticks per quarter note
const struct MidiEvent events[] = { const struct MidiEvent events[] = {
// Stagefright // Bb major 7
/*
{0, note_on, 40, 100},
{60, note_off, 40, 100},
{60, note_on, 40, 100},
{120, note_off, 40, 100},
{120, note_on, 40, 100},
{180, note_off, 40, 100},
{180, note_on, 42, 100},
{240, note_off, 42, 100},
{240, note_on, 43, 100},
{300, note_off, 43, 100},
{300, note_on, 43, 100},
{360, note_off, 43, 100},
{360, note_on, 44, 100},
{420, note_off, 44, 100},
{420, note_on, 44, 100},
{480, note_off, 44, 100},
//{480, note_on, 45, 100},
//{540, note_off, 45, 100},
{540, note_on, 45, 100},
{600, note_off, 45, 100},
{600, note_on, 45, 100},
{660, note_off, 45, 100},
{660, note_on, 47, 100},
{720, note_off, 47, 100},
{720, note_on, 48, 100},
{780, note_off, 48, 100},
{780, note_on, 48, 100},
{840, note_off, 48, 100},
{840, note_on, 51, 100},
{900, note_off, 51, 100},
{900, note_on, 51, 100},
{960, note_off, 51, 100},
*/
// Bb
{0, note_on, 58, 100}, {0, note_on, 58, 100},
{30, note_on, 62, 100}, {30, note_on, 62, 100},
{60, note_on, 65, 100}, {60, note_on, 65, 100},
...@@ -181,34 +141,7 @@ int main(void) { ...@@ -181,34 +141,7 @@ int main(void) {
{180, note_off, 62, 100}, {180, note_off, 62, 100},
{180, note_off, 58, 100}, {180, note_off, 58, 100},
{240 + 0, note_on, 58, 100}, // sentinel event
{240 + 30, note_on, 61, 100},
{240 + 60, note_on, 64, 100},
{240 + 90, note_on, 67, 100},
{240 + 180, note_off, 67, 100},
{240 + 180, note_off, 64, 100},
{240 + 180, note_off, 61, 100},
{240 + 180, note_off, 58, 100},
{480 + 0, note_on, 60, 100},
{480 + 30, note_on, 64, 100},
{480 + 60, note_on, 65, 100},
{480 + 90, note_on, 69, 100},
{480 + 180, note_off, 69, 100},
{480 + 180, note_off, 65, 100},
{480 + 180, note_off, 64, 100},
{480 + 180, note_off, 60, 100},
{720 + 0, note_on, 60, 100},
{720 + 30, note_on, 63, 100},
{720 + 60, note_on, 65, 100},
{720 + 90, note_on, 69, 100},
{720 + 180, note_off, 69, 100},
{720 + 180, note_off, 65, 100},
{720 + 180, note_off, 63, 100},
{720 + 180, note_off, 60, 100},
// sentinel
{65535, note_off, 50, 100}, {65535, note_off, 50, 100},
}; };
...@@ -229,15 +162,6 @@ int main(void) { ...@@ -229,15 +162,6 @@ int main(void) {
current_tick = 0; current_tick = 0;
event_index = 0; event_index = 0;
PORTB ^= led_pin; PORTB ^= led_pin;
/*
while (events[event_index].tick <= current_tick) {
put_char(&serial_port, serial_pin_out, events[event_index].status);
put_char(&serial_port, serial_pin_out, events[event_index].note);
put_char(&serial_port, serial_pin_out, events[event_index].velocity);
++event_index;
}
*/
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment