summaryrefslogtreecommitdiff
path: root/apps/plugins/metronome.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/metronome.c')
-rw-r--r--apps/plugins/metronome.c194
1 files changed, 0 insertions, 194 deletions
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 75947df618..eec8a92e78 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -123,143 +123,6 @@ const struct button_mapping *plugin_contexts[] =
123}; 123};
124#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) 124#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
125 125
126#if CONFIG_CODEC != SWCODEC
127#ifndef SIMULATOR
128/* MP3 tick sounds */
129static unsigned char tick_sound[] =
130{
131 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
132, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
133, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
134, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
135,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
136,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
137,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
138, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,102, 0, 0
139, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,101,175,184,232, 0, 0, 0
140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
147, 92,189,103, 52,194,128, 2,165,176,176,247, 51, 16, 2, 0, 0, 24, 32, 0, 12
148,204,204,204,204,207,215,221,121,229, 74,224,152, 1,128, 24, 19, 17,207,217,246
149,252,132,212,226,225,192, 16, 0, 0, 0, 0, 32,163,100,111,255, 66, 7, 0, 48
150, 12, 14, 31, 59,255,255,234,112,248,112, 56, 40,223,193, 0, 64, 16, 4, 1, 51
151,229, 29,234, 4,193,240,124, 31, 62, 15,135,255, 7,193, 0, 64, 16, 12, 9, 1
152, 15,168, 16, 1,131,224,254,254,146,224,254, 8, 28, 88,127,255,148, 4, 32,128
153, 32,196,182,166,245,242,214,222,214, 73, 45,110, 52,137, 81, 39,107,255, 44, 76
154,148,140, 8,250, 66,148,195, 43, 3, 41, 15, 18,163, 80, 5, 20,248,174,140,138
155,115, 1,146, 50, 49, 32, 44,201,152,157, 53, 32, 33,157, 8, 34, 85,135, 88,105
156,186,131,252, 48,143,168,162, 44,209,142, 16, 88,221, 10,214, 94, 51, 52, 46,148
157,133, 36, 38,129,165, 36,164,139, 64,211, 11,115,101, 49, 5,136, 33,157, 18,241
158,137, 50, 53,194,213,173, 78,241,108, 1, 24,172,129,146,141,136, 24,119, 73, 51
159, 85,162,138,146, 51, 20,101,163,242,129, 56,212, 84,233, 44, 94, 11, 97,117, 74
160, 73, 37,162, 58, 20,146, 95,203, 31,246, 50, 55,111,214,223,205,213,230, 31,232
161,122,143,183, 14, 39, 91, 57, 15,251,186, 21,185,149, 48, 1,100, 64,200, 16,121
162,155, 72,110, 24,130, 98,255,251,114,196, 7,128, 17,169,247, 95,221,152,128, 10
163, 80, 62,233,185,150,170,113,174,203,251, 59, 12,190,170, 98, 4,156,122,140, 97
164,155, 60, 39, 8,145,195,116, 22,164, 82,118,116, 42,116,157, 68, 88, 70, 64, 93
165, 17, 35, 39,163,118,118, 77, 75, 82,187,215, 89,140, 46,100,112,151, 75, 73,169
166,107,181,157,170,251, 45,140, 75, 34,122, 28,228,146,111,255,235,210, 81,124,114
167,199, 52,180,138,174,207,255,235, 82,210, 64,123, 34,197,101, 47,255,254,234, 91
168, 14, 74, 68,234,219,255,254,206,131,143,162,120,234,210,191,255,245, 93, 18,200
169,225, 42, 29,171,255,254,165,164,196, 24,137, 32,223, 90, 93, 96, 64,217, 78, 35
170, 32, 53,185,107,237, 43,113, 98, 80,107,161, 3,206, 60,192, 10, 78,226,219,199
171,158,146,158, 47, 59, 90,253,154,221,198,138,147,100,150,206,233, 32, 39,192, 73
172, 23, 76,150,201, 41,209,186,217, 37,250,233, 38,198, 34, 24, 18, 33,130, 38,158
173, 73, 54, 69,146, 91, 36,182, 75,235, 64,216,196,138, 9,201, 69,174,138,157,244
174,154,150,208,246, 57, 72, 71, 2,148, 23, 76,115, 83,255,210,218,161, 56, 3, 68
175, 81, 49,190,139,253,125, 81,205, 25, 13,202,146,156,173,255,250,234,194, 8, 69
176, 13,142,255,255,209, 88,136, 73, 6,145,235, 26,142,191,255, 85,100,154,104,178
177,131,213, 0, 34, 0, 17,132, 0, 7,227, 82,135, 11,113, 70,110,105, 94,118, 22
178,255,251,112,196, 9, 0, 17, 61,249, 41,128,101,163, 73,217,178,153, 88,147, 21
179, 48,158,206,220,162,156,221, 7,209, 69, 20,117,163, 69,146, 68,145, 26,131,150
180, 0, 4,132, 41, 8,214,202,209, 69, 30,191,116, 76,156,240, 41,194,118, 23,147
181, 67,173, 87,255,233, 29, 64,216, 73,129, 10, 28,227,197,217, 43,255,254,203, 40
182,140, 48,129, 5,201, 21, 58, 95,255,232,180,168, 70,136,131,201,146,255,254,182
183,169,206, 5,216,101, 36,146,217,109,255,250,169, 38, 96, 35, 69, 51,167,157,191
184,255, 82,158,152,225, 46, 14, 99,235,100,159,255,253, 22, 29,162, 98, 84,108,210
185,202,128, 74, 16, 23,220, 23, 96,152, 17, 5,129,242, 49,137, 75, 60, 81, 16, 80
186, 34,106, 74, 91,255,222, 53, 18, 64,160, 70, 1,195, 5,139,230, 84,118,254,236
187, 44, 29, 1,130,196,195,130,236,237,255,253,156, 84, 60, 17, 10, 10, 19, 35,179
188,255,254,206,198, 14,132,130,194,196, 14, 67,179,255,254,198, 40,144,136, 80, 80
189, 76, 64,228, 57, 29,191,251, 57, 76, 34, 18, 8,132, 66,132,200,114, 59, 63,255
190,220,166, 17, 18, 18, 26, 32,112,201,159,240,144,184,169, 23,127,197,133, 69, 85
191, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
192, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
193, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
194};
195static unsigned char tock_sound[] =
196{
197 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
198, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
199, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
200, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
201,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
202,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
203,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
204, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,100, 0, 0
205, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,187,155,119, 17, 0, 0, 0
206, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
209, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
212, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
213,105, 19,104,212,146,128, 10,164, 41,175,119, 51, 32, 0, 2, 32, 41, 84, 9,130
214, 96,152,109,228, 0, 16, 0, 6, 9,209,163,111,127,154, 48, 0, 0, 0, 0,129
215,194, 19,212,226, 97,240,248,187,255, 65, 0,248,124, 92,255,144,130, 1,192,225
216, 9,249,206,115,138, 16,158,132, 57,206,115,191,242, 16,132,111,212,231, 14, 7
217, 8, 70,243,156,231, 57,206,121,207,200, 66, 16, 92,231,255,134, 0, 0, 0,127
218,244, 60, 60, 51,255,192, 3,195,207,252, 0, 0, 0, 29, 39,244, 60, 48, 3,255
219,195,219,177,171,179,181, 8,157,251,239,155,104,162, 80, 5,194, 16,165,199, 42
220,104,133, 19,109, 88, 96, 61,104,242,117,118, 94,135, 29, 53, 72, 67, 85, 11, 54
221, 59, 64,154,155,128,195, 23,148, 98, 43,186, 43,139, 64,218, 82, 68,160,197,168
222,125, 10, 50, 41, 16,240, 30, 6,228, 52,117, 0, 51,130,146,122,152,109,162,201
223, 45,154, 30, 11, 66, 30, 76, 73,145,224, 52,149, 17, 55,138,112,105, 51, 36,147
224, 22,130, 89, 20,138, 36,114,212,145, 3,199,107,101,213, 25, 21,222,196,209,162
225, 40,168,168,165,162,100,142,163,220,186,250, 72,106, 54, 75, 48,243, 79,153, 54
226,163, 93,179,171,204,144,232,190,115, 19,208, 90,172,244, 40, 98,126, 35,161,234
227,122,143,221, 39,250,159, 61, 35,111,250,213,216, 6,252, 9,138, 17, 64, 1, 13
228, 56, 80, 58,104,184, 37,255,251,114,196, 7,128, 17,250, 1, 97,189,152, 0, 10
229, 44,192, 41,253,151,169,185,237, 56, 3,131,220, 24,180,204,165,221,129,107,210
230,192, 50,130, 26, 22, 26,180, 77, 81, 85,221,146, 33,197,224,198,197,228,146, 89
231,162,210, 69,100,233, 13, 25,145, 61, 19,206,151,232,172,212, 58,162,149, 53, 70
232,234,234, 81,176,186, 28, 39,145,253, 87, 33,130,150, 43, 36,187,245,169,141,200
233, 41,178,191,230, 68,233,170,255,230, 37,227,101,183,237, 49, 56,109,255,115,134
234,232,223,247,156, 62,191,250, 43, 42,169,127,245, 26,160,255,234,151,157,191,215
235, 46,164,223,235, 98,137,118,223,238,112,189,111,247, 56, 94,106, 16, 1, 77, 8
236, 25, 4,204, 0, 0,134, 96, 41,151,170, 74,147,135, 11,136, 28,220, 96,102,179
237, 16,145, 89,202, 11,197,114, 72, 0,241, 77, 88,211, 70,174,171, 10, 11, 84,163
238, 5, 53,191,241,191,106,245,209,114, 21,240,208, 75,172,190,150,103,205,178,252
239, 78, 36,166,139,132,106,231, 86,253,130, 80,178,201,254,193, 68, 20,207,254,206
240, 49, 19, 78,127,253,159,255, 33, 37, 37, 95,238,112,188, 89, 37, 79,238,165, 5
241,163,151,249,168,130,215,255,169,223,249,231, 15,149,191,161,227,209,235, 63,232
242,166, 10,198,183,232,150, 34,119,255,213, 17,255,231, 17, 44, 8, 2, 96, 1,101
243,184,243,226,216, 18, 60,216,132,105,150,250,101,165, 64,237,172,186, 35,114,126
244,255,251,112,196, 12,128,144,142, 3, 44,140,180,241, 1,207, 47,217, 72,244, 10
245, 48, 29, 88, 20, 21,128, 36,231,157,173,100,202, 35,136,119,133,228,209, 55,186
246,218,198,197,208,217, 11,233,178,254,186,137,128, 8,110, 71,253,212,136,138, 45
247,118,253,216, 34, 7, 74, 99,255, 60, 22,144,101,111,209, 72,136,196,175,254, 58
248, 15, 76, 71,249,184,138, 45, 30,127,234,199, 21, 35,191,245, 17, 75, 63,252,120
249,108, 58,223,209,199, 74,141, 91,254,131, 98, 70,255,212, 69, 42, 71,254,172, 54
250,127,252,116,107,255,168,212,194, 64, 61,126, 46,224,170, 52, 71,208,229, 19,209
251,148, 64,203,225,206,126, 29,230, 1,134,123,159,138,246, 67,199, 93,127,253, 50
252,148, 81, 37, 13, 40,145, 8, 37, 12, 6, 4, 49, 67,204,186,186,255,255,213,149
253,149,137, 16,132,162, 8,128, 90, 58, 93, 95,255,121,138, 96,161,131, 3, 33,200
254,118,127,255,238, 83, 5, 10, 8,228, 58, 47,255,252,197, 48, 96,104,116, 84, 84
255, 69,255,251, 24, 40, 80, 74, 69, 69, 64, 96,193, 7,141, 1, 89,203, 5,113, 81
256, 70,255,245,139, 85, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85
257, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
258, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
259, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
260};
261#endif /* SIMULATOR */
262#else
263/* raw PCM */ 126/* raw PCM */
264static signed short tick_sound[] = 127static signed short tick_sound[] =
265{ 128{
@@ -641,7 +504,6 @@ static signed short tock_sound[] =
641,-3,2,-1,0,1,-1,0,0,1,-1,1 504,-3,2,-1,0,1,-1,0,0,1,-1,1
642,-2,3 505,-2,3
643}; 506};
644#endif
645 507
646/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 508/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
647 Utilities from pdbox plugin (Copyright (C) 2009 Wincent Balin) --- am I 509 Utilities from pdbox plugin (Copyright (C) 2009 Wincent Balin) --- am I
@@ -941,51 +803,6 @@ static int bpm_step_counter = 0;
941 803
942static bool sound_trigger = false; 804static bool sound_trigger = false;
943 805
944#if CONFIG_CODEC != SWCODEC
945
946#ifdef SIMULATOR
947
948/* No audio in HWCODEC simulator build. */
949#define MET_IS_PLAYING 0
950#define MET_PLAY_STOP do {} while(0)
951static void play_tick(void){ printf("tick\n"); }
952static void play_tock(void){ printf("tock\n"); }
953
954#else
955
956#define MET_IS_PLAYING rb->mp3_is_playing()
957#define MET_PLAY_STOP rb->mp3_play_stop()
958
959static void callback(const void** start, size_t* size)
960{
961 (void)start; /* unused parameter, avoid warning */
962 *size = 0; /* end of data */
963 sound_active = false;
964 rb->led(0);
965}
966
967/* Wondering: Should one prevent playing again while sound_active == true? */
968
969static void play_tick(void)
970{
971 sound_active = true;
972 rb->led(1);
973 rb->mp3_play_data(tick_sound, sizeof(tick_sound), callback);
974 rb->mp3_play_pause(true); /* kickoff audio */
975}
976
977static void play_tock(void)
978{
979 sound_active = true;
980 rb->led(1);
981 rb->mp3_play_data(tock_sound, sizeof(tock_sound), callback);
982 rb->mp3_play_pause(true); /* kickoff audio */
983}
984
985#endif /* SIMULATOR */
986
987#else /* CONFIG_CODEC == SWCODEC */
988
989#define MET_IS_PLAYING rb->pcm_is_playing() 806#define MET_IS_PLAYING rb->pcm_is_playing()
990#define MET_PLAY_STOP rb->audio_stop() 807#define MET_PLAY_STOP rb->audio_stop()
991 808
@@ -1014,8 +831,6 @@ static void play_tock(void)
1014 rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf)); 831 rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf));
1015} 832}
1016 833
1017#endif /* CONFIG_CODEC != SWCODEC */
1018
1019/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */ 834/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
1020/* TODO: Could use more smart placement, using 835/* TODO: Could use more smart placement, using
1021 lcd_getstringsize() and such. */ 836 lcd_getstringsize() and such. */
@@ -1446,9 +1261,7 @@ static void cleanup(void)
1446 MET_PLAY_STOP; /* stop audio ISR */ 1261 MET_PLAY_STOP; /* stop audio ISR */
1447 tweak_volume(0); 1262 tweak_volume(0);
1448 rb->led(0); 1263 rb->led(0);
1449#if CONFIG_CODEC == SWCODEC
1450 rb->pcm_set_frequency(HW_SAMPR_DEFAULT); 1264 rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
1451#endif
1452} 1265}
1453 1266
1454/* 1267/*
@@ -1786,12 +1599,6 @@ enum plugin_status plugin_start(const void* file)
1786 1599
1787 if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */ 1600 if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */
1788 1601
1789#if (CONFIG_CODEC != SWCODEC)
1790#ifndef SIMULATOR
1791 rb->bitswap(tick_sound, sizeof(tick_sound));
1792 rb->bitswap(tock_sound, sizeof(tock_sound));
1793#endif
1794#else
1795 prepare_buffers(); 1602 prepare_buffers();
1796#if INPUT_SRC_CAPS != 0 1603#if INPUT_SRC_CAPS != 0
1797 /* Select playback */ 1604 /* Select playback */
@@ -1799,7 +1606,6 @@ enum plugin_status plugin_start(const void* file)
1799 rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); 1606 rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
1800#endif 1607#endif
1801 rb->pcm_set_frequency(SAMPR_44); 1608 rb->pcm_set_frequency(SAMPR_44);
1802#endif /* CONFIG_CODEC != SWCODEC */
1803 1609
1804 if(file) 1610 if(file)
1805 { 1611 {