diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/SOURCES | 18 | ||||
-rw-r--r-- | apps/plugins/SOURCES.app_build | 4 | ||||
-rw-r--r-- | apps/plugins/SUBDIRS | 7 | ||||
-rw-r--r-- | apps/plugins/SUBDIRS.app_build | 5 | ||||
-rw-r--r-- | apps/plugins/bitmaps/mono/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/bitmaps/native/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/chip8.c | 47 | ||||
-rw-r--r-- | apps/plugins/lua/rocklib.c | 6 | ||||
-rw-r--r-- | apps/plugins/metronome.c | 194 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 2 | ||||
-rw-r--r-- | apps/plugins/oscilloscope.c | 8 | ||||
-rw-r--r-- | apps/plugins/properties.c | 6 | ||||
-rw-r--r-- | apps/plugins/rockboy/rbsound.c | 26 | ||||
-rw-r--r-- | apps/plugins/splitedit.c | 1231 | ||||
-rw-r--r-- | apps/plugins/starfield.c | 3 | ||||
-rw-r--r-- | apps/plugins/vu_meter.c | 8 | ||||
-rw-r--r-- | apps/plugins/zxbox/spmain.c | 4 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxbox.c | 4 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxconfig.h | 2 |
19 files changed, 10 insertions, 1569 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 197f58ef5c..96ad535863 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -46,17 +46,12 @@ remote_control.c | |||
46 | lamp.c | 46 | lamp.c |
47 | #endif /* HAVE_BACKLIGHT */ | 47 | #endif /* HAVE_BACKLIGHT */ |
48 | 48 | ||
49 | |||
50 | |||
51 | #if CONFIG_CODEC == SWCODEC | ||
52 | #if defined(HAVE_RECORDING) && (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN)) | 49 | #if defined(HAVE_RECORDING) && (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN)) |
53 | pitch_detector.c | 50 | pitch_detector.c |
54 | #endif | 51 | #endif |
55 | 52 | ||
56 | mp3_encoder.c | 53 | mp3_encoder.c |
57 | wav2wv.c | 54 | wav2wv.c |
58 | #endif /* CONFIG_CODEC */ | ||
59 | |||
60 | 55 | ||
61 | #if CONFIG_RTC | 56 | #if CONFIG_RTC |
62 | alarmclock.c | 57 | alarmclock.c |
@@ -99,15 +94,6 @@ pictureflow.c | |||
99 | 94 | ||
100 | #endif /* PLUGIN_BUFFER_SIZE <= 0x20000 && HAVE_LCD_BITMAP */ | 95 | #endif /* PLUGIN_BUFFER_SIZE <= 0x20000 && HAVE_LCD_BITMAP */ |
101 | 96 | ||
102 | |||
103 | #if CONFIG_CODEC != SWCODEC | ||
104 | |||
105 | #if defined(HAVE_LCD_BITMAP) | ||
106 | splitedit.c | ||
107 | #endif | ||
108 | |||
109 | #endif /* HWCODEC */ | ||
110 | |||
111 | #if defined(IRIVER_H100_SERIES) | 97 | #if defined(IRIVER_H100_SERIES) |
112 | iriver_flash.c | 98 | iriver_flash.c |
113 | #endif | 99 | #endif |
@@ -207,9 +193,7 @@ superdom.c | |||
207 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 193 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
208 | test_boost.c | 194 | test_boost.c |
209 | #endif | 195 | #endif |
210 | #if CONFIG_CODEC == SWCODEC | ||
211 | test_codec.c | 196 | test_codec.c |
212 | #endif | ||
213 | #ifdef HAVE_JPEG | 197 | #ifdef HAVE_JPEG |
214 | test_core_jpeg.c | 198 | test_core_jpeg.c |
215 | #endif | 199 | #endif |
@@ -232,9 +216,7 @@ test_mem_jpeg.c | |||
232 | #ifdef HAVE_LCD_COLOR | 216 | #ifdef HAVE_LCD_COLOR |
233 | test_resize.c | 217 | test_resize.c |
234 | #endif | 218 | #endif |
235 | #if CONFIG_CODEC == SWCODEC | ||
236 | test_sampr.c | 219 | test_sampr.c |
237 | #endif | ||
238 | #ifdef HAVE_TOUCHSCREEN | 220 | #ifdef HAVE_TOUCHSCREEN |
239 | test_touchscreen.c | 221 | test_touchscreen.c |
240 | #endif | 222 | #endif |
diff --git a/apps/plugins/SOURCES.app_build b/apps/plugins/SOURCES.app_build index 89a8b0ede6..8cfc5881b2 100644 --- a/apps/plugins/SOURCES.app_build +++ b/apps/plugins/SOURCES.app_build | |||
@@ -23,9 +23,7 @@ test_fps.c | |||
23 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 23 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
24 | test_boost.c | 24 | test_boost.c |
25 | #endif | 25 | #endif |
26 | #if CONFIG_CODEC == SWCODEC | ||
27 | test_codec.c | 26 | test_codec.c |
28 | #endif | ||
29 | #ifdef HAVE_JPEG | 27 | #ifdef HAVE_JPEG |
30 | test_core_jpeg.c | 28 | test_core_jpeg.c |
31 | #endif | 29 | #endif |
@@ -46,9 +44,7 @@ test_mem_jpeg.c | |||
46 | #ifdef HAVE_LCD_COLOR | 44 | #ifdef HAVE_LCD_COLOR |
47 | test_resize.c | 45 | test_resize.c |
48 | #endif | 46 | #endif |
49 | #if CONFIG_CODEC == SWCODEC | ||
50 | test_sampr.c | 47 | test_sampr.c |
51 | #endif | ||
52 | test_viewports.c | 48 | test_viewports.c |
53 | #endif /* HAVE_TEST_PLUGINS */ | 49 | #endif /* HAVE_TEST_PLUGINS */ |
54 | 50 | ||
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index 5fd2d433c7..2c8e43c837 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS | |||
@@ -37,7 +37,7 @@ rockboy | |||
37 | pictureflow | 37 | pictureflow |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000 | 40 | #if PLUGIN_BUFFER_SIZE > 0x20000 |
41 | fft | 41 | fft |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -70,9 +70,6 @@ pacbox | |||
70 | doom | 70 | doom |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | /* For all the swcodec targets */ | ||
74 | #if CONFIG_CODEC == SWCODEC | ||
75 | |||
76 | #if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */ | 73 | #if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */ |
77 | midi | 74 | midi |
78 | mikmod | 75 | mikmod |
@@ -91,8 +88,6 @@ pdbox | |||
91 | mpegplayer | 88 | mpegplayer |
92 | #endif | 89 | #endif |
93 | 90 | ||
94 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
95 | |||
96 | /* Lua needs at least 160 KB to work in */ | 91 | /* Lua needs at least 160 KB to work in */ |
97 | #if PLUGIN_BUFFER_SIZE >= 0x80000 | 92 | #if PLUGIN_BUFFER_SIZE >= 0x80000 |
98 | lua | 93 | lua |
diff --git a/apps/plugins/SUBDIRS.app_build b/apps/plugins/SUBDIRS.app_build index 48a2d36d87..95b5e64639 100644 --- a/apps/plugins/SUBDIRS.app_build +++ b/apps/plugins/SUBDIRS.app_build | |||
@@ -10,7 +10,7 @@ lua | |||
10 | lua_scripts | 10 | lua_scripts |
11 | #ifdef HAVE_LCD_BITMAP | 11 | #ifdef HAVE_LCD_BITMAP |
12 | 12 | ||
13 | #if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000 | 13 | #if PLUGIN_BUFFER_SIZE > 0x20000 |
14 | fft | 14 | fft |
15 | #endif | 15 | #endif |
16 | 16 | ||
@@ -23,11 +23,8 @@ pictureflow | |||
23 | #endif /* HAVE_LCD_BITMAP */ | 23 | #endif /* HAVE_LCD_BITMAP */ |
24 | 24 | ||
25 | /* For all the swcodec targets */ | 25 | /* For all the swcodec targets */ |
26 | #if CONFIG_CODEC == SWCODEC | ||
27 | |||
28 | #if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */ | 26 | #if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */ |
29 | mikmod | 27 | mikmod |
30 | #endif | 28 | #endif |
31 | 29 | ||
32 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
33 | #endif /* HAVE_TOUCHSCREEN */ | 30 | #endif /* HAVE_TOUCHSCREEN */ |
diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES index df1397d2e2..ad8b951e45 100644 --- a/apps/plugins/bitmaps/mono/SOURCES +++ b/apps/plugins/bitmaps/mono/SOURCES | |||
@@ -50,12 +50,10 @@ invadrox_fire.6x6x1.bmp | |||
50 | #endif | 50 | #endif |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #if CONFIG_CODEC == SWCODEC | ||
54 | /* MPEGplayer */ | 53 | /* MPEGplayer */ |
55 | mpegplayer_status_icons_8x8x1.bmp | 54 | mpegplayer_status_icons_8x8x1.bmp |
56 | mpegplayer_status_icons_12x12x1.bmp | 55 | mpegplayer_status_icons_12x12x1.bmp |
57 | mpegplayer_status_icons_16x16x1.bmp | 56 | mpegplayer_status_icons_16x16x1.bmp |
58 | #endif | ||
59 | 57 | ||
60 | #if LCD_WIDTH == 160 && LCD_HEIGHT == 128 && LCD_DEPTH < 16 | 58 | #if LCD_WIDTH == 160 && LCD_HEIGHT == 128 && LCD_DEPTH < 16 |
61 | superdom_boarditems.160x128x1.bmp | 59 | superdom_boarditems.160x128x1.bmp |
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 16df8a03d7..22f82800a7 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES | |||
@@ -957,7 +957,7 @@ rockboxlogo.91x32x1.bmp | |||
957 | /* Pitch detector */ | 957 | /* Pitch detector */ |
958 | /* The following preprocessor condition must match the condition */ | 958 | /* The following preprocessor condition must match the condition */ |
959 | /* for pitch detector from plugins/SOURCES */ | 959 | /* for pitch detector from plugins/SOURCES */ |
960 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && \ | 960 | #if defined(HAVE_RECORDING) && \ |
961 | (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN)) | 961 | (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN)) |
962 | #if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16) | 962 | #if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16) |
963 | pitch_notes.320x240x16.bmp | 963 | pitch_notes.320x240x16.bmp |
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index f861d19caa..cb7b85786f 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -1331,39 +1331,11 @@ static byte chip8_keymap[16]; | |||
1331 | static unsigned long starttimer; /* Timer value at the beginning */ | 1331 | static unsigned long starttimer; /* Timer value at the beginning */ |
1332 | static unsigned long cycles; /* Number of update cycles (50Hz) */ | 1332 | static unsigned long cycles; /* Number of update cycles (50Hz) */ |
1333 | 1333 | ||
1334 | #if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR) | ||
1335 | static bool is_playing; | ||
1336 | |||
1337 | /* one frame of bitswapped mp3 data */ | ||
1338 | static unsigned char beep[]={255, | ||
1339 | 223, 28, 35, 0,192,210, 35,226, 72,188,242, 1,128,166, 16, 68,146,252,151, 19, | ||
1340 | 10,180,245,127, 96,184, 3,184, 30, 0,118, 59,128,121,102, 6,212, 0, 97, 6, | ||
1341 | 42, 65, 28,134,192,145, 57, 38,136, 73, 29, 38,132, 15, 21, 70, 91,185, 99,198, | ||
1342 | 15,192, 83, 6, 33,129, 20, 6, 97, 33, 4, 6,245,128, 92, 6, 24, 0, 86, 6, | ||
1343 | 56,129, 44, 24,224, 25, 13, 48, 50, 82,180, 11,251,106,249, 59, 24, 82,175,223, | ||
1344 | 252,119, 76,134,120,236,149,250,247,115,254,145,173,174,168,180,255,107,195, 89, | ||
1345 | 24, 25, 48,131,192, 61, 48, 64, 10,176, 49, 64, 1,152, 50, 32, 8,140, 48, 16, | ||
1346 | 5,129, 51,196,187, 41,177, 23,138, 70, 50, 8, 10,242, 48,192, 3,248,226, 0, | ||
1347 | 20,100, 18, 96, 41, 96, 78,102, 7,201,122, 76,119, 20,137, 37,177, 15,132,224, | ||
1348 | 20, 17,191, 67,147,187,116,211, 41,169, 63,172,182,186,217,155,111,140,104,254, | ||
1349 | 111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85}; | ||
1350 | /* callback to request more mp3 data */ | ||
1351 | static void callback(const void** start, size_t* size) | ||
1352 | { | ||
1353 | *start = beep; /* give it the same frame again */ | ||
1354 | *size = sizeof(beep); | ||
1355 | } | ||
1356 | #endif /* PLATFORM_NATIVE */ | ||
1357 | |||
1358 | /****************************************************************************/ | 1334 | /****************************************************************************/ |
1359 | /* Turn sound on */ | 1335 | /* Turn sound on */ |
1360 | /****************************************************************************/ | 1336 | /****************************************************************************/ |
1361 | static void chip8_sound_on (void) | 1337 | static void chip8_sound_on (void) |
1362 | { | 1338 | { |
1363 | #if(CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR) | ||
1364 | if (!is_playing) | ||
1365 | rb->mp3_play_pause(true); /* kickoff audio */ | ||
1366 | #endif | ||
1367 | } | 1339 | } |
1368 | 1340 | ||
1369 | /****************************************************************************/ | 1341 | /****************************************************************************/ |
@@ -1371,10 +1343,6 @@ static void chip8_sound_on (void) | |||
1371 | /****************************************************************************/ | 1343 | /****************************************************************************/ |
1372 | static void chip8_sound_off (void) | 1344 | static void chip8_sound_off (void) |
1373 | { | 1345 | { |
1374 | #if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR) | ||
1375 | if (!is_playing) | ||
1376 | rb->mp3_play_pause(false); /* pause audio */ | ||
1377 | #endif | ||
1378 | } | 1346 | } |
1379 | 1347 | ||
1380 | /****************************************************************************/ | 1348 | /****************************************************************************/ |
@@ -1576,27 +1544,12 @@ static bool chip8_run(const char* file) | |||
1576 | rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2); | 1544 | rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2); |
1577 | #endif | 1545 | #endif |
1578 | rb->lcd_update(); | 1546 | rb->lcd_update(); |
1579 | #if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR) | ||
1580 | /* init sound */ | ||
1581 | is_playing = rb->mp3_is_playing(); /* would we disturb playback? */ | ||
1582 | if (!is_playing) /* no? then we can make sound */ | ||
1583 | { /* prepare */ | ||
1584 | rb->mp3_play_data(beep, sizeof(beep), callback); | ||
1585 | } | ||
1586 | #endif | ||
1587 | starttimer = *rb->current_tick; | 1547 | starttimer = *rb->current_tick; |
1588 | 1548 | ||
1589 | chip8_iperiod=15; | 1549 | chip8_iperiod=15; |
1590 | cycles = 0; | 1550 | cycles = 0; |
1591 | chip8(); | 1551 | chip8(); |
1592 | 1552 | ||
1593 | #if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR) | ||
1594 | if (!is_playing) | ||
1595 | { /* stop it if we used audio */ | ||
1596 | rb->mp3_play_stop(); /* Stop audio playback */ | ||
1597 | } | ||
1598 | #endif | ||
1599 | |||
1600 | if (chip8_running == 3) { | 1553 | if (chip8_running == 3) { |
1601 | /* unsupported instruction */ | 1554 | /* unsupported instruction */ |
1602 | rb->splash(HZ, "Error: Unsupported" | 1555 | rb->splash(HZ, "Error: Unsupported" |
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index 4fa989da46..e6eb543eda 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c | |||
@@ -487,7 +487,7 @@ RB_WRAP(sound) | |||
487 | lua_pushstring (L, rb->sound_unit(setting)); | 487 | lua_pushstring (L, rb->sound_unit(setting)); |
488 | return 1; | 488 | return 1; |
489 | break; | 489 | break; |
490 | #if ((CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL)) | 490 | #if defined (HAVE_PITCHCONTROL) |
491 | case SOUND_SET_PITCH: | 491 | case SOUND_SET_PITCH: |
492 | rb->sound_set_pitch(setting); | 492 | rb->sound_set_pitch(setting); |
493 | return 1;/*nil*/ | 493 | return 1;/*nil*/ |
@@ -507,7 +507,6 @@ RB_WRAP(sound) | |||
507 | return 1; | 507 | return 1; |
508 | } | 508 | } |
509 | 509 | ||
510 | #if CONFIG_CODEC == SWCODEC | ||
511 | RB_WRAP(pcm) | 510 | RB_WRAP(pcm) |
512 | { | 511 | { |
513 | enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, PCM_ISPAUSED, | 512 | enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, PCM_ISPAUSED, |
@@ -579,7 +578,6 @@ RB_WRAP(mixer_frequency) | |||
579 | lua_pushinteger(L, result); | 578 | lua_pushinteger(L, result); |
580 | return 1; | 579 | return 1; |
581 | } | 580 | } |
582 | #endif /*CONFIG_CODEC == SWCODEC*/ | ||
583 | 581 | ||
584 | /* DEVICE LIGHTING CONTROL */ | 582 | /* DEVICE LIGHTING CONTROL */ |
585 | RB_WRAP(backlight_onoff) | 583 | RB_WRAP(backlight_onoff) |
@@ -953,10 +951,8 @@ static const luaL_Reg rocklib[] = | |||
953 | RB_FUNC(audio), | 951 | RB_FUNC(audio), |
954 | RB_FUNC(playlist), | 952 | RB_FUNC(playlist), |
955 | RB_FUNC(sound), | 953 | RB_FUNC(sound), |
956 | #if CONFIG_CODEC == SWCODEC | ||
957 | RB_FUNC(pcm), | 954 | RB_FUNC(pcm), |
958 | RB_FUNC(mixer_frequency), | 955 | RB_FUNC(mixer_frequency), |
959 | #endif | ||
960 | 956 | ||
961 | /* DEVICE LIGHTING CONTROL */ | 957 | /* DEVICE LIGHTING CONTROL */ |
962 | RB_FUNC(backlight_onoff), | 958 | RB_FUNC(backlight_onoff), |
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 */ | ||
129 | static 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 | }; | ||
195 | static 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 */ |
264 | static signed short tick_sound[] = | 127 | static 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 | ||
942 | static bool sound_trigger = false; | 804 | static 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) | ||
951 | static void play_tick(void){ printf("tick\n"); } | ||
952 | static 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 | |||
959 | static 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 | |||
969 | static 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 | |||
977 | static 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 | { |
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index d5d7c7c019..25eb313591 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c | |||
@@ -1245,7 +1245,6 @@ static void display_options(void) | |||
1245 | } | 1245 | } |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | #if CONFIG_CODEC == SWCODEC | ||
1249 | static void audio_options(void) | 1248 | static void audio_options(void) |
1250 | { | 1249 | { |
1251 | int selected = 0; | 1250 | int selected = 0; |
@@ -1307,7 +1306,6 @@ static void audio_options(void) | |||
1307 | menu_quit = true; | 1306 | menu_quit = true; |
1308 | } | 1307 | } |
1309 | } | 1308 | } |
1310 | #endif | ||
1311 | 1309 | ||
1312 | static void resume_options(void) | 1310 | static void resume_options(void) |
1313 | { | 1311 | { |
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index 8e14f26bd5..2af70204a1 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -902,19 +902,11 @@ static int last_right; | |||
902 | 902 | ||
903 | static void get_peaks(int *left, int *right) | 903 | static void get_peaks(int *left, int *right) |
904 | { | 904 | { |
905 | #if CONFIG_CODEC == SWCODEC | ||
906 | static struct pcm_peaks peaks; | 905 | static struct pcm_peaks peaks; |
907 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, | 906 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, |
908 | &peaks); | 907 | &peaks); |
909 | *left = peaks.left; | 908 | *left = peaks.left; |
910 | *right = peaks.right; | 909 | *right = peaks.right; |
911 | #elif defined (SIMULATOR) | ||
912 | *left = rand() % 0x8000; | ||
913 | *right = rand() % 0x8000; | ||
914 | #else | ||
915 | *left = 0; | ||
916 | *right = 0; | ||
917 | #endif | ||
918 | } | 910 | } |
919 | 911 | ||
920 | static long get_next_delay(void) | 912 | static long get_next_delay(void) |
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 686b4d6d1a..4c172ff108 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -112,13 +112,9 @@ static bool file_properties(const char* selected_file) | |||
112 | 112 | ||
113 | num_properties = 5; | 113 | num_properties = 5; |
114 | 114 | ||
115 | #if (CONFIG_CODEC == SWCODEC) | ||
116 | int fd = rb->open(selected_file, O_RDONLY); | 115 | int fd = rb->open(selected_file, O_RDONLY); |
117 | if (fd >= 0 && | 116 | if (fd >= 0 && |
118 | rb->get_metadata(&id3, fd, selected_file)) | 117 | rb->get_metadata(&id3, fd, selected_file)) |
119 | #else | ||
120 | if (!rb->mp3info(&id3, selected_file)) | ||
121 | #endif | ||
122 | { | 118 | { |
123 | long dur = id3.length / 1000; /* seconds */ | 119 | long dur = id3.length / 1000; /* seconds */ |
124 | rb->snprintf(str_artist, sizeof str_artist, | 120 | rb->snprintf(str_artist, sizeof str_artist, |
@@ -145,9 +141,7 @@ static bool file_properties(const char* selected_file) | |||
145 | num_properties++; | 141 | num_properties++; |
146 | } | 142 | } |
147 | } | 143 | } |
148 | #if (CONFIG_CODEC == SWCODEC) | ||
149 | rb->close(fd); | 144 | rb->close(fd); |
150 | #endif | ||
151 | found = true; | 145 | found = true; |
152 | break; | 146 | break; |
153 | } | 147 | } |
diff --git a/apps/plugins/rockboy/rbsound.c b/apps/plugins/rockboy/rbsound.c index 628879b4b7..c36e24b578 100644 --- a/apps/plugins/rockboy/rbsound.c +++ b/apps/plugins/rockboy/rbsound.c | |||
@@ -7,8 +7,6 @@ struct pcm pcm IBSS_ATTR; | |||
7 | #define N_BUFS 2 | 7 | #define N_BUFS 2 |
8 | #define BUF_SIZE 2048 | 8 | #define BUF_SIZE 2048 |
9 | 9 | ||
10 | #if CONFIG_CODEC == SWCODEC | ||
11 | |||
12 | bool doneplay=1; | 10 | bool doneplay=1; |
13 | bool bufnum=0; | 11 | bool bufnum=0; |
14 | 12 | ||
@@ -88,27 +86,3 @@ int rockboy_pcm_submit(void) | |||
88 | pcm.pos = 0; | 86 | pcm.pos = 0; |
89 | return 1; | 87 | return 1; |
90 | } | 88 | } |
91 | |||
92 | #else | ||
93 | |||
94 | void rockboy_pcm_init(void) | ||
95 | { | ||
96 | pcm.hz = 44100; | ||
97 | pcm.stereo = 1; | ||
98 | pcm.buf = NULL; | ||
99 | pcm.len = 0; | ||
100 | pcm.pos = 0; | ||
101 | } | ||
102 | |||
103 | void rockboy_pcm_close(void) | ||
104 | { | ||
105 | memset(&pcm, 0, sizeof pcm); | ||
106 | } | ||
107 | |||
108 | int rockboy_pcm_submit(void) | ||
109 | { | ||
110 | pcm.pos =0; | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | #endif | ||
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c deleted file mode 100644 index b698e2e18a..0000000000 --- a/apps/plugins/splitedit.c +++ /dev/null | |||
@@ -1,1231 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Philipp Pertermann | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "plugin.h" | ||
23 | |||
24 | |||
25 | |||
26 | /* variable button definitions */ | ||
27 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | ||
28 | #define SPLITEDIT_QUIT BUTTON_OFF | ||
29 | #define SPLITEDIT_PLAY BUTTON_ON | ||
30 | #define SPLITEDIT_SAVE BUTTON_SELECT | ||
31 | #define SPLITEDIT_LOOP_MODE BUTTON_MODE | ||
32 | #define SPLITEDIT_SCALE (BUTTON_REC | BUTTON_UP) | ||
33 | #define SPLITEDIT_SPEED50 (BUTTON_REC | BUTTON_LEFT) | ||
34 | #define SPLITEDIT_SPEED100 (BUTTON_REC | BUTTON_DOWN) | ||
35 | #define SPLITEDIT_SPEED150 (BUTTON_REC | BUTTON_RIGHT) | ||
36 | #define SPLITEDIT_MENU_RUN BUTTON_RIGHT | ||
37 | |||
38 | #elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \ | ||
39 | (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD) | ||
40 | #define SPLITEDIT_QUIT (BUTTON_REC | BUTTON_REW) | ||
41 | #define SPLITEDIT_PLAY (BUTTON_REC | BUTTON_FFWD) | ||
42 | #define SPLITEDIT_SAVE BUTTON_FFWD | ||
43 | #define SPLITEDIT_LOOP_MODE BUTTON_REW | ||
44 | #define SPLITEDIT_SCALE BUTTON_UP | ||
45 | #define SPLITEDIT_SPEED50 BUTTON_LEFT | ||
46 | #define SPLITEDIT_SPEED100 BUTTON_DOWN | ||
47 | #define SPLITEDIT_SPEED150 BUTTON_RIGHT | ||
48 | #define SPLITEDIT_MENU_RUN BUTTON_PLAY | ||
49 | |||
50 | #define SPLITEDIT_RC_QUIT BUTTON_RC_STOP | ||
51 | #endif | ||
52 | |||
53 | #define BMPHEIGHT 7 | ||
54 | #define BMPWIDTH 13 | ||
55 | unsigned char LOOP_BMP[][13] = | ||
56 | { | ||
57 | {0xfc,0x00,0x10,0x11,0x93,0x7f,0x13,0x11,0x7c,0x38,0x10,0x00,0x7c}, /*ALL */ | ||
58 | {0x81,0x03,0x7f,0x03,0x91,0x10,0x10,0x10,0x7c,0x38,0x10,0x00,0x7c}, /*FROM*/ | ||
59 | {0xfc,0x00,0x10,0x10,0x90,0x10,0x7c,0x38,0x11,0x03,0x7f,0x03,0x01}, /*TO */ | ||
60 | {0x80,0x10,0x10,0x11,0x93,0x7f,0x13,0x11,0x10,0x7c,0x38,0x10,0x00}, /*FREE*/ | ||
61 | }; | ||
62 | |||
63 | unsigned char CUT_BMP[] = | ||
64 | { | ||
65 | 0xc1,0x63,0x63,0x36,0xb6,0x1c,0x1c,0x36,0x77,0x55,0x55,0x55,0x32, | ||
66 | }; | ||
67 | |||
68 | unsigned char SCALE_BMP[][13] = | ||
69 | { | ||
70 | {0x80,0x06,0x49,0x66,0xb0,0x18,0x0c,0x06,0x33,0x49,0x30,0x00,0x00}, /*lin*/ | ||
71 | {0x80,0x30,0x78,0x48,0xff,0x7f,0x00,0x7f,0x7f,0x48,0x78,0x30,0x00}, /*db*/ | ||
72 | }; | ||
73 | |||
74 | #define TIMEBAR_Y 9 | ||
75 | #define TIMEBAR_HEIGHT 4 | ||
76 | |||
77 | #define OSCI_X 0 | ||
78 | #define OSCI_Y (TIMEBAR_Y + TIMEBAR_HEIGHT + 1) | ||
79 | #define OSCI_WIDTH LCD_WIDTH | ||
80 | #define OSCI_HEIGHT (LCD_HEIGHT - BMPHEIGHT - OSCI_Y - 1) | ||
81 | |||
82 | /* Indices of the menu items in the save editor, see save_editor */ | ||
83 | #define SE_PART1_SAVE 0 | ||
84 | #define SE_PART1_NAME 1 | ||
85 | #define SE_PART2_SAVE 2 | ||
86 | #define SE_PART2_NAME 3 | ||
87 | #define SE_SAVE 4 | ||
88 | #define SE_COUNT 5 | ||
89 | |||
90 | /* contains the file name of the song that is to be split */ | ||
91 | static char path_mp3[MAX_PATH]; | ||
92 | |||
93 | /* Exit code of this plugin */ | ||
94 | static enum plugin_status splitedit_exit_code = PLUGIN_OK; | ||
95 | |||
96 | /* The range in time that the displayed aerea comprises */ | ||
97 | static unsigned int range_start = 0; | ||
98 | static unsigned int range_end = 0; | ||
99 | |||
100 | /* The range in time that is being looped */ | ||
101 | static unsigned int play_start = 0; | ||
102 | static unsigned int play_end = 0; | ||
103 | |||
104 | /* Point in time (pixel) at which the split mark is set */ | ||
105 | static int split_x = OSCI_X + (OSCI_WIDTH / 2); | ||
106 | |||
107 | /* Contains the peak values */ | ||
108 | static unsigned char osci_buffer[OSCI_WIDTH]; | ||
109 | |||
110 | /* if true peak values from a previous loop are only overwritten | ||
111 | if the new value is greater than the old value */ | ||
112 | static bool osci_valid = false; | ||
113 | |||
114 | /** | ||
115 | * point in time from which on the osci_buffer is invalid | ||
116 | * if set to ~(unsigned int)0 the entire osci_buffer is invalid | ||
117 | */ | ||
118 | static unsigned int validation_start = ~(unsigned int)0; | ||
119 | |||
120 | /* all the visible aerea is looped */ | ||
121 | #define LOOP_MODE_ALL 0 | ||
122 | |||
123 | /* loop starts at split point, ends at right visible border */ | ||
124 | #define LOOP_MODE_FROM 1 | ||
125 | |||
126 | /* loop start at left visible border, ends at split point */ | ||
127 | #define LOOP_MODE_TO 2 | ||
128 | |||
129 | /* let the song play without looping */ | ||
130 | #define LOOP_MODE_FREE 3 | ||
131 | |||
132 | /* see LOOP_MODE_XXX constants vor valid values */ | ||
133 | static int loop_mode = LOOP_MODE_FREE; | ||
134 | |||
135 | /* minimal allowed timespan (ms) of the visible (and looped) aerea*/ | ||
136 | #define MIN_RANGE_SIZE 1000 | ||
137 | |||
138 | /* Format time into buf. | ||
139 | * | ||
140 | * buf - buffer to format to. | ||
141 | * buf_size - size of buffer. | ||
142 | * time - time to format, in milliseconds. | ||
143 | */ | ||
144 | static void format_time_ms(char* buf, int buf_size, int time) | ||
145 | { | ||
146 | rb->snprintf(buf, buf_size, "%d:%02d:%03d", time / 60000, | ||
147 | time % 60000 / 1000, (time % 60000) % 1000); | ||
148 | } | ||
149 | |||
150 | /** | ||
151 | * converts screen coordinate (pixel) to time (ms) | ||
152 | */ | ||
153 | static int xpos_to_time(int xpos) | ||
154 | { | ||
155 | int retval = 0; | ||
156 | int range = range_end - range_start; | ||
157 | retval = range_start + (((xpos - OSCI_X) * range) / OSCI_WIDTH); | ||
158 | return retval; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * Converts time (ms) to screen coordinates (pixel). | ||
163 | */ | ||
164 | static int time_to_xpos(unsigned int time) | ||
165 | { | ||
166 | int retval = OSCI_X; | ||
167 | |||
168 | /* clip the range */ | ||
169 | if (time < range_start) | ||
170 | { | ||
171 | retval = OSCI_X; | ||
172 | } | ||
173 | else | ||
174 | if (time >= range_end) | ||
175 | { | ||
176 | retval = OSCI_X + OSCI_WIDTH; | ||
177 | } | ||
178 | |||
179 | /* do the calculation */ | ||
180 | else | ||
181 | { | ||
182 | int range = range_end - range_start; | ||
183 | retval = OSCI_X + ((time - range_start) * OSCI_WIDTH) / range ; | ||
184 | } | ||
185 | return retval; | ||
186 | } | ||
187 | |||
188 | /** | ||
189 | * Updates the display of the textual data only. | ||
190 | */ | ||
191 | static void update_data(void) | ||
192 | { | ||
193 | char buf[20]; | ||
194 | char timebuf[10]; | ||
195 | int w, h; | ||
196 | |||
197 | /* split point */ | ||
198 | format_time_ms(timebuf, sizeof timebuf, xpos_to_time(split_x)); | ||
199 | rb->snprintf(buf, sizeof buf, "Split at: %s", timebuf); | ||
200 | |||
201 | rb->lcd_getstringsize(buf, &w, &h); | ||
202 | |||
203 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
204 | rb->lcd_fillrect(0, 0, LCD_WIDTH, h); | ||
205 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
206 | rb->lcd_puts(0, 0, buf); | ||
207 | rb->lcd_update_rect(0, 0, LCD_WIDTH, h); | ||
208 | } | ||
209 | |||
210 | /** | ||
211 | * Displays which part of the song is visible | ||
212 | * in the osci. | ||
213 | */ | ||
214 | static void update_timebar(struct mp3entry *mp3) | ||
215 | { | ||
216 | rb->gui_scrollbar_draw | ||
217 | ( | ||
218 | rb->screens[SCREEN_MAIN],0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT, | ||
219 | mp3->length, range_start, range_end, | ||
220 | HORIZONTAL | ||
221 | ); | ||
222 | rb->lcd_update_rect(0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT); | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * Marks the entire area of the osci buffer invalid. | ||
227 | * It will be drawn with new values in the next loop. | ||
228 | */ | ||
229 | static void splitedit_invalidate_osci(void) | ||
230 | { | ||
231 | osci_valid = false; | ||
232 | validation_start = ~(unsigned int)0; | ||
233 | } | ||
234 | |||
235 | /** | ||
236 | * Returns the loop mode. See the LOOP_MODE_XXX constants above. | ||
237 | */ | ||
238 | static int splitedit_get_loop_mode(void) | ||
239 | { | ||
240 | return loop_mode; | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * Updates the icons that display the Fn key hints. | ||
245 | */ | ||
246 | static void update_icons(void) | ||
247 | { | ||
248 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
249 | rb->lcd_fillrect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT); | ||
250 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
251 | |||
252 | /* The CUT icon */ | ||
253 | rb->lcd_mono_bitmap(CUT_BMP, | ||
254 | LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT, | ||
255 | BMPWIDTH, BMPHEIGHT); | ||
256 | |||
257 | /* The loop mode icon */ | ||
258 | rb->lcd_mono_bitmap(LOOP_BMP[splitedit_get_loop_mode()], | ||
259 | LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT, | ||
260 | BMPWIDTH, BMPHEIGHT); | ||
261 | |||
262 | { | ||
263 | static int idx; | ||
264 | if (idx < 0 || idx > 1) idx = 0; | ||
265 | idx = 1 - idx; | ||
266 | rb->lcd_mono_bitmap(SCALE_BMP[idx], | ||
267 | 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT, | ||
268 | BMPWIDTH, BMPHEIGHT); | ||
269 | } | ||
270 | |||
271 | rb->lcd_update_rect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT); | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * Sets the loop mode. See the LOOP_MODE_XXX constants above. | ||
276 | */ | ||
277 | static void splitedit_set_loop_mode(int mode) | ||
278 | { | ||
279 | int old_loop_mode = loop_mode; | ||
280 | /* range restriction */ | ||
281 | loop_mode = mode % (LOOP_MODE_FREE + 1); | ||
282 | switch (loop_mode) | ||
283 | { | ||
284 | case LOOP_MODE_ALL: | ||
285 | play_start = range_start; | ||
286 | play_end = range_end; | ||
287 | break; | ||
288 | |||
289 | case LOOP_MODE_FROM: | ||
290 | play_start = xpos_to_time(split_x); | ||
291 | play_end = range_end; | ||
292 | break; | ||
293 | |||
294 | case LOOP_MODE_TO: | ||
295 | play_start = range_start; | ||
296 | play_end = xpos_to_time(split_x); | ||
297 | break; | ||
298 | |||
299 | case LOOP_MODE_FREE: | ||
300 | /* play_start is used when the song plays beyond its end */ | ||
301 | play_start = range_start; | ||
302 | play_end = range_end; | ||
303 | break; | ||
304 | } | ||
305 | |||
306 | if (loop_mode != old_loop_mode) | ||
307 | { | ||
308 | update_icons(); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | /** | ||
313 | * Readraws the osci without clear. | ||
314 | */ | ||
315 | static void redraw_osci(void) | ||
316 | { | ||
317 | int x; | ||
318 | for (x = 0; x < OSCI_WIDTH; x++) | ||
319 | { | ||
320 | if (osci_buffer[x] > 0) | ||
321 | { | ||
322 | rb->lcd_vline | ||
323 | ( | ||
324 | OSCI_X + x, OSCI_Y + OSCI_HEIGHT - 1, | ||
325 | OSCI_Y + OSCI_HEIGHT - osci_buffer[x] - 1 | ||
326 | ); | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | |||
331 | /** | ||
332 | * Sets the range of time in which the user can finetune the split | ||
333 | * point. The split point is the center of the time range. | ||
334 | */ | ||
335 | static void set_range_by_time( | ||
336 | struct mp3entry *mp3, | ||
337 | unsigned int split_time, | ||
338 | unsigned int range) | ||
339 | { | ||
340 | if (mp3 != NULL) | ||
341 | { | ||
342 | if (range < MIN_RANGE_SIZE) | ||
343 | { | ||
344 | range = MIN_RANGE_SIZE; | ||
345 | } | ||
346 | range_start = (split_time > range / 2) ? (split_time - range / 2) : 0; | ||
347 | range_end = MIN(range_start + range, mp3->length); | ||
348 | split_x = time_to_xpos(split_time); | ||
349 | |||
350 | splitedit_invalidate_osci(); | ||
351 | |||
352 | /* this sets the play_start / play_end */ | ||
353 | splitedit_set_loop_mode(splitedit_get_loop_mode()); | ||
354 | |||
355 | update_data(); | ||
356 | update_timebar(mp3); | ||
357 | } | ||
358 | } | ||
359 | |||
360 | /** | ||
361 | * Set the split point in screen coordinates | ||
362 | */ | ||
363 | static void splitedit_set_split_x(int newx) | ||
364 | { | ||
365 | int minx = split_x - 2 > 0 ? split_x - 2: 0; | ||
366 | |||
367 | /* remove old split point from screen, only if moved */ | ||
368 | if (split_x != newx) | ||
369 | { | ||
370 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
371 | rb->lcd_fillrect(minx, OSCI_Y, 5, 1); | ||
372 | rb->lcd_fillrect(split_x-1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1); | ||
373 | rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2); | ||
374 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
375 | rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT); | ||
376 | } | ||
377 | |||
378 | if (newx >= OSCI_X && newx < OSCI_X + OSCI_WIDTH) | ||
379 | { | ||
380 | split_x = newx; | ||
381 | /* in LOOP_FROM / LOOP_TO modes play_start /play_end must be updated */ | ||
382 | splitedit_set_loop_mode(splitedit_get_loop_mode()); | ||
383 | |||
384 | /* display new split time */ | ||
385 | update_data(); | ||
386 | } | ||
387 | |||
388 | /* display new split point */ | ||
389 | minx = split_x - 2 > 0 ? split_x - 2: 0; | ||
390 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
391 | rb->lcd_fillrect(minx, OSCI_Y, 5, 1); | ||
392 | rb->lcd_fillrect(split_x - 1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1); | ||
393 | rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2); | ||
394 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
395 | rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT); | ||
396 | } | ||
397 | |||
398 | /** | ||
399 | * returns the split point in screen coordinates | ||
400 | */ | ||
401 | static int splitedit_get_split_x(void) | ||
402 | { | ||
403 | return split_x; | ||
404 | } | ||
405 | |||
406 | /** | ||
407 | * Clears the osci area and redraws it | ||
408 | */ | ||
409 | static void update_osci(void) | ||
410 | { | ||
411 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
412 | rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); | ||
413 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
414 | redraw_osci(); | ||
415 | splitedit_set_split_x(splitedit_get_split_x()); | ||
416 | rb->lcd_update_rect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); | ||
417 | } | ||
418 | |||
419 | /** | ||
420 | * Zooms the visable and loopable range by the factor | ||
421 | * (counter / denominator). The split point is used as | ||
422 | * center point of the new selected range. | ||
423 | */ | ||
424 | static void zoom(struct mp3entry *mp3, int counter, int denominator) | ||
425 | { | ||
426 | unsigned char oldbuf[OSCI_WIDTH]; | ||
427 | int oldrange = range_end - range_start; | ||
428 | int range = oldrange * counter / denominator; | ||
429 | int i; | ||
430 | int oldindex; | ||
431 | int oldsplitx; | ||
432 | int splitx; | ||
433 | int split; | ||
434 | |||
435 | /* for stretching / shrinking a second buffer is needed */ | ||
436 | rb->memcpy(&oldbuf, &osci_buffer, sizeof osci_buffer); | ||
437 | |||
438 | /* recalculate the new range and split point */ | ||
439 | oldsplitx = split_x; | ||
440 | split = xpos_to_time(split_x); | ||
441 | |||
442 | set_range_by_time(mp3, split, range); | ||
443 | range = range_end - range_start; | ||
444 | |||
445 | splitx = time_to_xpos(split); | ||
446 | |||
447 | /* strech / shrink the existing osci buffer */ | ||
448 | for (i = 0; i < OSCI_WIDTH; i++) | ||
449 | { | ||
450 | /* oldindex = (i + OSCI_X - splitx) * range / oldrange + oldsplitx ;*/ | ||
451 | oldindex = (i*range / oldrange) + oldsplitx - (splitx*range /oldrange); | ||
452 | if (oldindex >= 0 && oldindex < OSCI_WIDTH) | ||
453 | { | ||
454 | osci_buffer[i] = oldbuf[oldindex]; | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | osci_buffer[i] = 0; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | splitx = time_to_xpos(split); | ||
463 | splitedit_set_split_x(splitx); | ||
464 | splitedit_invalidate_osci(); | ||
465 | |||
466 | } | ||
467 | |||
468 | static void scroll(struct mp3entry *mp3) | ||
469 | { | ||
470 | zoom(mp3, 1, 1); | ||
471 | rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); | ||
472 | update_osci(); | ||
473 | update_data(); | ||
474 | } | ||
475 | |||
476 | /** | ||
477 | * Zooms in by 3/4 | ||
478 | */ | ||
479 | static void splitedit_zoom_in(struct mp3entry *mp3) | ||
480 | { | ||
481 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
482 | rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); | ||
483 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
484 | zoom(mp3, 3, 4); | ||
485 | rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); | ||
486 | update_osci(); | ||
487 | update_data(); | ||
488 | } | ||
489 | |||
490 | /** | ||
491 | * Zooms out by 4/3 | ||
492 | */ | ||
493 | static void splitedit_zoom_out(struct mp3entry *mp3) | ||
494 | { | ||
495 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
496 | rb->lcd_fillrect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); | ||
497 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
498 | zoom(mp3, 4, 3); | ||
499 | rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); | ||
500 | update_osci(); | ||
501 | update_data(); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * Append part_no to the file name. | ||
506 | */ | ||
507 | static void generateFileName(char* file_name, int part_no) | ||
508 | { | ||
509 | if (rb->strlen(file_name) <MAX_PATH) | ||
510 | { | ||
511 | int len = rb->strlen(file_name); | ||
512 | int ext_len = rb->strlen(".mp3"); | ||
513 | if (rb->strcasecmp( | ||
514 | &file_name[len - ext_len], | ||
515 | ".mp3") == 0) | ||
516 | { | ||
517 | int i = 0; | ||
518 | /* shift the extension one position to the right*/ | ||
519 | for (i = len; i > len - ext_len; i--) | ||
520 | { | ||
521 | file_name[i] = file_name[i - 1]; | ||
522 | } | ||
523 | file_name[len - ext_len] = '0' + part_no; | ||
524 | } | ||
525 | else | ||
526 | { | ||
527 | rb->splash(0, "wrong extension"); | ||
528 | rb->button_get(true); | ||
529 | rb->button_get(true); | ||
530 | } | ||
531 | } | ||
532 | else | ||
533 | { | ||
534 | rb->splash(0, "name too long"); | ||
535 | rb->button_get(true); | ||
536 | rb->button_get(true); | ||
537 | |||
538 | } | ||
539 | |||
540 | } | ||
541 | |||
542 | /** | ||
543 | * Copy bytes from src to dest while displaying a progressbar. | ||
544 | * The files must be already open. | ||
545 | */ | ||
546 | static int copy_file( | ||
547 | int dest, | ||
548 | int src, | ||
549 | unsigned int bytes, | ||
550 | int prg_y, | ||
551 | int prg_h) | ||
552 | { | ||
553 | long button; | ||
554 | unsigned char *buffer; | ||
555 | unsigned int i = 0; | ||
556 | ssize_t bytes_read = 1; /* ensure the for loop is executed */ | ||
557 | size_t buffer_size; | ||
558 | buffer = rb->plugin_get_buffer(&buffer_size); | ||
559 | |||
560 | for (i = 0; i < bytes && bytes_read > 0; i += bytes_read) | ||
561 | { | ||
562 | ssize_t bytes_written; | ||
563 | unsigned int bytes_to_read = | ||
564 | bytes - i > buffer_size ? buffer_size : bytes - i; | ||
565 | bytes_read = rb->read(src, buffer, bytes_to_read); | ||
566 | bytes_written = rb->write(dest, buffer, bytes_read); | ||
567 | |||
568 | if (bytes_written < 0) { | ||
569 | rb->splash(0, "Write failed in copy."); | ||
570 | rb->button_get(true); | ||
571 | rb->button_get(true); | ||
572 | return -1; | ||
573 | } | ||
574 | |||
575 | button = rb->button_get(false); | ||
576 | |||
577 | if (button == SPLITEDIT_QUIT | ||
578 | #ifdef SPLITEDIT_RC_QUIT | ||
579 | || button == SPLITEDIT_RC_QUIT: | ||
580 | #endif | ||
581 | ) { | ||
582 | rb->splash(0, "Aborting copy."); | ||
583 | rb->button_get(true); | ||
584 | rb->button_get(true); | ||
585 | return -1; | ||
586 | } | ||
587 | |||
588 | rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, prg_y, LCD_WIDTH, | ||
589 | prg_h, bytes, 0, i, HORIZONTAL); | ||
590 | rb->lcd_update_rect(0, prg_y, LCD_WIDTH, prg_h); | ||
591 | } | ||
592 | |||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | /** | ||
597 | * Save the files, if the file_name is not NULL | ||
598 | */ | ||
599 | static int save( | ||
600 | struct mp3entry *mp3, | ||
601 | char *file_name1, | ||
602 | char *file_name2, | ||
603 | int splittime) | ||
604 | { | ||
605 | int file1, file2, src_file; | ||
606 | unsigned int end = 0; | ||
607 | int retval = 0; | ||
608 | |||
609 | /* Verify that file 1 doesn't exit yet */ | ||
610 | if (file_name1 != NULL) | ||
611 | { | ||
612 | file1 = rb->open(file_name1, O_RDONLY); | ||
613 | if (file1 >= 0) | ||
614 | { | ||
615 | rb->close(file1); | ||
616 | rb->splash(0, "File 1 exists. Please rename."); | ||
617 | rb->button_get(true); | ||
618 | rb->button_get(true); | ||
619 | return -1; | ||
620 | } | ||
621 | } | ||
622 | |||
623 | /* Verify that file 2 doesn't exit yet */ | ||
624 | if (file_name2 != NULL) | ||
625 | { | ||
626 | file2 = rb->open(file_name2, O_RDONLY); | ||
627 | if (file2 >= 0) | ||
628 | { | ||
629 | rb->close(file2); | ||
630 | rb->splash(0, "File 2 exists. Please rename."); | ||
631 | rb->button_get(true); | ||
632 | rb->button_get(true); | ||
633 | return -2; | ||
634 | } | ||
635 | } | ||
636 | |||
637 | /* find the file position of the split point */ | ||
638 | rb->audio_pause(); | ||
639 | rb->audio_ff_rewind(splittime); | ||
640 | rb->yield(); | ||
641 | rb->yield(); | ||
642 | end = rb->audio_get_file_pos(); | ||
643 | |||
644 | /* open the source file */ | ||
645 | src_file = rb->open(mp3->path, O_RDONLY); | ||
646 | if (src_file >= 0) | ||
647 | { | ||
648 | int close_stat = 0; | ||
649 | int x, y; | ||
650 | long offset; | ||
651 | unsigned long last_header = rb->mpeg_get_last_header(); | ||
652 | |||
653 | rb->lcd_getstringsize("M", &x, &y); | ||
654 | |||
655 | /* Find the next frame boundary */ | ||
656 | rb->lseek(src_file, end, SEEK_SET); | ||
657 | rb->find_next_frame(src_file, &offset, 8000, last_header); | ||
658 | rb->lseek(src_file, 0, SEEK_SET); | ||
659 | end += offset; | ||
660 | |||
661 | /* write the file 1 */ | ||
662 | if (file_name1 != NULL) | ||
663 | { | ||
664 | file1 = rb->open (file_name1, O_WRONLY | O_CREAT, 0666); | ||
665 | if (file1 >= 0) | ||
666 | { | ||
667 | int rc = copy_file(file1, src_file, end, y*2 + 1, y -1); | ||
668 | close_stat = rb->close(file1); | ||
669 | |||
670 | if (close_stat != 0) | ||
671 | { | ||
672 | rb->splashf(0, "failed closing file1: error %d", close_stat); | ||
673 | rb->button_get(true); | ||
674 | rb->button_get(true); | ||
675 | } else { | ||
676 | /* If there was an error, cleanup */ | ||
677 | if (rc) { | ||
678 | rb->remove(file_name1); | ||
679 | } | ||
680 | } | ||
681 | } | ||
682 | else | ||
683 | { | ||
684 | rb->splashf(0, "Can't write File1: error %d", file1); | ||
685 | rb->button_get(true); | ||
686 | rb->button_get(true); | ||
687 | retval = -1; | ||
688 | } | ||
689 | } | ||
690 | /* if file1 hasn't been written we're not at the split point yet */ | ||
691 | else | ||
692 | { | ||
693 | if (rb->lseek(src_file, end, SEEK_SET) < (off_t)end) | ||
694 | { | ||
695 | rb->splashf(0, "Src file to short: error %d", src_file); | ||
696 | rb->button_get(true); | ||
697 | rb->button_get(true); | ||
698 | } | ||
699 | } | ||
700 | |||
701 | if (file_name2 != NULL) | ||
702 | { | ||
703 | /* write file 2 */ | ||
704 | file2 = rb->open (file_name2, O_WRONLY | O_CREAT, 0666); | ||
705 | if (file2 >= 0) | ||
706 | { | ||
707 | end = mp3->filesize - end; | ||
708 | int rc = copy_file(file2, src_file, end, y * 5 + 1, y -1); | ||
709 | close_stat = rb->close(file2); | ||
710 | |||
711 | if (close_stat != 0) | ||
712 | { | ||
713 | rb->splashf(0, "failed: closing file2: error %d", | ||
714 | close_stat); | ||
715 | rb->button_get(true); | ||
716 | rb->button_get(true); | ||
717 | } else { | ||
718 | /* If there was an error, cleanup */ | ||
719 | if (rc) { | ||
720 | rb->remove(file_name2); | ||
721 | } | ||
722 | } | ||
723 | } | ||
724 | else | ||
725 | { | ||
726 | rb->splashf(0, "Can't write File2: error %d", file2); | ||
727 | rb->button_get(true); | ||
728 | rb->button_get(true); | ||
729 | retval = -2; | ||
730 | } | ||
731 | } | ||
732 | |||
733 | close_stat = rb->close(src_file); | ||
734 | if (close_stat != 0) | ||
735 | { | ||
736 | rb->splashf(0, "failed: closing src: error %d", close_stat); | ||
737 | rb->button_get(true); | ||
738 | rb->button_get(true); | ||
739 | } | ||
740 | } | ||
741 | else | ||
742 | { | ||
743 | rb->splash(0, "Source file not found"); | ||
744 | rb->button_get(true); | ||
745 | rb->button_get(true); | ||
746 | retval = -3; | ||
747 | } | ||
748 | |||
749 | rb->audio_resume(); | ||
750 | |||
751 | return retval; | ||
752 | } | ||
753 | |||
754 | static void puts_wrapper(int x, int y, const char *str, bool scroll, bool selected) | ||
755 | { | ||
756 | struct line_desc line = LINE_DESC_DEFINIT; | ||
757 | struct screen *lcd = rb->screens[SCREEN_MAIN]; | ||
758 | int w = lcd->getcharwidth(); | ||
759 | int h = lcd->getcharheight(); | ||
760 | |||
761 | line.scroll = scroll; | ||
762 | line.style = selected ? STYLE_INVERT : STYLE_DEFAULT; | ||
763 | |||
764 | rb->screens[0]->put_line(x * w, y * h, &line, str); | ||
765 | } | ||
766 | |||
767 | /** | ||
768 | * Let the user choose which file to save with which name | ||
769 | */ | ||
770 | static void save_editor(struct mp3entry *mp3, int splittime) | ||
771 | { | ||
772 | bool exit_request = false; | ||
773 | int choice = 0; | ||
774 | int button = BUTTON_NONE; | ||
775 | char part1_name [MAX_PATH]; | ||
776 | char part2_name [MAX_PATH]; | ||
777 | bool part1_save = true; | ||
778 | bool part2_save = true; | ||
779 | |||
780 | /* file name for left part */ | ||
781 | rb->strlcpy(part1_name, mp3->path, MAX_PATH); | ||
782 | generateFileName(part1_name, 1); | ||
783 | |||
784 | /* file name for right part */ | ||
785 | rb->strlcpy(part2_name, mp3->path, MAX_PATH); | ||
786 | generateFileName(part2_name, 2); | ||
787 | |||
788 | while (!exit_request) | ||
789 | { | ||
790 | int pos; | ||
791 | rb->lcd_clear_display(); | ||
792 | |||
793 | /* Save file1? */ | ||
794 | puts_wrapper(0, 0, "Save part 1?", false, choice == SE_PART1_SAVE); | ||
795 | puts_wrapper(7, 0, part1_save?"yes":"no", false, false); | ||
796 | |||
797 | /* trim to display the filename without path */ | ||
798 | for (pos = rb->strlen(part1_name); pos > 0; pos--) | ||
799 | { | ||
800 | if (part1_name[pos] == '/') | ||
801 | break; | ||
802 | } | ||
803 | pos++; | ||
804 | |||
805 | /* File name 1 */ | ||
806 | puts_wrapper(0, 1, &part1_name[pos], true, choice == SE_PART1_NAME); | ||
807 | |||
808 | /* Save file2? */ | ||
809 | puts_wrapper(0, 3, "Save part 2?", false, choice == SE_PART2_SAVE); | ||
810 | puts_wrapper(7, 3, part2_save?"yes":"no", false, false); | ||
811 | |||
812 | /* trim to display the filename without path */ | ||
813 | for (pos = rb->strlen(part2_name); pos > 0; pos --) | ||
814 | { | ||
815 | if (part2_name[pos] == '/') | ||
816 | break; | ||
817 | } | ||
818 | pos++; | ||
819 | |||
820 | /* File name 2 */ | ||
821 | puts_wrapper(0, 4, &part2_name[pos], true, choice == SE_PART2_NAME); | ||
822 | |||
823 | /* Save */ | ||
824 | puts_wrapper(0, 6, "Save", false, choice == SE_SAVE); | ||
825 | |||
826 | rb->lcd_update(); | ||
827 | |||
828 | |||
829 | button = rb->button_get(true); | ||
830 | switch (button) | ||
831 | { | ||
832 | case BUTTON_UP: | ||
833 | choice = (choice + SE_COUNT - 1) % SE_COUNT; | ||
834 | break; | ||
835 | |||
836 | case BUTTON_DOWN: | ||
837 | choice = (choice + 1) % SE_COUNT; | ||
838 | break; | ||
839 | |||
840 | case SPLITEDIT_MENU_RUN: | ||
841 | switch (choice) | ||
842 | { | ||
843 | int saved; | ||
844 | |||
845 | case SE_PART1_SAVE: | ||
846 | part1_save = !part1_save; | ||
847 | break; | ||
848 | |||
849 | case SE_PART1_NAME: | ||
850 | rb->kbd_input(part1_name, MAX_PATH, NULL); | ||
851 | break; | ||
852 | |||
853 | case SE_PART2_SAVE: | ||
854 | part2_save = !part2_save; | ||
855 | break; | ||
856 | |||
857 | case SE_PART2_NAME: | ||
858 | rb->kbd_input(part2_name, MAX_PATH, NULL); | ||
859 | break; | ||
860 | |||
861 | case SE_SAVE: | ||
862 | rb->lcd_scroll_stop(); | ||
863 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
864 | rb->lcd_fillrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT); | ||
865 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
866 | saved = save | ||
867 | ( | ||
868 | mp3, | ||
869 | part1_save?part1_name:NULL, | ||
870 | part2_save?part2_name:NULL, | ||
871 | splittime | ||
872 | ); | ||
873 | |||
874 | /* if something failed the user may go on choosing */ | ||
875 | if (saved >= 0) | ||
876 | { | ||
877 | exit_request = true; | ||
878 | } | ||
879 | break; | ||
880 | } | ||
881 | break; | ||
882 | #ifdef SPLITEDIT_RC_QUIT | ||
883 | case SPLITEDIT_RC_QUIT: | ||
884 | #endif | ||
885 | case SPLITEDIT_QUIT: | ||
886 | exit_request = true; | ||
887 | break; | ||
888 | |||
889 | default: | ||
890 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | ||
891 | { | ||
892 | splitedit_exit_code = PLUGIN_USB_CONNECTED; | ||
893 | exit_request = true; | ||
894 | } | ||
895 | break; | ||
896 | } | ||
897 | } | ||
898 | } | ||
899 | |||
900 | /** | ||
901 | * The main loop of the editor | ||
902 | */ | ||
903 | static unsigned long splitedit_editor(struct mp3entry * mp3_to_split, | ||
904 | unsigned int split_time, | ||
905 | unsigned int range) | ||
906 | { | ||
907 | int button = BUTTON_NONE; | ||
908 | int lastbutton = BUTTON_NONE; | ||
909 | struct mp3entry *mp3 = mp3_to_split; | ||
910 | unsigned int last_elapsed = 0; | ||
911 | int lastx = OSCI_X + (OSCI_WIDTH / 2); | ||
912 | int retval = -1; | ||
913 | |||
914 | if (mp3 != NULL) | ||
915 | { | ||
916 | /*unsigned short scheme = SCHEME_SPLIT_EDITOR;*/ | ||
917 | bool exit_request = false; | ||
918 | set_range_by_time(mp3, split_time, range); | ||
919 | splitedit_set_loop_mode(LOOP_MODE_ALL); | ||
920 | update_icons(); | ||
921 | |||
922 | /*while (scheme != SCHEME_RETURN) {*/ | ||
923 | while (!exit_request) | ||
924 | { | ||
925 | unsigned int elapsed ; | ||
926 | int x ; | ||
927 | |||
928 | /* get position */ | ||
929 | elapsed = mp3->elapsed; | ||
930 | x = time_to_xpos(elapsed); | ||
931 | |||
932 | /* are we still in the zoomed range? */ | ||
933 | if (elapsed > play_start && elapsed < play_end) | ||
934 | { | ||
935 | /* read volume info */ | ||
936 | unsigned short volume; | ||
937 | volume = OSCI_HEIGHT / 2; | ||
938 | |||
939 | /* update osci_buffer */ | ||
940 | if (osci_valid || lastx == x) | ||
941 | { | ||
942 | int index = x - OSCI_X; | ||
943 | osci_buffer[index] = MAX(osci_buffer[index], volume); | ||
944 | } | ||
945 | else | ||
946 | { | ||
947 | int i; | ||
948 | osci_buffer[x - OSCI_X] = volume; | ||
949 | for (i = lastx + 1; i < x; i++) | ||
950 | { | ||
951 | osci_buffer[i - OSCI_X] = 0; | ||
952 | } | ||
953 | } | ||
954 | |||
955 | /* make room */ | ||
956 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
957 | rb->lcd_fillrect(lastx + 1, OSCI_Y, x - lastx, OSCI_HEIGHT); | ||
958 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
959 | /* draw a value */ | ||
960 | if (osci_buffer[x - OSCI_X] > 0) | ||
961 | { | ||
962 | int i; | ||
963 | for (i = lastx +1; i <= x; i++) | ||
964 | { | ||
965 | rb->lcd_vline | ||
966 | ( | ||
967 | i, OSCI_Y + OSCI_HEIGHT - 1, | ||
968 | OSCI_Y + OSCI_HEIGHT - osci_buffer[i - OSCI_X]-1 | ||
969 | ); | ||
970 | } | ||
971 | } | ||
972 | |||
973 | /* mark the current position */ | ||
974 | if (lastx != x) | ||
975 | { | ||
976 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
977 | rb->lcd_fillrect(lastx, OSCI_Y, 1, OSCI_HEIGHT); | ||
978 | rb->lcd_fillrect(x, OSCI_Y, 1, OSCI_HEIGHT); | ||
979 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
980 | } | ||
981 | |||
982 | /* mark the split point */ | ||
983 | if ((x > split_x - 2) && (lastx < split_x + 3)) | ||
984 | { | ||
985 | if ((lastx < split_x) && (x >= split_x)) | ||
986 | { | ||
987 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
988 | rb->lcd_fillrect | ||
989 | ( | ||
990 | split_x, OSCI_Y + 2, | ||
991 | 1, OSCI_HEIGHT - 2 | ||
992 | ); | ||
993 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
994 | } | ||
995 | rb->lcd_hline(split_x -2, split_x + 2, OSCI_Y); | ||
996 | rb->lcd_hline(split_x-1, split_x +1,OSCI_Y+1); | ||
997 | } | ||
998 | |||
999 | /* make visible */ | ||
1000 | if (lastx <= x) | ||
1001 | { | ||
1002 | rb->lcd_update_rect(lastx, OSCI_Y, x-lastx+1, OSCI_HEIGHT); | ||
1003 | } | ||
1004 | else | ||
1005 | { | ||
1006 | rb->lcd_update_rect | ||
1007 | ( | ||
1008 | lastx, OSCI_Y, | ||
1009 | OSCI_X + OSCI_WIDTH - lastx, OSCI_HEIGHT | ||
1010 | ); | ||
1011 | rb->lcd_update_rect(0, OSCI_Y, x + 1, OSCI_HEIGHT); | ||
1012 | } | ||
1013 | |||
1014 | lastx = x; | ||
1015 | } | ||
1016 | |||
1017 | /* we're not in the zoom range -> rewind */ | ||
1018 | else | ||
1019 | { | ||
1020 | if (elapsed >= play_end) | ||
1021 | { | ||
1022 | switch (splitedit_get_loop_mode()) | ||
1023 | { | ||
1024 | unsigned int range_width; | ||
1025 | |||
1026 | case LOOP_MODE_ALL: | ||
1027 | case LOOP_MODE_TO: | ||
1028 | rb->audio_pause(); | ||
1029 | rb->audio_ff_rewind(range_start); | ||
1030 | #if (CONFIG_STORAGE & STORAGE_MMC) | ||
1031 | /* MMC is slow - wait some time to allow track reload to finish */ | ||
1032 | rb->sleep(HZ/20); | ||
1033 | if (mp3->elapsed > play_end) /* reload in progress */ | ||
1034 | rb->splash(10*HZ, "Wait - reloading"); | ||
1035 | #endif | ||
1036 | rb->audio_resume(); | ||
1037 | break; | ||
1038 | |||
1039 | case LOOP_MODE_FROM: | ||
1040 | rb->audio_pause(); | ||
1041 | rb->audio_ff_rewind(xpos_to_time(split_x)); | ||
1042 | #if (CONFIG_STORAGE & STORAGE_MMC) | ||
1043 | /* MMC is slow - wait some time to allow track reload to finish */ | ||
1044 | rb->sleep(HZ/20); | ||
1045 | if (mp3->elapsed > play_end) /* reload in progress */ | ||
1046 | rb->splash(10*HZ, "Wait - reloading"); | ||
1047 | #endif | ||
1048 | rb->audio_resume(); | ||
1049 | break; | ||
1050 | |||
1051 | case LOOP_MODE_FREE: | ||
1052 | range_width = range_end - range_start; | ||
1053 | set_range_by_time(mp3, | ||
1054 | range_end + range_width / 2, range_width); | ||
1055 | |||
1056 | /* play_end und play_start anpassen */ | ||
1057 | splitedit_set_loop_mode(LOOP_MODE_FREE); | ||
1058 | rb->memset(osci_buffer, 0, sizeof osci_buffer); | ||
1059 | update_osci(); | ||
1060 | rb->lcd_update(); | ||
1061 | break; | ||
1062 | } | ||
1063 | } | ||
1064 | } | ||
1065 | |||
1066 | button = rb->button_get(false); | ||
1067 | rb->yield(); | ||
1068 | |||
1069 | /* here the evaluation of the key scheme starts. | ||
1070 | All functions the user triggers are called from | ||
1071 | within execute_scheme */ | ||
1072 | /* key_scheme_execute(button, &scheme); */ | ||
1073 | switch (button) | ||
1074 | { | ||
1075 | case SPLITEDIT_PLAY: | ||
1076 | #ifdef SPLITEDIT_PLAY_PRE | ||
1077 | if (lastbutton != SPLITEDIT_PLAY_PRE) | ||
1078 | break; | ||
1079 | #endif | ||
1080 | rb->audio_pause(); | ||
1081 | rb->audio_ff_rewind(xpos_to_time(split_x)); | ||
1082 | rb->audio_resume(); | ||
1083 | break; | ||
1084 | |||
1085 | case BUTTON_UP: | ||
1086 | splitedit_zoom_in(mp3); | ||
1087 | lastx = time_to_xpos(mp3->elapsed); | ||
1088 | break; | ||
1089 | |||
1090 | case BUTTON_DOWN: | ||
1091 | splitedit_zoom_out(mp3); | ||
1092 | lastx = time_to_xpos(mp3->elapsed); | ||
1093 | break; | ||
1094 | |||
1095 | case BUTTON_LEFT: | ||
1096 | case BUTTON_LEFT | BUTTON_REPEAT: | ||
1097 | if (splitedit_get_split_x() > OSCI_X + 2) | ||
1098 | { | ||
1099 | splitedit_set_split_x(splitedit_get_split_x() - 1); | ||
1100 | } | ||
1101 | else | ||
1102 | { | ||
1103 | scroll(mp3); | ||
1104 | lastx = time_to_xpos(mp3->elapsed); | ||
1105 | } | ||
1106 | break; | ||
1107 | |||
1108 | case BUTTON_RIGHT: | ||
1109 | case BUTTON_RIGHT | BUTTON_REPEAT: | ||
1110 | if (splitedit_get_split_x() < OSCI_X + OSCI_WIDTH-3) | ||
1111 | { | ||
1112 | splitedit_set_split_x(splitedit_get_split_x() + 1); | ||
1113 | } | ||
1114 | else | ||
1115 | { | ||
1116 | scroll(mp3); | ||
1117 | lastx = time_to_xpos(mp3->elapsed); | ||
1118 | } | ||
1119 | break; | ||
1120 | |||
1121 | case SPLITEDIT_SAVE: | ||
1122 | save_editor(mp3, xpos_to_time(split_x)); | ||
1123 | rb->lcd_clear_display(); | ||
1124 | update_osci(); | ||
1125 | update_timebar(mp3); | ||
1126 | update_icons(); | ||
1127 | break; | ||
1128 | |||
1129 | case SPLITEDIT_LOOP_MODE: | ||
1130 | splitedit_set_loop_mode(splitedit_get_loop_mode() + 1); | ||
1131 | update_icons(); | ||
1132 | break; | ||
1133 | |||
1134 | case SPLITEDIT_SCALE: | ||
1135 | splitedit_invalidate_osci(); | ||
1136 | update_icons(); | ||
1137 | break; | ||
1138 | |||
1139 | #ifdef SPLITEDIT_RC_QUIT | ||
1140 | case SPLITEDIT_RC_QUIT: | ||
1141 | #endif | ||
1142 | case SPLITEDIT_QUIT: | ||
1143 | exit_request = true; | ||
1144 | break; | ||
1145 | |||
1146 | default: | ||
1147 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) | ||
1148 | { | ||
1149 | splitedit_exit_code = PLUGIN_USB_CONNECTED; | ||
1150 | exit_request = true; | ||
1151 | } | ||
1152 | break; | ||
1153 | |||
1154 | } | ||
1155 | if (button != BUTTON_NONE) | ||
1156 | lastbutton = button; | ||
1157 | |||
1158 | if (validation_start == ~(unsigned int)0) | ||
1159 | { | ||
1160 | if (elapsed < range_end && elapsed > range_start) | ||
1161 | { | ||
1162 | validation_start = elapsed; | ||
1163 | } | ||
1164 | else | ||
1165 | { | ||
1166 | int endx = time_to_xpos(range_end); | ||
1167 | validation_start = xpos_to_time(endx - 2); | ||
1168 | } | ||
1169 | last_elapsed = elapsed + 1; | ||
1170 | } | ||
1171 | else | ||
1172 | { | ||
1173 | if ((last_elapsed <= validation_start) && | ||
1174 | (elapsed > validation_start)) | ||
1175 | { | ||
1176 | osci_valid = true; | ||
1177 | } | ||
1178 | |||
1179 | last_elapsed = elapsed; | ||
1180 | } | ||
1181 | update_data(); | ||
1182 | |||
1183 | if (mp3 != rb->audio_current_track()) | ||
1184 | { | ||
1185 | struct mp3entry *new_mp3 = rb->audio_current_track(); | ||
1186 | if (rb->strncasecmp(path_mp3, new_mp3->path, | ||
1187 | sizeof (path_mp3))) | ||
1188 | { | ||
1189 | rb->splash(0, "Abort due to file change"); | ||
1190 | rb->button_get(true); | ||
1191 | rb->button_get(true); | ||
1192 | exit_request = true; | ||
1193 | } | ||
1194 | else | ||
1195 | { | ||
1196 | mp3 = new_mp3; | ||
1197 | rb->audio_pause(); | ||
1198 | rb->audio_flush_and_reload_tracks(); | ||
1199 | rb->audio_ff_rewind(range_start); | ||
1200 | rb->audio_resume(); | ||
1201 | } | ||
1202 | } | ||
1203 | } | ||
1204 | } | ||
1205 | return retval; | ||
1206 | } | ||
1207 | |||
1208 | enum plugin_status plugin_start(const void* parameter) | ||
1209 | { | ||
1210 | struct mp3entry* mp3; | ||
1211 | |||
1212 | (void)parameter; | ||
1213 | rb->lcd_clear_display(); | ||
1214 | rb->lcd_update(); | ||
1215 | mp3 = rb->audio_current_track(); | ||
1216 | if (mp3 != NULL) | ||
1217 | { | ||
1218 | if (rb->audio_status() & AUDIO_STATUS_PAUSE) | ||
1219 | { | ||
1220 | rb->audio_resume(); | ||
1221 | } | ||
1222 | splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8); | ||
1223 | } | ||
1224 | else | ||
1225 | { | ||
1226 | rb->splash(0, "Play or pause a mp3 file first."); | ||
1227 | rb->button_get(true); | ||
1228 | rb->button_get(true); | ||
1229 | } | ||
1230 | return splitedit_exit_code; | ||
1231 | } | ||
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index dff3c4b4d1..24e2e4c085 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c | |||
@@ -220,7 +220,6 @@ static int plugin_main(void) | |||
220 | rb->sleep(1); | 220 | rb->sleep(1); |
221 | rb->lcd_clear_display(); | 221 | rb->lcd_clear_display(); |
222 | 222 | ||
223 | #if (CONFIG_CODEC == SWCODEC) | ||
224 | /* This will make the stars pulse to the music */ | 223 | /* This will make the stars pulse to the music */ |
225 | if(pulse){ | 224 | if(pulse){ |
226 | 225 | ||
@@ -255,7 +254,7 @@ static int plugin_main(void) | |||
255 | starfield.z_move = avg_peak; | 254 | starfield.z_move = avg_peak; |
256 | 255 | ||
257 | } /* if pulse */ | 256 | } /* if pulse */ |
258 | #endif | 257 | |
259 | starfield_move_and_draw(&starfield); | 258 | starfield_move_and_draw(&starfield); |
260 | 259 | ||
261 | #ifdef HAVE_LCD_COLOR | 260 | #ifdef HAVE_LCD_COLOR |
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index a4d639ede6..d2ba8c992c 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c | |||
@@ -469,10 +469,6 @@ | |||
469 | #endif | 469 | #endif |
470 | #endif | 470 | #endif |
471 | 471 | ||
472 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
473 | #define mas_codec_readreg(x) rand()%MAX_PEAK | ||
474 | #endif | ||
475 | |||
476 | /* Defines x positions on a logarithmic (dBfs) scale. */ | 472 | /* Defines x positions on a logarithmic (dBfs) scale. */ |
477 | unsigned char analog_db_scale[LCD_WIDTH/2]; | 473 | unsigned char analog_db_scale[LCD_WIDTH/2]; |
478 | 474 | ||
@@ -780,13 +776,11 @@ static void draw_digital_minimeters(void) { | |||
780 | 776 | ||
781 | static void analog_meter(void) { | 777 | static void analog_meter(void) { |
782 | 778 | ||
783 | #if (CONFIG_CODEC == SWCODEC) | ||
784 | static struct pcm_peaks peaks; | 779 | static struct pcm_peaks peaks; |
785 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, | 780 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, |
786 | &peaks); | 781 | &peaks); |
787 | #define left_peak peaks.left | 782 | #define left_peak peaks.left |
788 | #define right_peak peaks.right | 783 | #define right_peak peaks.right |
789 | #endif | ||
790 | 784 | ||
791 | if(vumeter_settings.analog_use_db_scale) { | 785 | if(vumeter_settings.analog_use_db_scale) { |
792 | left_needle_top_x = analog_db_scale[left_peak * half_width / MAX_PEAK]; | 786 | left_needle_top_x = analog_db_scale[left_peak * half_width / MAX_PEAK]; |
@@ -837,13 +831,11 @@ static void analog_meter(void) { | |||
837 | } | 831 | } |
838 | 832 | ||
839 | static void digital_meter(void) { | 833 | static void digital_meter(void) { |
840 | #if (CONFIG_CODEC == SWCODEC) | ||
841 | static struct pcm_peaks peaks; | 834 | static struct pcm_peaks peaks; |
842 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, | 835 | rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK, |
843 | &peaks); | 836 | &peaks); |
844 | #define left_peak peaks.left | 837 | #define left_peak peaks.left |
845 | #define right_peak peaks.right | 838 | #define right_peak peaks.right |
846 | #endif | ||
847 | 839 | ||
848 | if(vumeter_settings.digital_use_db_scale) { | 840 | if(vumeter_settings.digital_use_db_scale) { |
849 | num_left_leds = digital_db_scale[left_peak * 44 / MAX_PEAK]; | 841 | num_left_leds = digital_db_scale[left_peak * 44 / MAX_PEAK]; |
diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index e27770c70c..6c6b59c3fb 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c | |||
@@ -290,7 +290,7 @@ static void options_menu(void){ | |||
290 | no_yes, 2, NULL); | 290 | no_yes, 2, NULL); |
291 | if (new_setting != settings.sound ) | 291 | if (new_setting != settings.sound ) |
292 | settings.sound=new_setting; | 292 | settings.sound=new_setting; |
293 | #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR | 293 | #if !defined SIMULATOR |
294 | rb->pcm_play_stop(); | 294 | rb->pcm_play_stop(); |
295 | #endif | 295 | #endif |
296 | break; | 296 | break; |
@@ -318,7 +318,7 @@ static void options_menu(void){ | |||
318 | /* menu */ | 318 | /* menu */ |
319 | static bool zxbox_menu(void) | 319 | static bool zxbox_menu(void) |
320 | { | 320 | { |
321 | #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR | 321 | #if !defined SIMULATOR |
322 | rb->pcm_play_stop(); | 322 | rb->pcm_play_stop(); |
323 | #endif | 323 | #endif |
324 | int selected=0; | 324 | int selected=0; |
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c index d618243b92..4ebc0e0a9e 100644 --- a/apps/plugins/zxbox/zxbox.c +++ b/apps/plugins/zxbox/zxbox.c | |||
@@ -102,9 +102,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
102 | #ifdef USE_GREY | 102 | #ifdef USE_GREY |
103 | grey_show(false); | 103 | grey_show(false); |
104 | grey_release(); | 104 | grey_release(); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR | 107 | #if !defined SIMULATOR |
108 | rb->pcm_play_stop(); | 108 | rb->pcm_play_stop(); |
109 | #endif | 109 | #endif |
110 | 110 | ||
diff --git a/apps/plugins/zxbox/zxconfig.h b/apps/plugins/zxbox/zxconfig.h index 590da99f15..fb93dc5081 100644 --- a/apps/plugins/zxbox/zxconfig.h +++ b/apps/plugins/zxbox/zxconfig.h | |||
@@ -29,7 +29,7 @@ extern int intkeys[5]; | |||
29 | #define SPECT_MEM 1 | 29 | #define SPECT_MEM 1 |
30 | 30 | ||
31 | /* Define if sound driver is available. */ | 31 | /* Define if sound driver is available. */ |
32 | #if CONFIG_CODEC == SWCODEC && !defined SIMULATOR | 32 | #if !defined SIMULATOR |
33 | #define HAVE_SOUND | 33 | #define HAVE_SOUND |
34 | #endif | 34 | #endif |
35 | 35 | ||