diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eefd463 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ + +root = true + +[*] +insert_final_newline = true +end_of_line = lf + +[*.{md,c}] +indent_style = space +indent_size = 4 +charset = utf-8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..34290f1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ + +# VSCode configuration + +.vscode/ + +# Don't include generated files + +/ps +*.o +*.wav diff --git a/ps.c b/ps.c index b6ef991..b8af65e 100644 --- a/ps.c +++ b/ps.c @@ -7,13 +7,15 @@ #include #include -#include #include #include #include +#include #include + #include "SDL2/SDL.h" + #if defined(_WIN32) || defined(_WIN64) #include #define sleep(sec) Sleep(1000*(sec)) @@ -21,26 +23,63 @@ #include //sleep() #endif -#define one_tick_size (int)6000 -#define chan_num (int)8 //Number of channels (synth tracks) -int srate = 44100; + +#define Flanger_Max_Size 100 + +// Number of Synth Channels +#define Channel_Count 8 + +#define Tick_Size 6000 + +#define Echo_Size ( Tick_Size * 3 ) + +#define Reverb 16 + + + + int bufsize = 1024; -int exit_request = 0; -int fadeout = 0; +int fps = 44100; + float fadeout_vol = 1; +int fadeout = 0; + float volume = 1.2; -int timer = 0; //0...one_tick_size -int tick = 0; //0...pattern size (number of lines) -int cur_pattern = 0; //0...number of patterns -float dc_sl = 0, dc_sr = 0; -float dc_psl = 0, dc_psr = 0; -float max_vol = 1; -int out_mode = 0; //0 - SDL; 1 - WAV EXPORT; -const char* export_file_name = NULL; - -int myrand() -{ + +// 0 .. Tick_Size +int timer = 0; + +// 0 .. Pattern Size (number of lines) +int tick = 0; + +// 0 .. Number of Patterns +int pattern = 0; + +float + dc_s_left = 0 , + dc_s_right = 0 ; + +float + dc_ps_left = 0 , + dc_ps_right = 0 ; + +float loudest = 1; + +int stop_execution = 0; + + +/* + * 0 : SDL + * 1 : WAV Export + */ + +int out_mode = 0; + + + +int randomize (){ + static int seed = 0; seed *= 13; @@ -49,828 +88,851 @@ int myrand() return seed; } -uint8_t notes[] = -//line0: ch0 note, ch1 note, ch2 note ... -//line1: ... -//... -{ - 100, 0, 130, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 255, 0, 0, 0, 0, 0, 0, 0 + +#define limit( value , min , max ) \ + fmax(fmin((value),(max)),(min)) + +#define ranged( value , range ) \ + limit((value),-(range),(range)) + +#define square( value ) \ + pow(2,(value)) + +#define constrict( value , threshold , limit ){ \ + \ + if((value) > + (threshold)) \ + (value) = + (limit); \ + \ + if((value) < - (threshold)) \ + (value) = - (limit); \ +} + + +/* + * Note Patterns + * ============= + * - One line consists of 8 channels + * - A value of 255 marks the end of the pattern + */ + +uint8_t notes [] = { + + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes2[] = -{ - 100, 0, 130, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 134, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 140, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 122, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 255, 0, 0, 0, 0, 0, 0, 0 +uint8_t notes2 [] = { + + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 134 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 140 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 122 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes2_prehat[] = -{ - 100, 0, 130, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 134, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 0, 0, 0, 0, 0, - 100, 0, 140, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 122, 0, 0, 0, 0, 0, - 10, 100, 0, 0, 0, 0, 0, 0, - 255, 0, 0, 0, 0, 0, 0, 0 +uint8_t notes2_prehat [] = { + + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 134 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 140 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 122 , 0 , 0 , 0 , 0 , 0 , + 10 , 100 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes3[] = -{ - 100, 0, 131, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 130, 0, 0, 0, 0, 0, - 10, 0, 131, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 100, 0, 140, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 255, 0, 0, 0, 0, 0, 0, 0 +uint8_t notes3 [] = { + + 100 , 0 , 131 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 131 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 140 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first[] = -{ - 100, 0, 130, 99, 1, 0, 254, 254, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 138, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first [] = { + + 100 , 0 , 130 , 99 , 1 , 0 , 254 , 254 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 138 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first2[] = -{ - 100, 0, 130, 99, 0, 140, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 2, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first2 [] = { + + 100 , 0 , 130 , 99 , 0 , 140 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 2 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first3[] = -{ - 100, 0, 130, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 142, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first3 [] = { + + 100 , 0 , 130 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 142 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat[] = -{ - 100, 0, 130, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat [] = { + + 100 , 0 , 130 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes2_hat[] = -{ - 100, 0, 130, 94, 0, 142, 0, 0, - 10, 1, 0, 94, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 94, 0, 0, 0, 0, - 200, 100, 134, 94, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 2, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 94, 0, 0, 0, 0, - 100, 1, 140, 94, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 94, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 122, 94, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes2_hat [] = { + + 100 , 0 , 130 , 94 , 0 , 142 , 0 , 0 , + 10 , 1 , 0 , 94 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 94 , 0 , 0 , 0 , 0 , + 200 , 100 , 134 , 94 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 2 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 94 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 94 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 94 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 122 , 94 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes3_hat[] = -{ - 100, 0, 131, 92, 0, 145, 0, 0, - 10, 1, 0, 92, 0, 0, 0, 0, - 100, 2, 130, 128, 0, 0, 0, 0, - 10, 1, 131, 92, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 10, 4, 0, 128, 0, 0, 0, 0, - 20, 2, 0, 0, 1, 116, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 100, 1, 140, 92, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 92, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 92, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes3_hat [] = { + + 100 , 0 , 131 , 92 , 0 , 145 , 0 , 0 , + 10 , 1 , 0 , 92 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 128 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 92 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 128 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 1 , 116 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 92 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 92 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 92 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes3_hat2[] = -{ - 100, 0, 131, 92, 0, 0, 0, 0, - 10, 1, 0, 92, 0, 0, 0, 0, - 100, 2, 130, 128, 0, 0, 0, 0, - 10, 1, 131, 92, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 10, 4, 0, 128, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 100, 1, 140, 92, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 92, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 92, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes3_hat2 [] = { + + 100 , 0 , 131 , 92 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 92 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 128 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 92 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 128 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 92 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 92 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 92 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes3_hat3[] = -{ - 100, 0, 131, 92, 0, 143, 0, 0, - 10, 1, 0, 92, 0, 0, 0, 0, - 100, 2, 130, 128, 0, 0, 0, 0, - 10, 1, 131, 92, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 10, 4, 0, 128, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 100, 1, 140, 92, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 92, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 92, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes3_hat3 [] = { + + 100 , 0 , 131 , 92 , 0 , 143 , 0 , 0 , + 10 , 1 , 0 , 92 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 128 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 92 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 128 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 92 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 92 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 92 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes3_hat4[] = -{ - 100, 0, 131, 92, 0, 142, 0, 0, - 10, 1, 0, 92, 0, 0, 0, 0, - 100, 2, 130, 128, 0, 0, 0, 0, - 10, 1, 131, 92, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 10, 4, 0, 128, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 92, 0, 0, 0, 0, - 100, 1, 140, 92, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 92, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 92, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes3_hat4 [] = { + + 100 , 0 , 131 , 92 , 0 , 142 , 0 , 0 , + 10 , 1 , 0 , 92 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 128 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 92 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 128 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 92 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 92 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 92 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 92 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first_dual[] = -{ - 100, 0, 131, 95, 0, 0, 135, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 130, 0, 0, 0, 0, 0, - 10, 1, 131, 95, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 135, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 100, 1, 140, 95, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 95, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 95, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - - 100, 0, 131, 95, 0, 0, 135, 137, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 130, 0, 0, 0, 0, 0, - 10, 1, 131, 95, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 100, 1, 140, 95, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 95, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 95, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - - 100, 0, 131, 95, 0, 0, 135, 140, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 130, 0, 0, 0, 0, 0, - 10, 1, 131, 95, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 100, 1, 140, 95, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 95, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 95, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - - 100, 0, 131, 95, 2, 159, 135, 142, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 130, 0, 0, 0, 0, 0, - 10, 1, 131, 95, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 100, 1, 140, 95, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 95, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 128, 95, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first_dual [] = { + + 100 , 0 , 131 , 95 , 0 , 0 , 135 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 135 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 95 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 131 , 95 , 0 , 0 , 135 , 137 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 95 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 131 , 95 , 0 , 0 , 135 , 140 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 95 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 131 , 95 , 2 , 159 , 135 , 142 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 130 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 131 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 140 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 128 , 95 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first2_dual[] = -{ - 100, 0, 130, 99, 0, 140, 135, 142, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 0, 0, 0, - 10, 4, 137, 0, 2, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first2_dual [] = { + + 100 , 0 , 130 , 99 , 0 , 140 , 135 , 142 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 4 , 137 , 0 , 2 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first3_dual[] = -{ - 100, 0, 130, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 128, 0, 0, 0, 0, 0, - 10, 1, 130, 99, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 0, 0, 142, 0, 0, - 10, 4, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 99, 0, 0, 0, 0, - 100, 1, 138, 99, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 99, 0, 0, 0, 0, - 10, 1, 0, 0, 0, 0, 0, 0, - 20, 2, 123, 99, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first3_dual [] = { + + 100 , 0 , 130 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 0 , 0 , 142 , 0 , 0 , + 10 , 4 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 99 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_hat_first_dual2[] = -{ - 100, 0, 130, 95, 0, 0, 131, 138, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 128, 119, 0, 0, 0, 0, - 10, 1, 130, 95, 0, 0, 0, 0, - 200, 100, 135, 95, 0, 0, 0, 0, - 10, 4, 0, 0, 0, 0, 0, 0, - 20, 2, 0, 131, 0, 138, 0, 0, - 10, 4, 137, 119, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 100, 130, 95, 0, 0, 0, 0, - 100, 1, 138, 95, 0, 0, 0, 0, - 20, 3, 0, 0, 0, 0, 0, 0, - 200, 100, 142, 95, 0, 0, 0, 0, - 10, 1, 0, 119, 0, 0, 0, 0, - 20, 2, 123, 95, 0, 0, 0, 0, - 10, 60, 0, 0, 0, 0, 0, 0, - 255, 1, 0, 0, 0, 0, 0, 0 +uint8_t notes_hat_first_dual2 [] = { + + 100 , 0 , 130 , 95 , 0 , 0 , 131 , 138 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 128 , 119 , 0 , 0 , 0 , 0 , + 10 , 1 , 130 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 131 , 0 , 138 , 0 , 0 , + 10 , 4 , 137 , 119 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 130 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 138 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 100 , 142 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 119 , 0 , 0 , 0 , 0 , + 20 , 2 , 123 , 95 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 0 , 0 , 0 , 0 , 0 , + 255 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_end[] = -{ - 100, 0, 130, 0, 0, 0, 130, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 0, 0, 128, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 125, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 118, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, - - 255, 0, 0, 0, 0, 0, 0, 0 +uint8_t notes_end [] = { + + 100 , 0 , 130 , 0 , 0 , 0 , 130 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 128 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 125 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 118 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 5 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 4 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; -uint8_t notes_preend[] = -{ - 100, 0, 130, 0, 0, 0, 130, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 0, 0, 128, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 125, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 100, 0, 130, 0, 0, 118, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 100, 0, 128, 0, 0, 0, 0, 0, - 10, 0, 130, 0, 0, 0, 0, 0, - 200, 0, 135, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 10, 0, 137, 0, 0, 0, 0, 0, - 100, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 130, 0, 0, 0, 0, 0, - 100, 0, 138, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 0, 0, 0, 0, - 200, 0, 142, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - 20, 0, 123, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 0, 0, 0, 0, - - 255, 0, 0, 0, 0, 0, 0, 0 +uint8_t notes_preend [] = { + + 100 , 0 , 130 , 0 , 0 , 0 , 130 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 0 , 0 , 128 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 125 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 100 , 0 , 130 , 0 , 0 , 118 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 128 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 135 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 137 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 130 , 0 , 0 , 0 , 0 , 0 , + 100 , 0 , 138 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 200 , 0 , 142 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 20 , 0 , 123 , 0 , 0 , 0 , 0 , 0 , + 10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + + 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }; //=-=-=-= -uint8_t part2[] = -{ - 100, 253, 0, 97, 4, 0, 135, 253, -// 100, 253, 0, 97, 4, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 97, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 0, 97, 0, 0, 0, 0, - 100, 1, 0, 99, 0, 0, 0, 0, - 20, 3, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 99, 0, 0, 0, 0, - 10, 60, 0, 99, 0, 0, 0, 0, - - 100, 0, 000, 97, 1, 0, 135, 0, -// 100, 0, 000, 97, 1, 0, 0, 0, - 10, 1, 000, 99, 0, 0, 0, 0, - 100, 2, 00, 99, 0, 0, 0, 0, - 10, 1, 000, 97, 0, 0, 0, 0, - 200, 100, 135, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 00, 97, 0, 0, 0, 0, - 10, 4, 00, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 000, 97, 0, 140, 0, 0, - 100, 1, 000, 99, 0, 0, 0, 0, - 20, 3, 00, 97, 0, 0, 0, 0, - 200, 100, 000, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 000, 99, 0, 0, 0, 0, - 10, 60, 000, 99, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 138, 135, 142, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 95, 0, 0, 0, 0, - 10, 1, 0, 93, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 0, 135, 140, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 0, 0, 0, 0, 0, - 10, 1, 00, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 93, 2, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 255, 1, 99, 0, 0, 0, 0, 0 +uint8_t part2 [] = { + + 100 , 253 , 0 , 97 , 4 , 0 , 135 , 253 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 97 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 97 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 000 , 97 , 1 , 0 , 135 , 0 , + 10 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 00 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 000 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 135 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 00 , 97 , 0 , 0 , 0 , 0 , + 10 , 4 , 00 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 97 , 0 , 140 , 0 , 0 , + 100 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 00 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 000 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 138 , 135 , 142 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 93 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 0 , 135 , 140 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 00 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 93 , 2 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 255 , 1 , 99 , 0 , 0 , 0 , 0 , 0 }; -uint8_t part3[] = -{ - 100, 0, 0, 97, 3, 0, 135, 139, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 97, 0, 139, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 0, 97, 0, 0, 0, 0, - 100, 1, 0, 99, 0, 0, 0, 0, - 20, 3, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 99, 0, 0, 0, 0, - 10, 60, 0, 99, 0, 0, 0, 0, - - 100, 0, 000, 97, 1, 0, 135, 0, - 10, 1, 000, 99, 0, 0, 0, 0, - 100, 2, 00, 99, 0, 0, 0, 0, - 10, 1, 000, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 00, 97, 0, 0, 0, 0, - 10, 4, 00, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 000, 97, 0, 140, 0, 0, - 100, 1, 000, 99, 0, 0, 0, 0, - 20, 3, 00, 97, 0, 0, 0, 0, - 200, 100, 000, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 000, 99, 0, 0, 0, 0, - 10, 60, 000, 99, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 138, 135, 142, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 95, 0, 0, 0, 0, - 10, 1, 0, 93, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 0, 135, 140, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 0, 0, 0, 0, 0, - 10, 1, 00, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 93, 2, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 255, 1, 99, 0, 0, 0, 0, 0 +uint8_t part3 [] = { + + 100 , 0 , 0 , 97 , 3 , 0 , 135 , 139 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 97 , 0 , 139 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 97 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 000 , 97 , 1 , 0 , 135 , 0 , + 10 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 00 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 000 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 00 , 97 , 0 , 0 , 0 , 0 , + 10 , 4 , 00 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 97 , 0 , 140 , 0 , 0 , + 100 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 00 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 000 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 138 , 135 , 142 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 93 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 0 , 135 , 140 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 00 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 93 , 2 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 255 , 1 , 99 , 0 , 0 , 0 , 0 , 0 }; -uint8_t part4[] = -{ - 100, 254, 0, 97, 3, 0, 135, 139, - 10, 1, 0, 99, 0, 0, 0, 0, - 100, 2, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 97, 0, 139, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 0, 97, 0, 0, 0, 0, - 100, 1, 0, 99, 0, 0, 0, 0, - 20, 3, 0, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 0, 99, 0, 0, 0, 0, - 10, 60, 0, 99, 0, 0, 0, 0, - - 100, 0, 000, 97, 1, 0, 135, 0, - 10, 1, 000, 99, 0, 0, 0, 0, - 100, 2, 00, 99, 0, 0, 0, 0, - 10, 1, 000, 97, 0, 0, 0, 0, - 200, 100, 0, 99, 0, 0, 0, 0, - 10, 4, 0, 99, 0, 0, 0, 0, - 20, 2, 00, 97, 0, 0, 0, 0, - 10, 4, 00, 99, 0, 0, 0, 0, - 100, 0, 0, 99, 0, 0, 0, 0, - 200, 100, 000, 97, 0, 140, 0, 0, - 100, 1, 000, 99, 0, 0, 0, 0, - 20, 3, 00, 97, 0, 0, 0, 0, - 200, 100, 000, 99, 0, 0, 0, 0, - 10, 1, 0, 99, 0, 0, 0, 0, - 20, 2, 000, 99, 0, 0, 0, 0, - 10, 60, 000, 99, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 138, 135, 142, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 95, 0, 0, 0, 0, - 10, 1, 0, 93, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 95, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 100, 0, 0, 93, 0, 0, 135, 140, - 10, 1, 0, 95, 0, 0, 0, 0, - 100, 2, 0, 0, 0, 0, 0, 0, - 10, 1, 00, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 4, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 95, 0, 0, 0, 0, - 10, 4, 0, 93, 2, 0, 0, 0, - 100, 0, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 100, 1, 0, 95, 0, 0, 0, 0, - 20, 3, 0, 95, 0, 0, 0, 0, - 200, 100, 0, 93, 0, 0, 0, 0, - 10, 1, 0, 95, 0, 0, 0, 0, - 20, 2, 0, 93, 0, 0, 0, 0, - 10, 60, 0, 95, 0, 0, 0, 0, - - 255, 1, 99, 0, 0, 0, 0, 0 +uint8_t part4 [] = { + + 100 , 254 , 0 , 97 , 3 , 0 , 135 , 139 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 97 , 0 , 139 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 97 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 000 , 97 , 1 , 0 , 135 , 0 , + 10 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 100 , 2 , 00 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 000 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 99 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 00 , 97 , 0 , 0 , 0 , 0 , + 10 , 4 , 00 , 99 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 99 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 97 , 0 , 140 , 0 , 0 , + 100 , 1 , 000 , 99 , 0 , 0 , 0 , 0 , + 20 , 3 , 00 , 97 , 0 , 0 , 0 , 0 , + 200 , 100 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 99 , 0 , 0 , 0 , 0 , + 20 , 2 , 000 , 99 , 0 , 0 , 0 , 0 , + 10 , 60 , 000 , 99 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 138 , 135 , 142 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 93 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 100 , 0 , 0 , 93 , 0 , 0 , 135 , 140 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 100 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , + 10 , 1 , 00 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 95 , 0 , 0 , 0 , 0 , + 10 , 4 , 0 , 93 , 2 , 0 , 0 , 0 , + 100 , 0 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 100 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 3 , 0 , 95 , 0 , 0 , 0 , 0 , + 200 , 100 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 1 , 0 , 95 , 0 , 0 , 0 , 0 , + 20 , 2 , 0 , 93 , 0 , 0 , 0 , 0 , + 10 , 60 , 0 , 95 , 0 , 0 , 0 , 0 , + + 255 , 1 , 99 , 0 , 0 , 0 , 0 , 0 }; -uint8_t part5[] = -{ - 0, 0, 0, 0, 5, 0, 254, 254, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - 0, 0, 0, 0, 0, 0, 253, 253, - - 255, 1, 99, 0, 0, 0, 0, 0 +uint8_t part5 [] = { + + 0 , 0 , 0 , 0 , 5 , 0 , 254 , 254 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + 0 , 0 , 0 , 0 , 0 , 0 , 253 , 253 , + + 255 , 1 , 99 , 0 , 0 , 0 , 0 , 0 + }; -uint8_t* patterns[] = -{ + +uint8_t * patterns [] = { notes, notes, notes, notes, notes2, notes2, notes2, notes2, notes3, notes3, notes3, notes3, @@ -912,645 +974,1149 @@ enum { SYNTH_PAD }; -float drum_timer[ chan_num ]; -float drum_timer2[ chan_num ]; -float drum_timer3[ chan_num ]; - -float hat_timer[ chan_num ]; -float hat_old1[ chan_num ]; -float hat_old2[ chan_num ]; +float + drum_timer1[ Channel_Count ] , + drum_timer2[ Channel_Count ] , + drum_timer3[ Channel_Count ] , + + hat_timer[ Channel_Count ] , + hat_old1[ Channel_Count ] , + hat_old2[ Channel_Count ] , + + bass_tdelta[ Channel_Count ] , + bass_delta[ Channel_Count ] , + bass_timer[ Channel_Count ] , + bass_freq[ Channel_Count ] , + + effect_timer1[ Channel_Count ] , + effect_timer2[ Channel_Count ] ; + +int effect_lowfilter[ Channel_Count ]; + +int syn [ Channel_Count ] = { + SYNTH_DRUM , + SYNTH_HAT , + SYNTH_BASS , + SYNTH_BASS_TINY , + SYNTH_EFFECT , + SYNTH_POLY , + SYNTH_PAD , + SYNTH_PAD +}; -float bass_freq[ chan_num ]; -float bass_tdelta[ chan_num ]; -float bass_delta[ chan_num ]; -float bass_timer[ chan_num ]; -float effect_timer[ chan_num ]; -float effect_timer2[ chan_num ]; -int effect_lowfilter[ chan_num ]; -int syn[ chan_num ] = { SYNTH_DRUM, SYNTH_HAT, SYNTH_BASS, SYNTH_BASS_TINY, SYNTH_EFFECT, SYNTH_POLY, SYNTH_PAD, SYNTH_PAD }; +float + echo_buf1[ Echo_Size * 2 ] , + echo_buf2[ Echo_Size * 2 ] ; -#define echo_size ( one_tick_size * 3 ) -float echo_buf1[ echo_size * 2 ]; -float echo_buf2[ echo_size * 2 ]; int echo_ptr = 0; -#define reverb 16 -int slow_reverb[ reverb ]; -#define max_flanger_size 100 -float flanger_buf1[ max_flanger_size * 3 * 6 ]; -float flanger_buf2[ max_flanger_size * 3 * 6 ]; -float flanger_ptr = 0; -float flanger_size = 0; -float flanger_timer = 0; + +int slow_reverb[ Reverb ]; + + +float + flanger_buf1[ Flanger_Max_Size * 3 * 6 ] , + flanger_buf2[ Flanger_Max_Size * 3 * 6 ] ; + +float + flanger_timer = 0 , + flanger_size = 0 , + flanger_ptr = 0 ; int time_effect = 1; int start_recorder = 0; -int rec_ptr = 0; -int rec_play = 0; -#define rec_size ( one_tick_size * 16 ) -float rec1[ rec_size ]; -float rec2[ rec_size ]; - -static inline void flanger_put( float v1, float v2 ) -{ + +int + rec_play = 0 , + recoder_frame = 0 ; + +#define rec_size ( Tick_Size * 16 ) + + + + +static inline void putFlanger ( float v1 , float v2 ){ + float ptr2 = flanger_ptr - flanger_size; - if( ptr2 < 0 ) ptr2 += ( flanger_size * 2 ); - flanger_buf1[ (int)ptr2 ] += v1 / 2; - flanger_buf2[ (int)ptr2 ] += v2 / 2; + + if(ptr2 < 0) + ptr2 += ( flanger_size * 2 ); + + flanger_buf1[ (int) ptr2 ] += v1 / 2; + flanger_buf2[ (int) ptr2 ] += v2 / 2; } -static inline void flanger_get( float* v1, float* v2 ) -{ - int ptr2; - flanger_buf1[ (int)flanger_ptr ] /= 1.1; - flanger_buf2[ (int)flanger_ptr ] /= 1.1; - *v1 += flanger_buf1[ (int)flanger_ptr ] / 1.5; - *v2 += flanger_buf2[ (int)flanger_ptr ] / 1.5; + +static inline void getFlanger ( float * v1 , float * v2 ){ + + int index = (int) flanger_ptr; + + flanger_buf1[index] /= 1.1; + flanger_buf2[index] /= 1.1; + + * v1 += flanger_buf1[index] / 1.5; + * v2 += flanger_buf2[index] / 1.5; + flanger_ptr++; - if( flanger_ptr >= flanger_size * 2 ) - { - flanger_ptr -= flanger_size * 2; - } + + if( flanger_ptr >= flanger_size * 2 ) + flanger_ptr -= flanger_size * 2; + flanger_timer += 0.0001; - if( rec_play ) - flanger_size = 580; - else - flanger_size = ( ( sin( flanger_timer / 10 ) + 1 ) / 2 ) * ( max_flanger_size - 30 ) + 30; + + if(rec_play){ + flanger_size = 580; + return; + } + + flanger_size = sin( flanger_timer / 10 ) + 1; + flanger_size /= 2; + flanger_size *= ( Flanger_Max_Size - 30 ); + flanger_size += 30; } -static inline void echo_put( float v1, float v2 ) -{ - int ptr2 = echo_ptr - echo_size; - if( ptr2 < 0 ) ptr2 += ( echo_size * 2 ); - if( ptr2 < echo_size ) - echo_buf1[ ptr2 ] += v1 / 2; + +static inline void putEcho ( float v1 , float v2 ){ + + int ptr2 = echo_ptr - Echo_Size; + + if( ptr2 < 0 ) + ptr2 += ( Echo_Size * 2 ); + + if( ptr2 < Echo_Size ) + echo_buf1[ ptr2 ] += v1 / 2; else - echo_buf2[ ptr2 ] += v2 / 2; - //Slow reverb: - int a; - for( a = 0; a < reverb; a ++ ) - { - ptr2 = echo_ptr + slow_reverb[ a ]; - if( ptr2 < 0 ) ptr2 += ( echo_size * 2 ) * ( 1 - ( ptr2 / (echo_size*2) ) ); - if( ptr2 >= ( echo_size * 2 ) ) ptr2 -= ( echo_size * 2 ) * ( ptr2 / (echo_size*2) ); - if( a & 1 ) - echo_buf1[ ptr2 ] += v1 / 6; - else - echo_buf2[ ptr2 ] += v2 / 6; + echo_buf2[ ptr2 ] += v2 / 2; + + + // Slow Reverb + + for ( int a = 0 ; a < Reverb ; a++ ){ + + ptr2 = echo_ptr + slow_reverb[ a ]; + + if( ptr2 < 0 ) + ptr2 += ( Echo_Size * 2 ) * ( 1 - ( ptr2 / ( Echo_Size * 2 ) ) ); + + if( ptr2 >= ( Echo_Size * 2 ) ) + ptr2 -= ( Echo_Size * 2 ) * ( ptr2 / ( Echo_Size * 2 ) ); + + if( a & 1 ) + echo_buf1[ ptr2 ] += v1 / 6; + else + echo_buf2[ ptr2 ] += v2 / 6; } } -static inline void reverb_put( float v1, float v2 ) -{ - int ptr2; - //Slow reverb: - int a; - for( a = 0; a < reverb; a ++ ) - { - ptr2 = echo_ptr + slow_reverb[ a ]; - if( ptr2 < 0 ) ptr2 += ( echo_size * 2 ) * ( 1 - ( ptr2 / (echo_size*2) ) ); - if( ptr2 >= ( echo_size * 2 ) ) ptr2 -= ( echo_size * 2 ) * ( ptr2 / (echo_size*2) ); - if( a & 1 ) - echo_buf1[ ptr2 ] += v1 / 6; - else - echo_buf2[ ptr2 ] += v2 / 6; + +// Slow Reverb + +static inline void putReverb ( float v1 , float v2 ){ + + for( int a = 0 ; a < Reverb ; a++ ){ + + int ptr2 = echo_ptr + slow_reverb[ a ]; + + if( ptr2 < 0 ) + ptr2 += ( Echo_Size * 2 ) * ( 1 - ( ptr2 / (Echo_Size * 2) ) ); + + if( ptr2 >= ( Echo_Size * 2 ) ) + ptr2 -= ( Echo_Size * 2 ) * ( ptr2 / (Echo_Size * 2) ); + + if( a & 1 ) + echo_buf1[ ptr2 ] += v1 / 6; + else + echo_buf2[ ptr2 ] += v2 / 6; } } -static inline void echo_get( float* v1, float* v2 ) -{ - int ptr2; - //echo_buf1[ echo_ptr ] /= 2; - //echo_buf2[ echo_ptr ] /= 2; - *v1 += echo_buf1[ echo_ptr ]; - *v2 += echo_buf2[ echo_ptr ]; + +static inline void getEcho ( float * v1 , float * v2 ){ + + * v1 += echo_buf1[ echo_ptr ]; + * v2 += echo_buf2[ echo_ptr ]; + echo_ptr++; - if( echo_ptr >= echo_size * 2 ) - { - echo_ptr = 0; - int a; - int r = ( ( rand() & 255 ) * (echo_size/2) ) >> 8; - r += echo_size; - for( a = 0; a < ( echo_size * 2 ); a++ ) - { - ptr2 = a - r; - if( ptr2 < 0 ) ptr2 += ( echo_size * 2 ); - echo_buf1[ a ] = ( echo_buf1[ a ] + echo_buf1[ ptr2 ] ) / 2; - echo_buf2[ a ] = ( echo_buf2[ a ] + echo_buf2[ ptr2 ] ) / 2; - } + + if( echo_ptr < Echo_Size * 2 ) + return; + + echo_ptr = 0; + + int r = ( ( rand() & 255 ) * ( Echo_Size / 2 ) ) >> 8; + + r += Echo_Size; + + for ( int a = 0 ; a < ( Echo_Size * 2 ) ; a++ ){ + + int ptr2 = a - r; + + if( ptr2 < 0 ) + ptr2 += ( Echo_Size * 2 ); + + echo_buf1[ a ] = ( echo_buf1[ a ] + echo_buf1[ ptr2 ] ) / 2; + echo_buf2[ a ] = ( echo_buf2[ a ] + echo_buf2[ ptr2 ] ) / 2; } } -int offset = 0; + + +void clearBuffer ( float * buffer , int frames ){ + + int length = frames * 2; + + for ( int offset = 0 ; offset < length ; offset++ ) + buffer [ offset ] = 0; +} + + +/** + * @details End of pattern list is marked with a `0` + */ + +bool finishedPlaying (){ + return patterns[ pattern ] == 0; +} + + float bound = 0.05; +int offset = 0; + + +struct PlayState { + + bool tick_changed; + + uint8_t note; + + int channel; + int offset; + + float * buffer; + float * right; + float * left; +}; + + +#define setFrame( Left , Right ){ \ + \ + * (state -> right) = (Right); \ + * (state -> left) = (Left); \ +} + +#define addChannel( Offset , value ){ \ + \ + int index = state -> offset + (Offset); \ + \ + (state -> buffer)[ index ] += (value); \ +} + +#define addBuffer( left , right ){ \ + \ + addChannel(0,left); \ + addChannel(1,right); \ +} + + +void Pad ( struct PlayState * state ){ + + int channel = state -> channel; + uint8_t note = state -> note; + + float + right = 0 , + left = 0 ; + + if( state -> tick_changed ){ + + if( note ){ + effect_timer1[ channel ] = 1; + bass_freq[ channel ] = square( (float)( note + offset ) / 12.0F ); + bass_tdelta[ channel ] = bass_freq[ channel ] / fps; + bass_timer[ channel ] = 0; + } + + if( note == 254 ) + effect_timer1[ channel ] = 0; + + if( note == 253 ){ + effect_timer1[ channel ] = 0; + bound = 0.1; + } + } + + if( effect_timer1[ channel ] ){ + + effect_timer1[ channel ] *= 0.99998; + + bass_delta[ channel ] += ( bass_tdelta[ channel ] - bass_delta[ channel ] ) / 2000; + bass_timer[ channel ] += bass_delta[ channel ]; + + float bass = bass_timer[channel]; + + right = left = cos( bass * 0.99 ); + + left += + sin( bass * 0.02 * sin( effect_timer1[ channel ] ) ) * + sin( bass ); + + right += cos( bass * 1.01 ); + + right = limit(right,-1,1); + left = limit(left,-1,1); + + } + + putEcho( left / 8 , right / 8 ); + + setFrame(0,0) +} + + +void Poly ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; + + + if( state -> tick_changed ) + if( note ){ + effect_timer1[ channel ] = 1; + bass_freq[ channel ] = square( (float)( note + offset ) / 12.0F ); + bass_tdelta[ channel ] = bass_freq[ channel ] / fps; + bass_timer[ channel ] = 0; + } + + + float + right = 0 , + left = 0 ; + + + if( effect_timer1[ channel ] ){ + + effect_timer1[ channel ] *= 0.99998; + + bass_delta[ channel ] += ( bass_tdelta[ channel ] - bass_delta[ channel ] ) / 1800; + bass_timer[ channel ] += bass_delta[ channel ]; + + + right = left = effect_timer1[ channel ]; + + float bass = bass_timer[ channel ]; + + right *= sin( bass * 1.01 ); + left *= sin( bass ); + + } + + addBuffer( left / 8 , right / 8 ); + putEcho( left / 4 , right / 4 ); + + setFrame(0,0) +} + + +void Effect ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; -void main_callback( float* buf, int len ) -{ - int a; - int s; - int c; - uint8_t* cur_line; - float res1, res2; - float freq; - for( a = 0; a < len; a++ ) { buf[ a << 1 ] = 0; buf[ ( a << 1 ) + 1 ] = 0; } //Clear buffer - //Render: - int tick_changed = 0; - for( a = 0; a < len; a++ ) - { - tick_changed = 0; - if( timer >= one_tick_size ) - { //Increment tick number: - timer = 0; tick++; - } - if( timer == 0 ) tick_changed = 1; - //Synths (channels): - for( s = 0; s < chan_num; s++ ) - { - cur_line = patterns[ cur_pattern ] + ( tick * chan_num ); - if( cur_line[ s ] == 255 ) - { //End of pattern: - tick = 0; - cur_pattern++; - if( patterns[ cur_pattern ] == 0 ) { exit_request = 1; return; } - cur_line = patterns[ cur_pattern ] + ( tick * chan_num ); - } - if( syn[ s ] == 0 ) continue; - switch( syn[ s ] ) - { - case SYNTH_PAD: - if( tick_changed ) - { - if( cur_line[ s ] ) - { - effect_timer[ s ] = 1; - bass_freq[ s ] = pow( 2, (float)( cur_line[ s ] + offset ) / 12.0F ); - bass_tdelta[ s ] = bass_freq[ s ] / srate; - bass_timer[ s ] = 0; - } - if( cur_line[ s ] == 254 ) - effect_timer[ s ] = 0; - if( cur_line[ s ] == 253 ) - { - effect_timer[ s ] = 0; - bound = 0.1; - } - } - if( effect_timer[ s ] ) - { - effect_timer[ s ] *= 0.99998; - bass_delta[ s ] += ( bass_tdelta[ s ] - bass_delta[ s ] ) / 2000; - bass_timer[ s ] += bass_delta[ s ]; - res1 = sin( bass_timer[ s ] ) * sin( bass_timer[ s ] * (sin( effect_timer[ s ] ) * 0.02) ) + cos( bass_timer[ s ] * 0.99 ); - res2 = cos( bass_timer[ s ] * 1.01 ) + cos( bass_timer[ s ] * 0.99 ); - if( res1 > 1 ) res1 = 1; - if( res1 < -1 ) res1 = -1; - if( res2 > 1 ) res2 = 1; - if( res2 < -1 ) res2 = -1; - } - else - { - res1 = 0; - res2 = 0; - } - echo_put( res1 / 8, res2 / 8 ); - res1 = 0; - res2 = 0; - break; - - case SYNTH_POLY: - if( tick_changed ) - { - if( cur_line[ s ] ) - { - effect_timer[ s ] = 1; - bass_freq[ s ] = pow( 2, (float)( cur_line[ s ] + offset ) / 12.0F ); - bass_tdelta[ s ] = bass_freq[ s ] / srate; - bass_timer[ s ] = 0; - } - } - if( effect_timer[ s ] ) - { - effect_timer[ s ] *= 0.99998; - bass_delta[ s ] += ( bass_tdelta[ s ] - bass_delta[ s ] ) / 1800; - bass_timer[ s ] += bass_delta[ s ]; - res1 = sin( bass_timer[ s ] ) * effect_timer[ s ]; - res2 = sin( bass_timer[ s ] * 1.01 ) * effect_timer[ s ]; - } - else - { - res1 = 0; - res2 = 0; - } - buf[ ( a << 1 ) ] += res1 / 8; - buf[ ( a << 1 ) + 1 ] += res2 / 8; - echo_put( res1 / 4, res2 / 4 ); - res1 = 0; - res2 = 0; - break; - - case SYNTH_EFFECT: - if( tick_changed ) - { - if( cur_line[ s ] ) - { - effect_timer[ s ] = 1; - effect_timer2[ s ] = 0; - } - if( cur_line[ s ] == 5 ) { effect_lowfilter[ s ] = 4; rec_play = 1; } - if( cur_line[ s ] == 4 ) effect_lowfilter[ s ] = 3; - if( cur_line[ s ] == 3 ) effect_lowfilter[ s ] = 2; - if( cur_line[ s ] == 2 ) effect_lowfilter[ s ] = 1; - if( cur_line[ s ] == 1 ) effect_lowfilter[ s ] = 0; - } - if( effect_timer[ s ] ) - { - effect_timer[ s ] *= 0.99996; - effect_timer2[ s ] += 0.2; - if( effect_lowfilter[ s ] == 4 ) - { - effect_timer[ s ] = 1; - /*res1 = rec1[ rec_ptr ] * 1.8; - res2 = rec2[ rec_ptr ] * 1.8; - rec_ptr--; - if( rec_ptr < 0 ) rec_ptr = rec_size - 1;*/ - } - else - if( effect_lowfilter[ s ] == 3 ) - { - res2 = sin( ( effect_timer2[ s ] * 1 ) * effect_timer[ s ] ) * effect_timer[ s ]; - res1 = sin( ( effect_timer2[ s ] * 1.5 ) / effect_timer[ s ] ) * effect_timer[ s ]; - } - else - if( effect_lowfilter[ s ] == 2 ) - { - res2 = sin( ( effect_timer2[ s ] / 4 ) / effect_timer[ s ] ) * effect_timer[ s ]; - res1 = sin( ( effect_timer2[ s ] / 3.5 ) / effect_timer[ s ] ) * effect_timer[ s ]; - } - else - if( effect_lowfilter[ s ] == 1 ) - { - res2 = sin( ( effect_timer2[ s ] / 2 ) / effect_timer[ s ] ) * effect_timer[ s ]; - res1 = sin( ( effect_timer2[ s ] / 2.5 ) / effect_timer[ s ] ) * effect_timer[ s ]; - } - else - res2 = res1 = sin( effect_timer2[ s ] / effect_timer[ s ] ) * effect_timer[ s ]; - } - else - { - res1 = 0; - res2 = 0; - } - buf[ ( a << 1 ) ] += ( res1 / 9.0F ); - buf[ ( a << 1 ) + 1 ] += ( res2 / 9.0F ); - if( effect_lowfilter[ s ] != 4 ) - echo_put( res1 / 5, res2 / 5 ); - res1 = 0; - res2 = 0; - break; - - case SYNTH_ACID_BASS: - if( tick_changed ) - { - bass_freq[ s ] = pow( 2, (float)( cur_line[ s ] + offset ) / 12.0F ); - bass_tdelta[ s ] = bass_freq[ s ] / srate; - bass_timer[ s ] = 0; - effect_timer[ s ] = 1; - effect_timer2[ s ] = 0; - } - bass_delta[ s ] += ( bass_tdelta[ s ] - bass_delta[ s ] ) / 300; - bass_timer[ s ] += bass_delta[ s ]; - effect_timer2[ s ] += 0.02 * (32 - (float)tick); - effect_timer[ s ] *= 0.9997; - if( cur_line[ s ] ) - { - res2 = res1 = sin( bass_timer[ s ] ) + ( sin( bass_timer[ s ] * 4.01 ) * 0.9 ); - if( res1 > 0.2 ) res1 = 0.1; - if( res1 < -0.2 ) res1 = -0.1; - if( res2 > 0.2 ) res2 = 0.1; - if( res2 < -0.2 ) res2 = -0.1; - //res1 += ( sin( bass_timer[ s ] ) * cos( effect_timer2[ s ] * effect_timer[ s ] ) * 0.07 ); - //res2 += ( sin( bass_timer[ s ] ) * cos( effect_timer2[ s ] * effect_timer[ s ] ) * 0.07 ); - res1 *= effect_timer[ s ]; - res2 *= effect_timer[ s ]; - } - else { res1 = 0; res2 = 0; } - echo_put( res1, res2 ); - buf[ ( a << 1 ) ] += res1; - buf[ ( a << 1 ) + 1 ] += res2; - break; - - case SYNTH_BASS: - case SYNTH_BASS_TINY: - if( tick_changed ) - { - bass_freq[ s ] = pow( 2, (float)( cur_line[ s ] + offset ) / 12.0F ); - bass_tdelta[ s ] = bass_freq[ s ] / srate; - bass_timer[ s ] = 0; - effect_timer[ s ] = 1; - } - bass_delta[ s ] += ( bass_tdelta[ s ] - bass_delta[ s ] ) / 300; - bass_timer[ s ] += bass_delta[ s ]; - effect_timer[ s ] *= 0.9999; - if( cur_line[ s ] ) - { - res1 = sin( bass_timer[ s ] ) + sin( bass_timer[ s ] * 2.01 ); - res2 = cos( bass_timer[ s ] ) + cos( bass_timer[ s ] * 2.006 ); - if( res1 > bound ) res1 = 0.05; - if( res1 < -bound ) res1 = -0.05; - if( res2 > bound ) res2 = 0.05; - if( res2 < -bound ) res2 = -0.05; - } - else - { - res1 = 0; - res2 = 0; - } - if( bound > 0.1 ) { res1 *= effect_timer[ s ]; res2 *= effect_timer[ s ]; } - if( syn[ s ] == SYNTH_BASS_TINY ) - { - res1 *= 0.9; res2 *= 0.9; - } - else - { - if( !rec_play ) - { - flanger_put( res1, res2 ); - res1 /= 1.5; res2 /= 1.5; - flanger_get( &res1, &res2 ); - } - } - echo_put( res1, res2 ); - buf[ ( a << 1 ) ] += res1; - buf[ ( a << 1 ) + 1 ] += res2; - break; - - case SYNTH_HAT: - if( tick_changed ) - { - if( cur_line[ s ] ) - hat_timer[ s ] = 2; - if( cur_line[ s ] == 254 ) - { - offset ++; - fadeout = 1; - break; - } - if( cur_line[ s ] == 253 ) - { - syn[ 3 ] = SYNTH_ACID_BASS; - start_recorder = 1; - } - if( cur_line[ s ] == 252 ) - offset --; - } - if( cur_line[ s ] == 254 ) break; - if( cur_line[ s ] == 253 ) break; - if( cur_line[ s ] == 252 ) break; - hat_timer[ s ] -= 0.0004; - if( hat_timer[ s ] < 0 ) { hat_timer[ s ] = 0; break; } - res1 = ( ( (float)(myrand()&0x7FFF) / 32000.0F ) - 0.5 ) * ( (float)cur_line[ s ] / 10.0F ); - res2 = ( ( (float)(myrand()&0x7FFF) / 32000.0F ) - 0.5 ) * ( (float)cur_line[ s ] / 10.0F ); - if( res1 > hat_old1[ s ] ) hat_old1[ s ] += 0.03; - if( res1 < hat_old1[ s ] ) hat_old1[ s ] -= 0.03; - if( res2 > hat_old2[ s ] ) hat_old2[ s ] += 0.03; - if( res2 < hat_old2[ s ] ) hat_old2[ s ] -= 0.03; - res1 = hat_old1[ s ]; - res2 = hat_old2[ s ]; - hat_old1[ s ] = res1; - hat_old2[ s ] = res2; - res1 *= hat_timer[ s ] * ( (float)cur_line[ s ] / 100.0F ); - res2 *= hat_timer[ s ] * ( (float)cur_line[ s ] / 100.0F ); - //reverb_put( res1 / 5, res2 / 5 ); - buf[ ( a << 1 ) ] += res1 / 1.8; - buf[ ( a << 1 ) + 1 ] += res2 / 1.8; - break; - - case SYNTH_DRUM: - if( tick_changed ) - { - if( cur_line[ s ] ) - { - drum_timer[ s ] = 1; - drum_timer2[ s ] = 0; - drum_timer3[ s ] = 1; - } - } - drum_timer[ s ] -= 0.001; - drum_timer2[ s ] += 0.03; - drum_timer3[ s ] += 0.003; - if( drum_timer[ s ] < 0 ) { drum_timer[ s ] = 0; break; } - if( 0 ) - { - res1 = drum_timer[ s ] * ( (float)cur_line[ s ] / 12.0F ) * sinf( ((float)cur_line[ s ] / 70) * drum_timer2[ s ] / drum_timer3[ s ] ); - res2 = drum_timer[ s ] * ( (float)cur_line[ s ] / 12.0F ) * sinf( drum_timer2[ s ] / drum_timer3[ s ] + 2 ); - } - else - { - res1 = drum_timer[ s ] * ( (float)cur_line[ s ] / 20.0F ) * sinf( ((float)cur_line[ s ] / 70) * drum_timer2[ s ] / drum_timer3[ s ] ); - res2 = res1; - float d2 = drum_timer[ s ] * ( (float)cur_line[ s ] / 120.0F ) * sinf( drum_timer2[ s ] / drum_timer3[ s ] + 2 ); - if( tick & 1 ) - { - res1 *= 0.3f; - res1 += d2; - } - else - { - res2 *= 0.3f; - res2 += d2; - } - } - float clip = 0.3; - if( res1 > clip ) res1 = clip; - if( res1 < -clip ) res1 = -clip; - if( res2 > clip ) res2 = clip; - if( res2 < -clip ) res2 = -clip; - buf[ ( a << 1 ) ] += res1; - buf[ ( a << 1 ) + 1 ] += res2; - res1 = 0; - res2 = 0; - break; - } - } - //buf[ ( a << 1 ) ] = 0; - //buf[ ( a << 1 ) + 1 ] = 0; - echo_get( &res1, &res2 ); - buf[ ( a << 1 ) ] += res1; - buf[ ( a << 1 ) + 1 ] += res2; - if( start_recorder ) - { - rec1[ rec_ptr ] = buf[ ( a << 1 ) ]; - rec2[ rec_ptr ] = buf[ ( a << 1 ) + 1 ]; - //if( myrand() & 15 ) rec1[ rec_ptr ] += 0.2 * ( (float)( myrand() & 255 ) / 255 ); - //if( myrand() & 15 ) rec2[ rec_ptr ] += 0.2 * ( (float)( myrand() & 255 ) / 255 ); - rec_ptr++; - if( rec_ptr >= rec_size ) - { - start_recorder = 0; - rec_ptr --; - } - } - if( rec_play ) - { - flanger_put( rec1[ rec_ptr ] / 2, rec2[ rec_ptr ] / 2 ); - res1 = 0; res2 = 0; - flanger_get( &res1, &res2 ); - buf[ ( a << 1 ) ] += res1; - buf[ ( a << 1 ) + 1 ] += res2; - rec_ptr--; - if( rec_ptr < 0 ) rec_ptr = rec_size - 1; - } - timer++; - if( fadeout ) - { - fadeout_vol -= 0.000001; - if( fadeout_vol <= 0 ) { fadeout_vol = 0; exit_request = 1; } - buf[ ( a << 1 ) ] *= fadeout_vol; - buf[ ( a << 1 ) + 1 ] *= fadeout_vol; - } + float + right = 0 , + left = 0 ; + + if( state -> tick_changed ){ + + if( note ){ + effect_timer1[ channel ] = 1; + effect_timer2[ channel ] = 0; + } + + if( note == 5 ) + rec_play = 1; + + + effect_lowfilter[ channel ] = note - 1; + } + + if( effect_timer1[ channel ] ){ + + effect_timer1[ channel ] *= 0.99996; + effect_timer2[ channel ] += 0.2; + + int filter = effect_lowfilter[channel]; + + float + effect1 = effect_timer1[channel] , + effect2 = effect_timer2[channel] ; + + + if( filter == 4 ){ + effect_timer1[ channel ] = 1; + } else { + + switch ( filter ){ + case 3 : + left = effect2 * 1.5; + right = effect2 * 1.0; + break; + case 2 : + left = effect2 / 4.0; + right = effect2 / 3.5; + break; + case 1 : + left = effect2 / 2.0; + right = effect2 / 2.5; + break; + default: + right = left = effect2; + } + + right /= effect1; + right = sin(right); + right *= effect1; + + left /= effect1; + left = sin(right); + left *= effect1; + } + } + + addBuffer( left / 9.0F , right / 9.0F ); + + if( effect_lowfilter[ channel ] != 4 ) + putEcho( left / 5 , right / 5 ); + + setFrame(0,0) } -//Utrom ekzamen... Ja ne gotov :) ... na na na -//11 june 2005 - -void render_buf( float* buf, int len ) //buf: LRLRLR..; len - number of frames (one frame = LR (Left+Right channel)); -{ - main_callback( buf, len ); - //Simple DC blocker: - if( volume != 1 ) for( int a = 0; a < len * 2; a++ ) buf[ a ] *= volume; - for( int a = 0; a < len; a++ ) - { - dc_sl += buf[ a * 2 ]; dc_sl /= 2; - dc_sr += buf[ a * 2 + 1 ]; dc_sr /= 2; +void AcidBass ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; + + float + right = 0 , + left = 0 ; + + if( state -> tick_changed ){ + + bass_freq[ channel ] = square( (float)( note + offset ) / 12.0F ); + bass_tdelta[ channel ] = bass_freq[ channel ] / fps; + bass_timer[ channel ] = 0; + + effect_timer1[ channel ] = 1; + effect_timer2[ channel ] = 0; } - for( int a = 0; a < len; a++ ) - { - //Simple DC blocker: - float a2 = (float)(len-a) / len; - float a3 = (float)a / len; - buf[ a * 2 ] -= ( dc_psl * a2 ) + ( dc_sl * a3 ); - buf[ a * 2 + 1 ] -= ( dc_psr * a2 ) + ( dc_sr * a3 ); - //Simple volume compression: - buf[ a * 2 ] /= max_vol; - buf[ a * 2 + 1 ] /= max_vol; - max_vol -= 0.0005; - if( max_vol < 1 ) max_vol = 1; - float t1 = buf[ a * 2 ]; if( t1 < 0 ) t1 = -t1; - float t2 = buf[ a * 2 + 1 ]; if( t2 < 0 ) t2 = -t2; - if( t1 > max_vol ) max_vol = t1; - if( t2 > max_vol ) max_vol = t2; + + bass_delta[ channel ] += ( bass_tdelta[ channel ] - bass_delta[ channel ] ) / 300; + bass_timer[ channel ] += bass_delta[ channel ]; + + effect_timer2[ channel ] += 0.02 * (32 - (float)tick); + effect_timer1[ channel ] *= 0.9997; + + if( note ){ + + float bass = bass_timer[channel]; + + right = left = + sin( bass * 4.01 ) * 0.9 + + sin( bass ) ; + + if( left > 0.2 ) + left = 0.1; + + if( left < -0.2 ) + left = -0.1; + + if( right > 0.2 ) + right = 0.1; + + if( right < -0.2 ) + right = -0.1; + + left *= effect_timer1[ channel ]; + right *= effect_timer1[ channel ]; + } - dc_psl = dc_sl; dc_psr = dc_sr; + + putEcho( left , right ); + addBuffer( left , right ); + + setFrame(left,right) } -void sdl_audio_callback( void* udata, Uint8* stream, int len ) -{ - render_buf( (float*)stream, len / 8 ); + +void Bass ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; + + float + right = 0 , + left = 0 ; + + if( state -> tick_changed ){ + bass_freq[ channel ] = square( (float)( note + offset ) / 12.0F ); + bass_tdelta[ channel ] = bass_freq[ channel ] / fps; + bass_timer[ channel ] = 0; + effect_timer1[ channel ] = 1; + } + + bass_delta[ channel ] += ( bass_tdelta[ channel ] - bass_delta[ channel ] ) / 300; + bass_timer[ channel ] += bass_delta[ channel ]; + + effect_timer1[ channel ] *= 0.9999; + + if( note ){ + + float bass = bass_timer[channel]; + + left = + sin( bass ) + + sin( bass * 2.01 ); + + right = + cos( bass ) + + cos( bass * 2.006 ); + + constrict(left,bound,0.05) + constrict(right,bound,0.05) + + } + + if( bound > 0.1 ){ + right *= effect_timer1[ channel ]; + left *= effect_timer1[ channel ]; + } + + if( syn[ channel ] == SYNTH_BASS_TINY ){ + right *= 0.9; + left *= 0.9; + } else + if( !rec_play ){ + + putFlanger( left , right ); + + right /= 1.5; + left /= 1.5; + + getFlanger( & left , & right ); + } + + putEcho( left , right ); + addBuffer( left , right ); + + setFrame(left,right) +} + + +void Hat ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; + + float left , right; + + if( state -> tick_changed ){ + + if( note ) + hat_timer[ channel ] = 2; + + if( note == 254 ){ + fadeout = 1; + offset++; + return; + } + + if( note == 253 ){ + syn[ 3 ] = SYNTH_ACID_BASS; + start_recorder = 1; + } + + if( note == 252 ) + offset--; + } + + if( note == 254 ) + return; + + if( note == 253 ) + return; + + if( note == 252 ) + return; + + hat_timer[ channel ] -= 0.0004; + + if( hat_timer[ channel ] < 0 ){ + hat_timer[ channel ] = 0; + return; + } + + right = left = ( (float) note / 10.0F ); + + left *= (((float)( randomize() & 0x7FFF ) / 32000.0F ) - 0.5 ); + right *= (((float)( randomize() & 0x7FFF ) / 32000.0F ) - 0.5 ); + + if( left > hat_old1[ channel ] ) + hat_old1[ channel ] += 0.03; + + if( left < hat_old1[ channel ] ) + hat_old1[ channel ] -= 0.03; + + if( right > hat_old2[ channel ] ) + hat_old2[ channel ] += 0.03; + + if( right < hat_old2[ channel ] ) + hat_old2[ channel ] -= 0.03; + + left = hat_old1[ channel ]; + right = hat_old2[ channel ]; + + hat_old1[ channel ] = left; + hat_old2[ channel ] = right; + + float hat_factor = + hat_timer[ channel ] * + ( (float) note / 100.0F ); + + left *= hat_factor; + right *= hat_factor; + + addBuffer( + left / 1.8 , + right / 1.8 + ); + + setFrame(left,right) } -int sound_init() -{ - for( int a = 0; a < reverb; a++ ) slow_reverb[ a ] = ( ( rand() & 2047 ) - 1024 ) << 6; - if( out_mode == 0 ) - { - SDL_Init( 0 ); - SDL_AudioSpec a; - a.freq = srate; - a.format = AUDIO_F32; - a.channels = 2; - a.samples = bufsize; - a.callback = sdl_audio_callback; - a.userdata = NULL; - if( SDL_OpenAudio( &a, NULL ) < 0 ) - { - printf( "Couldn't open audio: %s\n", SDL_GetError() ); - return -1; - } - SDL_PauseAudio( 0 ); - return 0; + +void Drum ( struct PlayState * state ){ + + uint8_t note = state -> note; + int channel = state -> channel; + + float left , right; + + if( state -> tick_changed ) + if( note ){ + drum_timer1[ channel ] = 1; + drum_timer2[ channel ] = 0; + drum_timer3[ channel ] = 1; + } + + drum_timer1[ channel ] -= 0.001; + drum_timer2[ channel ] += 0.030; + drum_timer3[ channel ] += 0.003; + + if( drum_timer1[ channel ] < 0 ){ + drum_timer1[ channel ] = 0; + return; } - if( out_mode == 1 ) - { - FILE* f = fopen( export_file_name, "wb" ); - if( f ) - { - printf( "Exporting to WAV...\n" ); - int fixup1 = 0, fixup2 = 0; - int out_bytes = 0; - int val; - //WAV header: - fwrite( (void*)"RIFF", 1, 4, f ); - val = 4 + 24 + 8 + out_bytes; - fixup1 = ftell( f ); - fwrite( &val, 4, 1, f ); - fwrite( (void*)"WAVE", 1, 4, f ); - //WAV FORMAT: - fwrite( (void*)"fmt ", 1, 4, f ); - val = 16; fwrite( &val, 4, 1, f ); - val = 3; fwrite( &val, 2, 1, f ); //format - val = 2; fwrite( &val, 2, 1, f ); //channels - val = srate; fwrite( &val, 4, 1, f ); //frames per second - val = srate * 2 * 4; fwrite( &val, 4, 1, f ); //bytes per second - val = 2 * 4; fwrite( &val, 2, 1, f ); //block align - val = 4 * 8; fwrite( &val, 2, 1, f ); //bits per sample - //WAV DATA: - fwrite( (void*)"data", 1, 4, f ); - fixup2 = ftell( f ); - fwrite( &out_bytes, 4, 1, f ); - while( !exit_request ) - { - float buf[ bufsize * 2 ]; - render_buf( buf, bufsize ); - out_bytes += fwrite( buf, 1, bufsize * 2 * 4, f ); + + + float drum_ratio = drum_timer2[ channel ] / drum_timer3[ channel ]; + + right = left = + sinf( ( note / 70) * drum_ratio ) * + drum_timer1[ channel ] * + ( note / 20.0F ) ; + + float d2 = + sinf( drum_ratio + 2 ) * + drum_timer1[ channel ] * + ( note / 120.0F ) ; + + if( tick & 1 ){ + left *= 0.3f; + left += d2; + } else { + right *= 0.3f; + right += d2; + } + + + float clip = 0.3; + + right = ranged(right,clip); + left = ranged(left,clip); + + addBuffer(left,right); + + setFrame(0,0) +} + +#undef addChannel +#undef addBuffer +#undef setFrame + + +void ( * Instruments [] )( struct PlayState * ) = + { Drum , Hat , Bass , Bass , AcidBass , Effect , Poly , Pad }; + + +void play ( float * buffer , int length ){ + + static float + recoder_left[ rec_size ] , + recoder_right[ rec_size ] ; + + float left , right; + + + clearBuffer(buffer,length); + + + // Render + + for ( int frame = 0 ; frame < length ; frame++ ){ + + int offset = ( frame << 1 ); + + bool tick_changed = false; + + + // Increment Tick Number + + if( timer >= Tick_Size ){ + timer = 0; + tick++; + } + + if( timer == 0 ) + tick_changed = true; + + + // Synths Channels + + for ( int channel = 0 ; channel < Channel_Count ; channel++ ){ + + uint8_t * row = patterns[ pattern ]; + + row += tick * Channel_Count; + + + // Has reached the end of the current pattern + + if( row[ channel ] == 255 ){ + + pattern++; + tick = 0; + + if(finishedPlaying()){ + stop_execution = true; + return; + } + + row = patterns[ pattern ]; } - fseek( f, fixup1, SEEK_SET ); val = 4 + 24 + 8 + out_bytes; fwrite( &val, 4, 1, f ); - fseek( f, fixup2, SEEK_SET ); val = out_bytes; fwrite( &val, 4, 1, f ); - int frames = out_bytes / ( 4 * 2 ); - printf( "%d bytes; %d frames; %d seconds\n", out_bytes, frames, frames / srate ); - fclose( f ); + + + if( syn[ channel ] == 0 ) + continue; + + + struct PlayState state; + state.tick_changed = tick_changed; + state.channel = channel; + state.buffer = buffer; + state.offset = offset; + state.right = & right; + state.note = row[ channel ]; + state.left = & left; + + ( * Instruments[channel] )( & state ); + } + + getEcho( & left , & right ); + + buffer[ offset + 1 ] += right; + buffer[ offset + 0 ] += left; + + if( start_recorder ){ + + recoder_left[ recoder_frame ] = buffer[ offset + 0 ]; + recoder_right[ recoder_frame ] = buffer[ offset + 1 ]; + + recoder_frame++; + + if( recoder_frame >= rec_size ){ + start_recorder = 0; + recoder_frame --; + } + } + + if( rec_play ){ + + putFlanger( + recoder_left[ recoder_frame ] / 2 , + recoder_right[ recoder_frame ] / 2 + ); + + left = 0; + right = 0; + + getFlanger( & left , & right ); + + buffer[ offset + 1 ] += right; + buffer[ offset + 0 ] += left; + + recoder_frame--; + + if( recoder_frame < 0 ) + recoder_frame = rec_size - 1; + } + + timer++; + + if( fadeout ){ + + fadeout_vol -= 0.000001; + + if( fadeout_vol <= 0 ){ + stop_execution = 1; + fadeout_vol = 0; + } + + buffer[ offset + 0 ] *= fadeout_vol; + buffer[ offset + 1 ] *= fadeout_vol; } - return 0; } - return -1; } -void sound_close() -{ - if( out_mode == 0 ) - { - SDL_CloseAudio(); - SDL_Quit(); + +/** + * @brief + * + * @param buffer Buffer with frames, each + * consisting of a left and right channel. + * + * @param length Number of frames + */ + +void renderBuffer( float * buffer , int length ){ + + play( buffer , length ); + + // Simple DC Blocker + + if( volume != 1 ) + for ( int a = 0 ; a < length * 2 ; a++ ) + buffer[ a ] *= volume; + + for ( int a = 0 ; a < length ; a++ ){ + + dc_s_left += buffer[ a * 2 + 0 ]; + dc_s_right += buffer[ a * 2 + 1 ]; + + dc_s_left /= 2; + dc_s_right /= 2; + } + + for( int a = 0 ; a < length ; a++ ){ + + // Simple DC Bocker + + float + ratio_right = (float)( a ) / length , + ratio_left = (float)( length - a ) / length ; + + buffer[ a * 2 + 0 ] -= + dc_ps_left * ratio_left + + dc_s_left * ratio_right ; + + buffer[ a * 2 + 1 ] -= + dc_ps_right * ratio_left + + dc_s_right * ratio_right ; + + + // Simple Volume Compression + + buffer[ a * 2 + 0 ] /= loudest; + buffer[ a * 2 + 1 ] /= loudest; + + loudest -= 0.0005; + loudest = fmax(loudest,1); + + float + t1 = abs( buffer[ a * 2 + 0 ] ) , + t2 = abs( buffer[ a * 2 + 1 ] ) ; + + loudest = fmax(loudest,fmax(t1,t2)); } + + dc_ps_left = dc_s_left; + dc_ps_right = dc_s_right; +} + + +void onRequestAudio ( void * userData , Uint8 * stream , int length ){ + + // 4 x Bytes Per Float * 2 x LR Channels + + int frames = length / ( 4 * 2 ); + + renderBuffer( (float *) stream , frames ); +} + + + +inline void newline (){ + printf("\n"); } -void int_handler( int param ) -{ - exit_request = 1; +inline void printed ( char * string ){ + printf( " %s\n" , string ); +} + + +typedef FILE * File; + +#define section( name ) \ + fwrite( (void *)(name) , 1 , 4 , file ) + +#define bytes( literal , size ){ \ + \ + int value = (literal); \ + \ + fwrite( & value , (size) , 1 , file ); \ +} + +#define quad( value ) \ + bytes(value,4) + +#define word( value ) \ + bytes(value,2) + + +/** + * @brief Writes the generated bytes to the output file. + * + * @details Check https://docs.fileformat.com/audio/wav/ + * for information on the WAV file format. + */ + +int exportWAV ( const char * path ){ + + File file = fopen( path , "wb" ); + + if( file == NULL ){ + printf("Couldn't create export file to write to."); + return -1; + } + + + printed(">> Exporting to WAV .."); + + + // Header + + section("RIFF"); + + // File Size + + int index_fileSize = ftell( file ); + + quad(0); + + + section("WAVE"); + + + // Format + + section("fmt "); + + // Header Size + quad(16); + + // Format + word(3); + + // Channel Count + word(2); + + // Frames Per Second + quad(fps); + + // Bytes Per Second + quad(fps * 2 * 4) + + // Block Alignment + word(2 * 4); + + // Bits Per Sample + word(4 * 8); + + + // Data + + section("data"); + + + // Data Size + int index_dataSize = ftell( file ); + quad(0); + + + int dataSize = 0; + + while( ! stop_execution ){ + + float buffer [ bufsize * 2 ]; + + renderBuffer( buffer , bufsize ); + + dataSize += fwrite( buffer , 1 , bufsize * 2 * 4 , file ); + } + + + // Insert FileSize + + fseek( file , index_fileSize , SEEK_SET ); + quad(4 + 24 + 8 + dataSize); + + // Insert DataSize + + fseek( file , index_dataSize , SEEK_SET ); + quad(dataSize); + + + int frames = dataSize / ( 4 * 2 ) , + seconds = frames / fps ; + + + newline(); + printed("Data Written"); + printed("============"); + + newline(); + + printf(" Seconds: %d\n",seconds); + printf(" Frames: %d\n",frames); + printf(" Bytes: %d\n",dataSize); + + newline(); + + fclose( file ); + + return 0; } -int main( int argc, char* argv[] ) -{ - signal( SIGINT, int_handler ); - if( argc == 3 ) - { - if( strcmp( argv[ 1 ], "-o" ) == 0 ) - { - export_file_name = argv[ 2 ]; - out_mode = 1; - } +#undef section +#undef bytes +#undef quad +#undef word + + +int playAudio (){ + + SDL_Init( 0 ); + + SDL_AudioSpec a; + a.callback = onRequestAudio; + a.userdata = NULL; + a.channels = 2; + a.samples = bufsize; + a.format = AUDIO_F32; + a.freq = fps; + + if( SDL_OpenAudio( & a , NULL ) < 0 ){ + printf( "Couldn't open audio: %s\n" , SDL_GetError() ); + return -1; } - printf( "\nNightRadio - P.S.\nnightradio@gmail.com\nWarmPlace.ru\n\n" ); - printf( "Usage:\n just play: ./ps\n export to WAV: ./ps -o filename.wav\n" ); - printf( "Press CTRL+C to exit\n\n" ); - if( sound_init() ) return 1; - while( !exit_request ) - { - sleep( 1 ); + + SDL_PauseAudio( 0 ); + + return 0; +} + + +int sound_init ( const char * path ){ + + for ( int a = 0 ; a < Reverb ; a++ ) + slow_reverb[ a ] = ( ( rand() & 2047 ) - 1024 ) << 6; + + switch ( out_mode ){ + case 0 : return playAudio(); + case 1 : return exportWAV( path ); } + + return -1; +} + + +void sound_close (){ + + if( out_mode != 0 ) + return; + + SDL_CloseAudio(); + SDL_Quit(); +} + + +void onInterrupt (){ + stop_execution = 1; +} + +void printInstructions (){ + + newline(); + + printed("NightRadio - P.S."); + printed("================="); + + newline(); + + printed("Website : https://WarmPlace.ru"); + printed("GitHub : https://github.com/pixicoder/PS"); + printed("Email : nightradio@gmail.com"); + + newline(); + newline(); + + printed("Usage"); + printed("====="); + + newline(); + + printed("Export : Pass the filename with '-o \"Music.wav\"'"); + printed("Play : Don't pass any arguments."); + printed("Quit : Press Ctrl+C"); + + newline(); +} + + +int main( int argumentCount , char * arguments [] ){ + + signal( SIGINT , onInterrupt ); + + const char * export_path = NULL; + + if( argumentCount == 3 ) + if( strcmp( arguments[ 1 ] , "-o" ) == 0 ){ + export_path = arguments[ 2 ]; + out_mode = 1; + } + + printInstructions(); + + if(sound_init(export_path)) + return 1; + + while(!stop_execution) + sleep( 1 ); + sound_close(); + return 0; }