summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-17 00:01:32 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit8cb555460ff79e636a7907fb2589e16db98c8600 (patch)
tree930a3878c7641c9ce045b24f0ade1309e36d5806 /apps/plugins
parent0c4f89370d05056faa789aa9cabcccc4e509fb9f (diff)
downloadrockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.gz
rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.tar.bz2
rockbox-8cb555460ff79e636a7907fb2589e16db98c8600.zip
[3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/SOURCES18
-rw-r--r--apps/plugins/SOURCES.app_build4
-rw-r--r--apps/plugins/SUBDIRS7
-rw-r--r--apps/plugins/SUBDIRS.app_build5
-rw-r--r--apps/plugins/bitmaps/mono/SOURCES2
-rw-r--r--apps/plugins/bitmaps/native/SOURCES2
-rw-r--r--apps/plugins/chip8.c47
-rw-r--r--apps/plugins/lua/rocklib.c6
-rw-r--r--apps/plugins/metronome.c194
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c2
-rw-r--r--apps/plugins/oscilloscope.c8
-rw-r--r--apps/plugins/properties.c6
-rw-r--r--apps/plugins/rockboy/rbsound.c26
-rw-r--r--apps/plugins/splitedit.c1231
-rw-r--r--apps/plugins/starfield.c3
-rw-r--r--apps/plugins/vu_meter.c8
-rw-r--r--apps/plugins/zxbox/spmain.c4
-rw-r--r--apps/plugins/zxbox/zxbox.c4
-rw-r--r--apps/plugins/zxbox/zxconfig.h2
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
lamp.c
#endif /* HAVE_BACKLIGHT */
-
-
-#if CONFIG_CODEC == SWCODEC
#if defined(HAVE_RECORDING) && (defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN))
pitch_detector.c
#endif
mp3_encoder.c
wav2wv.c
-#endif /* CONFIG_CODEC */
-
#if CONFIG_RTC
alarmclock.c
@@ -99,15 +94,6 @@ pictureflow.c
#endif /* PLUGIN_BUFFER_SIZE <= 0x20000 && HAVE_LCD_BITMAP */
-
-#if CONFIG_CODEC != SWCODEC
-
-#if defined(HAVE_LCD_BITMAP)
-splitedit.c
-#endif
-
-#endif /* HWCODEC */
-
#if defined(IRIVER_H100_SERIES)
iriver_flash.c
#endif
@@ -207,9 +193,7 @@ superdom.c
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
test_boost.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_codec.c
-#endif
#ifdef HAVE_JPEG
test_core_jpeg.c
#endif
@@ -232,9 +216,7 @@ test_mem_jpeg.c
#ifdef HAVE_LCD_COLOR
test_resize.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_sampr.c
-#endif
#ifdef HAVE_TOUCHSCREEN
test_touchscreen.c
#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
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
test_boost.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_codec.c
-#endif
#ifdef HAVE_JPEG
test_core_jpeg.c
#endif
@@ -46,9 +44,7 @@ test_mem_jpeg.c
#ifdef HAVE_LCD_COLOR
test_resize.c
#endif
-#if CONFIG_CODEC == SWCODEC
test_sampr.c
-#endif
test_viewports.c
#endif /* HAVE_TEST_PLUGINS */
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
pictureflow
#endif
-#if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000
+#if PLUGIN_BUFFER_SIZE > 0x20000
fft
#endif
@@ -70,9 +70,6 @@ pacbox
doom
#endif
-/* For all the swcodec targets */
-#if CONFIG_CODEC == SWCODEC
-
#if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */
midi
mikmod
@@ -91,8 +88,6 @@ pdbox
mpegplayer
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
-
/* Lua needs at least 160 KB to work in */
#if PLUGIN_BUFFER_SIZE >= 0x80000
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
lua_scripts
#ifdef HAVE_LCD_BITMAP
-#if CONFIG_CODEC == SWCODEC && PLUGIN_BUFFER_SIZE > 0x20000
+#if PLUGIN_BUFFER_SIZE > 0x20000
fft
#endif
@@ -23,11 +23,8 @@ pictureflow
#endif /* HAVE_LCD_BITMAP */
/* For all the swcodec targets */
-#if CONFIG_CODEC == SWCODEC
-
#if MEMORYSIZE > 2 /* we need a lot of RAM for instruments */
mikmod
#endif
-#endif /* CONFIG_CODEC == SWCODEC */
#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
#endif
#endif
-#if CONFIG_CODEC == SWCODEC
/* MPEGplayer */
mpegplayer_status_icons_8x8x1.bmp
mpegplayer_status_icons_12x12x1.bmp
mpegplayer_status_icons_16x16x1.bmp
-#endif
#if LCD_WIDTH == 160 && LCD_HEIGHT == 128 && LCD_DEPTH < 16
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
/* Pitch detector */
/* The following preprocessor condition must match the condition */
/* for pitch detector from plugins/SOURCES */
-#if (CONFIG_CODEC == SWCODEC) && defined(HAVE_RECORDING) && \
+#if defined(HAVE_RECORDING) && \
(defined(HAVE_LINE_IN) || defined(HAVE_MIC_IN))
#if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16)
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];
static unsigned long starttimer; /* Timer value at the beginning */
static unsigned long cycles; /* Number of update cycles (50Hz) */
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
-static bool is_playing;
-
-/* one frame of bitswapped mp3 data */
-static unsigned char beep[]={255,
-223, 28, 35, 0,192,210, 35,226, 72,188,242, 1,128,166, 16, 68,146,252,151, 19,
- 10,180,245,127, 96,184, 3,184, 30, 0,118, 59,128,121,102, 6,212, 0, 97, 6,
- 42, 65, 28,134,192,145, 57, 38,136, 73, 29, 38,132, 15, 21, 70, 91,185, 99,198,
- 15,192, 83, 6, 33,129, 20, 6, 97, 33, 4, 6,245,128, 92, 6, 24, 0, 86, 6,
- 56,129, 44, 24,224, 25, 13, 48, 50, 82,180, 11,251,106,249, 59, 24, 82,175,223,
-252,119, 76,134,120,236,149,250,247,115,254,145,173,174,168,180,255,107,195, 89,
- 24, 25, 48,131,192, 61, 48, 64, 10,176, 49, 64, 1,152, 50, 32, 8,140, 48, 16,
- 5,129, 51,196,187, 41,177, 23,138, 70, 50, 8, 10,242, 48,192, 3,248,226, 0,
- 20,100, 18, 96, 41, 96, 78,102, 7,201,122, 76,119, 20,137, 37,177, 15,132,224,
- 20, 17,191, 67,147,187,116,211, 41,169, 63,172,182,186,217,155,111,140,104,254,
-111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85};
-/* callback to request more mp3 data */
-static void callback(const void** start, size_t* size)
-{
- *start = beep; /* give it the same frame again */
- *size = sizeof(beep);
-}
-#endif /* PLATFORM_NATIVE */
-
/****************************************************************************/
/* Turn sound on */
/****************************************************************************/
static void chip8_sound_on (void)
{
-#if(CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- rb->mp3_play_pause(true); /* kickoff audio */
-#endif
}
/****************************************************************************/
@@ -1371,10 +1343,6 @@ static void chip8_sound_on (void)
/****************************************************************************/
static void chip8_sound_off (void)
{
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- rb->mp3_play_pause(false); /* pause audio */
-#endif
}
/****************************************************************************/
@@ -1576,27 +1544,12 @@ static bool chip8_run(const char* file)
rb->lcd_drawrect(CHIP8_X-1,CHIP8_Y-1,CHIP8_LCDWIDTH+2,CHIP8_HEIGHT+2);
#endif
rb->lcd_update();
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- /* init sound */
- is_playing = rb->mp3_is_playing(); /* would we disturb playback? */
- if (!is_playing) /* no? then we can make sound */
- { /* prepare */
- rb->mp3_play_data(beep, sizeof(beep), callback);
- }
-#endif
starttimer = *rb->current_tick;
chip8_iperiod=15;
cycles = 0;
chip8();
-#if (CONFIG_CODEC != SWCODEC) && !defined(SIMULATOR)
- if (!is_playing)
- { /* stop it if we used audio */
- rb->mp3_play_stop(); /* Stop audio playback */
- }
-#endif
-
if (chip8_running == 3) {
/* unsupported instruction */
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)
lua_pushstring (L, rb->sound_unit(setting));
return 1;
break;
-#if ((CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL))
+#if defined (HAVE_PITCHCONTROL)
case SOUND_SET_PITCH:
rb->sound_set_pitch(setting);
return 1;/*nil*/
@@ -507,7 +507,6 @@ RB_WRAP(sound)
return 1;
}
-#if CONFIG_CODEC == SWCODEC
RB_WRAP(pcm)
{
enum e_pcm {PCM_APPLYSETTINGS = 0, PCM_ISPLAYING, PCM_ISPAUSED,
@@ -579,7 +578,6 @@ RB_WRAP(mixer_frequency)
lua_pushinteger(L, result);
return 1;
}
-#endif /*CONFIG_CODEC == SWCODEC*/
/* DEVICE LIGHTING CONTROL */
RB_WRAP(backlight_onoff)
@@ -953,10 +951,8 @@ static const luaL_Reg rocklib[] =
RB_FUNC(audio),
RB_FUNC(playlist),
RB_FUNC(sound),
-#if CONFIG_CODEC == SWCODEC
RB_FUNC(pcm),
RB_FUNC(mixer_frequency),
-#endif
/* DEVICE LIGHTING CONTROL */
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[] =
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
-#if CONFIG_CODEC != SWCODEC
-#ifndef SIMULATOR
-/* MP3 tick sounds */
-static unsigned char tick_sound[] =
-{
- 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
-,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
-,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
-,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
-, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,102, 0, 0
-, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,101,175,184,232, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
-, 92,189,103, 52,194,128, 2,165,176,176,247, 51, 16, 2, 0, 0, 24, 32, 0, 12
-,204,204,204,204,207,215,221,121,229, 74,224,152, 1,128, 24, 19, 17,207,217,246
-,252,132,212,226,225,192, 16, 0, 0, 0, 0, 32,163,100,111,255, 66, 7, 0, 48
-, 12, 14, 31, 59,255,255,234,112,248,112, 56, 40,223,193, 0, 64, 16, 4, 1, 51
-,229, 29,234, 4,193,240,124, 31, 62, 15,135,255, 7,193, 0, 64, 16, 12, 9, 1
-, 15,168, 16, 1,131,224,254,254,146,224,254, 8, 28, 88,127,255,148, 4, 32,128
-, 32,196,182,166,245,242,214,222,214, 73, 45,110, 52,137, 81, 39,107,255, 44, 76
-,148,140, 8,250, 66,148,195, 43, 3, 41, 15, 18,163, 80, 5, 20,248,174,140,138
-,115, 1,146, 50, 49, 32, 44,201,152,157, 53, 32, 33,157, 8, 34, 85,135, 88,105
-,186,131,252, 48,143,168,162, 44,209,142, 16, 88,221, 10,214, 94, 51, 52, 46,148
-,133, 36, 38,129,165, 36,164,139, 64,211, 11,115,101, 49, 5,136, 33,157, 18,241
-,137, 50, 53,194,213,173, 78,241,108, 1, 24,172,129,146,141,136, 24,119, 73, 51
-, 85,162,138,146, 51, 20,101,163,242,129, 56,212, 84,233, 44, 94, 11, 97,117, 74
-, 73, 37,162, 58, 20,146, 95,203, 31,246, 50, 55,111,214,223,205,213,230, 31,232
-,122,143,183, 14, 39, 91, 57, 15,251,186, 21,185,149, 48, 1,100, 64,200, 16,121
-,155, 72,110, 24,130, 98,255,251,114,196, 7,128, 17,169,247, 95,221,152,128, 10
-, 80, 62,233,185,150,170,113,174,203,251, 59, 12,190,170, 98, 4,156,122,140, 97
-,155, 60, 39, 8,145,195,116, 22,164, 82,118,116, 42,116,157, 68, 88, 70, 64, 93
-, 17, 35, 39,163,118,118, 77, 75, 82,187,215, 89,140, 46,100,112,151, 75, 73,169
-,107,181,157,170,251, 45,140, 75, 34,122, 28,228,146,111,255,235,210, 81,124,114
-,199, 52,180,138,174,207,255,235, 82,210, 64,123, 34,197,101, 47,255,254,234, 91
-, 14, 74, 68,234,219,255,254,206,131,143,162,120,234,210,191,255,245, 93, 18,200
-,225, 42, 29,171,255,254,165,164,196, 24,137, 32,223, 90, 93, 96, 64,217, 78, 35
-, 32, 53,185,107,237, 43,113, 98, 80,107,161, 3,206, 60,192, 10, 78,226,219,199
-,158,146,158, 47, 59, 90,253,154,221,198,138,147,100,150,206,233, 32, 39,192, 73
-, 23, 76,150,201, 41,209,186,217, 37,250,233, 38,198, 34, 24, 18, 33,130, 38,158
-, 73, 54, 69,146, 91, 36,182, 75,235, 64,216,196,138, 9,201, 69,174,138,157,244
-,154,150,208,246, 57, 72, 71, 2,148, 23, 76,115, 83,255,210,218,161, 56, 3, 68
-, 81, 49,190,139,253,125, 81,205, 25, 13,202,146,156,173,255,250,234,194, 8, 69
-, 13,142,255,255,209, 88,136, 73, 6,145,235, 26,142,191,255, 85,100,154,104,178
-,131,213, 0, 34, 0, 17,132, 0, 7,227, 82,135, 11,113, 70,110,105, 94,118, 22
-,255,251,112,196, 9, 0, 17, 61,249, 41,128,101,163, 73,217,178,153, 88,147, 21
-, 48,158,206,220,162,156,221, 7,209, 69, 20,117,163, 69,146, 68,145, 26,131,150
-, 0, 4,132, 41, 8,214,202,209, 69, 30,191,116, 76,156,240, 41,194,118, 23,147
-, 67,173, 87,255,233, 29, 64,216, 73,129, 10, 28,227,197,217, 43,255,254,203, 40
-,140, 48,129, 5,201, 21, 58, 95,255,232,180,168, 70,136,131,201,146,255,254,182
-,169,206, 5,216,101, 36,146,217,109,255,250,169, 38, 96, 35, 69, 51,167,157,191
-,255, 82,158,152,225, 46, 14, 99,235,100,159,255,253, 22, 29,162, 98, 84,108,210
-,202,128, 74, 16, 23,220, 23, 96,152, 17, 5,129,242, 49,137, 75, 60, 81, 16, 80
-, 34,106, 74, 91,255,222, 53, 18, 64,160, 70, 1,195, 5,139,230, 84,118,254,236
-, 44, 29, 1,130,196,195,130,236,237,255,253,156, 84, 60, 17, 10, 10, 19, 35,179
-,255,254,206,198, 14,132,130,194,196, 14, 67,179,255,254,198, 40,144,136, 80, 80
-, 76, 64,228, 57, 29,191,251, 57, 76, 34, 18, 8,132, 66,132,200,114, 59, 63,255
-,220,166, 17, 18, 18, 26, 32,112,201,159,240,144,184,169, 23,127,197,133, 69, 85
-, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-};
-static unsigned char tock_sound[] =
-{
- 255,251,112,196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 73,110,102,111, 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 4,229, 0, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,170,170,170,170,170,170,170,170,170
-,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170
-,170,170,170,170,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
-,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0
-, 57, 76, 65, 77, 69, 51, 46, 57, 57,114, 1,205, 0, 0, 0, 0, 46,100, 0, 0
-, 20, 96, 36, 3, 64, 66, 0, 0, 96, 0, 0, 4,229,187,155,119, 17, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,251,112,196, 0, 0, 13
-,105, 19,104,212,146,128, 10,164, 41,175,119, 51, 32, 0, 2, 32, 41, 84, 9,130
-, 96,152,109,228, 0, 16, 0, 6, 9,209,163,111,127,154, 48, 0, 0, 0, 0,129
-,194, 19,212,226, 97,240,248,187,255, 65, 0,248,124, 92,255,144,130, 1,192,225
-, 9,249,206,115,138, 16,158,132, 57,206,115,191,242, 16,132,111,212,231, 14, 7
-, 8, 70,243,156,231, 57,206,121,207,200, 66, 16, 92,231,255,134, 0, 0, 0,127
-,244, 60, 60, 51,255,192, 3,195,207,252, 0, 0, 0, 29, 39,244, 60, 48, 3,255
-,195,219,177,171,179,181, 8,157,251,239,155,104,162, 80, 5,194, 16,165,199, 42
-,104,133, 19,109, 88, 96, 61,104,242,117,118, 94,135, 29, 53, 72, 67, 85, 11, 54
-, 59, 64,154,155,128,195, 23,148, 98, 43,186, 43,139, 64,218, 82, 68,160,197,168
-,125, 10, 50, 41, 16,240, 30, 6,228, 52,117, 0, 51,130,146,122,152,109,162,201
-, 45,154, 30, 11, 66, 30, 76, 73,145,224, 52,149, 17, 55,138,112,105, 51, 36,147
-, 22,130, 89, 20,138, 36,114,212,145, 3,199,107,101,213, 25, 21,222,196,209,162
-, 40,168,168,165,162,100,142,163,220,186,250, 72,106, 54, 75, 48,243, 79,153, 54
-,163, 93,179,171,204,144,232,190,115, 19,208, 90,172,244, 40, 98,126, 35,161,234
-,122,143,221, 39,250,159, 61, 35,111,250,213,216, 6,252, 9,138, 17, 64, 1, 13
-, 56, 80, 58,104,184, 37,255,251,114,196, 7,128, 17,250, 1, 97,189,152, 0, 10
-, 44,192, 41,253,151,169,185,237, 56, 3,131,220, 24,180,204,165,221,129,107,210
-,192, 50,130, 26, 22, 26,180, 77, 81, 85,221,146, 33,197,224,198,197,228,146, 89
-,162,210, 69,100,233, 13, 25,145, 61, 19,206,151,232,172,212, 58,162,149, 53, 70
-,234,234, 81,176,186, 28, 39,145,253, 87, 33,130,150, 43, 36,187,245,169,141,200
-, 41,178,191,230, 68,233,170,255,230, 37,227,101,183,237, 49, 56,109,255,115,134
-,232,223,247,156, 62,191,250, 43, 42,169,127,245, 26,160,255,234,151,157,191,215
-, 46,164,223,235, 98,137,118,223,238,112,189,111,247, 56, 94,106, 16, 1, 77, 8
-, 25, 4,204, 0, 0,134, 96, 41,151,170, 74,147,135, 11,136, 28,220, 96,102,179
-, 16,145, 89,202, 11,197,114, 72, 0,241, 77, 88,211, 70,174,171, 10, 11, 84,163
-, 5, 53,191,241,191,106,245,209,114, 21,240,208, 75,172,190,150,103,205,178,252
-, 78, 36,166,139,132,106,231, 86,253,130, 80,178,201,254,193, 68, 20,207,254,206
-, 49, 19, 78,127,253,159,255, 33, 37, 37, 95,238,112,188, 89, 37, 79,238,165, 5
-,163,151,249,168,130,215,255,169,223,249,231, 15,149,191,161,227,209,235, 63,232
-,166, 10,198,183,232,150, 34,119,255,213, 17,255,231, 17, 44, 8, 2, 96, 1,101
-,184,243,226,216, 18, 60,216,132,105,150,250,101,165, 64,237,172,186, 35,114,126
-,255,251,112,196, 12,128,144,142, 3, 44,140,180,241, 1,207, 47,217, 72,244, 10
-, 48, 29, 88, 20, 21,128, 36,231,157,173,100,202, 35,136,119,133,228,209, 55,186
-,218,198,197,208,217, 11,233,178,254,186,137,128, 8,110, 71,253,212,136,138, 45
-,118,253,216, 34, 7, 74, 99,255, 60, 22,144,101,111,209, 72,136,196,175,254, 58
-, 15, 76, 71,249,184,138, 45, 30,127,234,199, 21, 35,191,245, 17, 75, 63,252,120
-,108, 58,223,209,199, 74,141, 91,254,131, 98, 70,255,212, 69, 42, 71,254,172, 54
-,127,252,116,107,255,168,212,194, 64, 61,126, 46,224,170, 52, 71,208,229, 19,209
-,148, 64,203,225,206,126, 29,230, 1,134,123,159,138,246, 67,199, 93,127,253, 50
-,148, 81, 37, 13, 40,145, 8, 37, 12, 6, 4, 49, 67,204,186,186,255,255,213,149
-,149,137, 16,132,162, 8,128, 90, 58, 93, 95,255,121,138, 96,161,131, 3, 33,200
-,118,127,255,238, 83, 5, 10, 8,228, 58, 47,255,252,197, 48, 96,104,116, 84, 84
-, 69,255,251, 24, 40, 80, 74, 69, 69, 64, 96,193, 7,141, 1, 89,203, 5,113, 81
-, 70,255,245,139, 85, 76, 65, 77, 69, 51, 46, 57, 57, 46, 53, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85
-};
-#endif /* SIMULATOR */
-#else
/* raw PCM */
static signed short tick_sound[] =
{
@@ -641,7 +504,6 @@ static signed short tock_sound[] =
,-3,2,-1,0,1,-1,0,0,1,-1,1
,-2,3
};
-#endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Utilities from pdbox plugin (Copyright (C) 2009 Wincent Balin) --- am I
@@ -941,51 +803,6 @@ static int bpm_step_counter = 0;
static bool sound_trigger = false;
-#if CONFIG_CODEC != SWCODEC
-
-#ifdef SIMULATOR
-
-/* No audio in HWCODEC simulator build. */
-#define MET_IS_PLAYING 0
-#define MET_PLAY_STOP do {} while(0)
-static void play_tick(void){ printf("tick\n"); }
-static void play_tock(void){ printf("tock\n"); }
-
-#else
-
-#define MET_IS_PLAYING rb->mp3_is_playing()
-#define MET_PLAY_STOP rb->mp3_play_stop()
-
-static void callback(const void** start, size_t* size)
-{
- (void)start; /* unused parameter, avoid warning */
- *size = 0; /* end of data */
- sound_active = false;
- rb->led(0);
-}
-
-/* Wondering: Should one prevent playing again while sound_active == true? */
-
-static void play_tick(void)
-{
- sound_active = true;
- rb->led(1);
- rb->mp3_play_data(tick_sound, sizeof(tick_sound), callback);
- rb->mp3_play_pause(true); /* kickoff audio */
-}
-
-static void play_tock(void)
-{
- sound_active = true;
- rb->led(1);
- rb->mp3_play_data(tock_sound, sizeof(tock_sound), callback);
- rb->mp3_play_pause(true); /* kickoff audio */
-}
-
-#endif /* SIMULATOR */
-
-#else /* CONFIG_CODEC == SWCODEC */
-
#define MET_IS_PLAYING rb->pcm_is_playing()
#define MET_PLAY_STOP rb->audio_stop()
@@ -1014,8 +831,6 @@ static void play_tock(void)
rb->pcm_play_data(NULL, NULL, tock_buf, sizeof(tock_buf));
}
-#endif /* CONFIG_CODEC != SWCODEC */
-
/* State: 0: blank/title, 1: tick, 2: tock 3: silent klick */
/* TODO: Could use more smart placement, using
lcd_getstringsize() and such. */
@@ -1446,9 +1261,7 @@ static void cleanup(void)
MET_PLAY_STOP; /* stop audio ISR */
tweak_volume(0);
rb->led(0);
-#if CONFIG_CODEC == SWCODEC
rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
-#endif
}
/*
@@ -1786,12 +1599,6 @@ enum plugin_status plugin_start(const void* file)
if(MET_IS_PLAYING) MET_PLAY_STOP; /* stop audio IS */
-#if (CONFIG_CODEC != SWCODEC)
-#ifndef SIMULATOR
- rb->bitswap(tick_sound, sizeof(tick_sound));
- rb->bitswap(tock_sound, sizeof(tock_sound));
-#endif
-#else
prepare_buffers();
#if INPUT_SRC_CAPS != 0
/* Select playback */
@@ -1799,7 +1606,6 @@ enum plugin_status plugin_start(const void* file)
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
#endif
rb->pcm_set_frequency(SAMPR_44);
-#endif /* CONFIG_CODEC != SWCODEC */
if(file)
{
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)
}
}
-#if CONFIG_CODEC == SWCODEC
static void audio_options(void)
{
int selected = 0;
@@ -1307,7 +1306,6 @@ static void audio_options(void)
menu_quit = true;
}
}
-#endif
static void resume_options(void)
{
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;
static void get_peaks(int *left, int *right)
{
-#if CONFIG_CODEC == SWCODEC
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
*left = peaks.left;
*right = peaks.right;
-#elif defined (SIMULATOR)
- *left = rand() % 0x8000;
- *right = rand() % 0x8000;
-#else
- *left = 0;
- *right = 0;
-#endif
}
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)
num_properties = 5;
-#if (CONFIG_CODEC == SWCODEC)
int fd = rb->open(selected_file, O_RDONLY);
if (fd >= 0 &&
rb->get_metadata(&id3, fd, selected_file))
-#else
- if (!rb->mp3info(&id3, selected_file))
-#endif
{
long dur = id3.length / 1000; /* seconds */
rb->snprintf(str_artist, sizeof str_artist,
@@ -145,9 +141,7 @@ static bool file_properties(const char* selected_file)
num_properties++;
}
}
-#if (CONFIG_CODEC == SWCODEC)
rb->close(fd);
-#endif
found = true;
break;
}
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;
#define N_BUFS 2
#define BUF_SIZE 2048
-#if CONFIG_CODEC == SWCODEC
-
bool doneplay=1;
bool bufnum=0;
@@ -88,27 +86,3 @@ int rockboy_pcm_submit(void)
pcm.pos = 0;
return 1;
}
-
-#else
-
-void rockboy_pcm_init(void)
-{
- pcm.hz = 44100;
- pcm.stereo = 1;
- pcm.buf = NULL;
- pcm.len = 0;
- pcm.pos = 0;
-}
-
-void rockboy_pcm_close(void)
-{
- memset(&pcm, 0, sizeof pcm);
-}
-
-int rockboy_pcm_submit(void)
-{
- pcm.pos =0;
- return 0;
-}
-
-#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 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 Philipp Pertermann
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include "plugin.h"
-
-
-
-/* variable button definitions */
-#if CONFIG_KEYPAD == IRIVER_H100_PAD
-#define SPLITEDIT_QUIT BUTTON_OFF
-#define SPLITEDIT_PLAY BUTTON_ON
-#define SPLITEDIT_SAVE BUTTON_SELECT
-#define SPLITEDIT_LOOP_MODE BUTTON_MODE
-#define SPLITEDIT_SCALE (BUTTON_REC | BUTTON_UP)
-#define SPLITEDIT_SPEED50 (BUTTON_REC | BUTTON_LEFT)
-#define SPLITEDIT_SPEED100 (BUTTON_REC | BUTTON_DOWN)
-#define SPLITEDIT_SPEED150 (BUTTON_REC | BUTTON_RIGHT)
-#define SPLITEDIT_MENU_RUN BUTTON_RIGHT
-
-#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
- (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
-#define SPLITEDIT_QUIT (BUTTON_REC | BUTTON_REW)
-#define SPLITEDIT_PLAY (BUTTON_REC | BUTTON_FFWD)
-#define SPLITEDIT_SAVE BUTTON_FFWD
-#define SPLITEDIT_LOOP_MODE BUTTON_REW
-#define SPLITEDIT_SCALE BUTTON_UP
-#define SPLITEDIT_SPEED50 BUTTON_LEFT
-#define SPLITEDIT_SPEED100 BUTTON_DOWN
-#define SPLITEDIT_SPEED150 BUTTON_RIGHT
-#define SPLITEDIT_MENU_RUN BUTTON_PLAY
-
-#define SPLITEDIT_RC_QUIT BUTTON_RC_STOP
-#endif
-
-#define BMPHEIGHT 7
-#define BMPWIDTH 13
-unsigned char LOOP_BMP[][13] =
-{
- {0xfc,0x00,0x10,0x11,0x93,0x7f,0x13,0x11,0x7c,0x38,0x10,0x00,0x7c}, /*ALL */
- {0x81,0x03,0x7f,0x03,0x91,0x10,0x10,0x10,0x7c,0x38,0x10,0x00,0x7c}, /*FROM*/
- {0xfc,0x00,0x10,0x10,0x90,0x10,0x7c,0x38,0x11,0x03,0x7f,0x03,0x01}, /*TO */
- {0x80,0x10,0x10,0x11,0x93,0x7f,0x13,0x11,0x10,0x7c,0x38,0x10,0x00}, /*FREE*/
-};
-
-unsigned char CUT_BMP[] =
-{
- 0xc1,0x63,0x63,0x36,0xb6,0x1c,0x1c,0x36,0x77,0x55,0x55,0x55,0x32,
-};
-
-unsigned char SCALE_BMP[][13] =
-{
- {0x80,0x06,0x49,0x66,0xb0,0x18,0x0c,0x06,0x33,0x49,0x30,0x00,0x00}, /*lin*/
- {0x80,0x30,0x78,0x48,0xff,0x7f,0x00,0x7f,0x7f,0x48,0x78,0x30,0x00}, /*db*/
-};
-
-#define TIMEBAR_Y 9
-#define TIMEBAR_HEIGHT 4
-
-#define OSCI_X 0
-#define OSCI_Y (TIMEBAR_Y + TIMEBAR_HEIGHT + 1)
-#define OSCI_WIDTH LCD_WIDTH
-#define OSCI_HEIGHT (LCD_HEIGHT - BMPHEIGHT - OSCI_Y - 1)
-
-/* Indices of the menu items in the save editor, see save_editor */
-#define SE_PART1_SAVE 0
-#define SE_PART1_NAME 1
-#define SE_PART2_SAVE 2
-#define SE_PART2_NAME 3
-#define SE_SAVE 4
-#define SE_COUNT 5
-
-/* contains the file name of the song that is to be split */
-static char path_mp3[MAX_PATH];
-
-/* Exit code of this plugin */
-static enum plugin_status splitedit_exit_code = PLUGIN_OK;
-
-/* The range in time that the displayed aerea comprises */
-static unsigned int range_start = 0;
-static unsigned int range_end = 0;
-
-/* The range in time that is being looped */
-static unsigned int play_start = 0;
-static unsigned int play_end = 0;
-
-/* Point in time (pixel) at which the split mark is set */
-static int split_x = OSCI_X + (OSCI_WIDTH / 2);
-
-/* Contains the peak values */
-static unsigned char osci_buffer[OSCI_WIDTH];
-
-/* if true peak values from a previous loop are only overwritten
- if the new value is greater than the old value */
-static bool osci_valid = false;
-
-/**
- * point in time from which on the osci_buffer is invalid
- * if set to ~(unsigned int)0 the entire osci_buffer is invalid
- */
-static unsigned int validation_start = ~(unsigned int)0;
-
-/* all the visible aerea is looped */
-#define LOOP_MODE_ALL 0
-
-/* loop starts at split point, ends at right visible border */
-#define LOOP_MODE_FROM 1
-
-/* loop start at left visible border, ends at split point */
-#define LOOP_MODE_TO 2
-
-/* let the song play without looping */
-#define LOOP_MODE_FREE 3
-
-/* see LOOP_MODE_XXX constants vor valid values */
-static int loop_mode = LOOP_MODE_FREE;
-
-/* minimal allowed timespan (ms) of the visible (and looped) aerea*/
-#define MIN_RANGE_SIZE 1000
-
-/* Format time into buf.
- *
- * buf - buffer to format to.
- * buf_size - size of buffer.
- * time - time to format, in milliseconds.
- */
-static void format_time_ms(char* buf, int buf_size, int time)
-{
- rb->snprintf(buf, buf_size, "%d:%02d:%03d", time / 60000,
- time % 60000 / 1000, (time % 60000) % 1000);
-}
-
-/**
- * converts screen coordinate (pixel) to time (ms)
- */
-static int xpos_to_time(int xpos)
-{
- int retval = 0;
- int range = range_end - range_start;
- retval = range_start + (((xpos - OSCI_X) * range) / OSCI_WIDTH);
- return retval;
-}
-
-/**
- * Converts time (ms) to screen coordinates (pixel).
- */
-static int time_to_xpos(unsigned int time)
-{
- int retval = OSCI_X;
-
- /* clip the range */
- if (time < range_start)
- {
- retval = OSCI_X;
- }
- else
- if (time >= range_end)
- {
- retval = OSCI_X + OSCI_WIDTH;
- }
-
- /* do the calculation */
- else
- {
- int range = range_end - range_start;
- retval = OSCI_X + ((time - range_start) * OSCI_WIDTH) / range ;
- }
- return retval;
-}
-
-/**
- * Updates the display of the textual data only.
- */
-static void update_data(void)
-{
- char buf[20];
- char timebuf[10];
- int w, h;
-
- /* split point */
- format_time_ms(timebuf, sizeof timebuf, xpos_to_time(split_x));
- rb->snprintf(buf, sizeof buf, "Split at: %s", timebuf);
-
- rb->lcd_getstringsize(buf, &w, &h);
-
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, 0, LCD_WIDTH, h);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_puts(0, 0, buf);
- rb->lcd_update_rect(0, 0, LCD_WIDTH, h);
-}
-
-/**
- * Displays which part of the song is visible
- * in the osci.
- */
-static void update_timebar(struct mp3entry *mp3)
-{
- rb->gui_scrollbar_draw
- (
- rb->screens[SCREEN_MAIN],0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT,
- mp3->length, range_start, range_end,
- HORIZONTAL
- );
- rb->lcd_update_rect(0, TIMEBAR_Y, LCD_WIDTH, TIMEBAR_HEIGHT);
-}
-
-/**
- * Marks the entire area of the osci buffer invalid.
- * It will be drawn with new values in the next loop.
- */
-static void splitedit_invalidate_osci(void)
-{
- osci_valid = false;
- validation_start = ~(unsigned int)0;
-}
-
-/**
- * Returns the loop mode. See the LOOP_MODE_XXX constants above.
- */
-static int splitedit_get_loop_mode(void)
-{
- return loop_mode;
-}
-
-/**
- * Updates the icons that display the Fn key hints.
- */
-static void update_icons(void)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
-
- /* The CUT icon */
- rb->lcd_mono_bitmap(CUT_BMP,
- LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
-
- /* The loop mode icon */
- rb->lcd_mono_bitmap(LOOP_BMP[splitedit_get_loop_mode()],
- LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
-
- {
- static int idx;
- if (idx < 0 || idx > 1) idx = 0;
- idx = 1 - idx;
- rb->lcd_mono_bitmap(SCALE_BMP[idx],
- 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
- BMPWIDTH, BMPHEIGHT);
- }
-
- rb->lcd_update_rect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT);
-}
-
-/**
- * Sets the loop mode. See the LOOP_MODE_XXX constants above.
- */
-static void splitedit_set_loop_mode(int mode)
-{
- int old_loop_mode = loop_mode;
- /* range restriction */
- loop_mode = mode % (LOOP_MODE_FREE + 1);
- switch (loop_mode)
- {
- case LOOP_MODE_ALL:
- play_start = range_start;
- play_end = range_end;
- break;
-
- case LOOP_MODE_FROM:
- play_start = xpos_to_time(split_x);
- play_end = range_end;
- break;
-
- case LOOP_MODE_TO:
- play_start = range_start;
- play_end = xpos_to_time(split_x);
- break;
-
- case LOOP_MODE_FREE:
- /* play_start is used when the song plays beyond its end */
- play_start = range_start;
- play_end = range_end;
- break;
- }
-
- if (loop_mode != old_loop_mode)
- {
- update_icons();
- }
-}
-
-/**
- * Readraws the osci without clear.
- */
-static void redraw_osci(void)
-{
- int x;
- for (x = 0; x < OSCI_WIDTH; x++)
- {
- if (osci_buffer[x] > 0)
- {
- rb->lcd_vline
- (
- OSCI_X + x, OSCI_Y + OSCI_HEIGHT - 1,
- OSCI_Y + OSCI_HEIGHT - osci_buffer[x] - 1
- );
- }
- }
-}
-
-/**
- * Sets the range of time in which the user can finetune the split
- * point. The split point is the center of the time range.
- */
-static void set_range_by_time(
- struct mp3entry *mp3,
- unsigned int split_time,
- unsigned int range)
-{
- if (mp3 != NULL)
- {
- if (range < MIN_RANGE_SIZE)
- {
- range = MIN_RANGE_SIZE;
- }
- range_start = (split_time > range / 2) ? (split_time - range / 2) : 0;
- range_end = MIN(range_start + range, mp3->length);
- split_x = time_to_xpos(split_time);
-
- splitedit_invalidate_osci();
-
- /* this sets the play_start / play_end */
- splitedit_set_loop_mode(splitedit_get_loop_mode());
-
- update_data();
- update_timebar(mp3);
- }
-}
-
-/**
- * Set the split point in screen coordinates
- */
-static void splitedit_set_split_x(int newx)
-{
- int minx = split_x - 2 > 0 ? split_x - 2: 0;
-
- /* remove old split point from screen, only if moved */
- if (split_x != newx)
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
- rb->lcd_fillrect(split_x-1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
- rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
- }
-
- if (newx >= OSCI_X && newx < OSCI_X + OSCI_WIDTH)
- {
- split_x = newx;
- /* in LOOP_FROM / LOOP_TO modes play_start /play_end must be updated */
- splitedit_set_loop_mode(splitedit_get_loop_mode());
-
- /* display new split time */
- update_data();
- }
-
- /* display new split point */
- minx = split_x - 2 > 0 ? split_x - 2: 0;
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
- rb->lcd_fillrect(split_x - 1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
- rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
-}
-
-/**
- * returns the split point in screen coordinates
- */
-static int splitedit_get_split_x(void)
-{
- return split_x;
-}
-
-/**
- * Clears the osci area and redraws it
- */
-static void update_osci(void)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- redraw_osci();
- splitedit_set_split_x(splitedit_get_split_x());
- rb->lcd_update_rect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
-}
-
-/**
- * Zooms the visable and loopable range by the factor
- * (counter / denominator). The split point is used as
- * center point of the new selected range.
- */
-static void zoom(struct mp3entry *mp3, int counter, int denominator)
-{
- unsigned char oldbuf[OSCI_WIDTH];
- int oldrange = range_end - range_start;
- int range = oldrange * counter / denominator;
- int i;
- int oldindex;
- int oldsplitx;
- int splitx;
- int split;
-
- /* for stretching / shrinking a second buffer is needed */
- rb->memcpy(&oldbuf, &osci_buffer, sizeof osci_buffer);
-
- /* recalculate the new range and split point */
- oldsplitx = split_x;
- split = xpos_to_time(split_x);
-
- set_range_by_time(mp3, split, range);
- range = range_end - range_start;
-
- splitx = time_to_xpos(split);
-
- /* strech / shrink the existing osci buffer */
- for (i = 0; i < OSCI_WIDTH; i++)
- {
- /* oldindex = (i + OSCI_X - splitx) * range / oldrange + oldsplitx ;*/
- oldindex = (i*range / oldrange) + oldsplitx - (splitx*range /oldrange);
- if (oldindex >= 0 && oldindex < OSCI_WIDTH)
- {
- osci_buffer[i] = oldbuf[oldindex];
- }
- else
- {
- osci_buffer[i] = 0;
- }
- }
-
- splitx = time_to_xpos(split);
- splitedit_set_split_x(splitx);
- splitedit_invalidate_osci();
-
-}
-
-static void scroll(struct mp3entry *mp3)
-{
- zoom(mp3, 1, 1);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Zooms in by 3/4
- */
-static void splitedit_zoom_in(struct mp3entry *mp3)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- zoom(mp3, 3, 4);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Zooms out by 4/3
- */
-static void splitedit_zoom_out(struct mp3entry *mp3)
-{
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- zoom(mp3, 4, 3);
- rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
- update_osci();
- update_data();
-}
-
-/**
- * Append part_no to the file name.
- */
-static void generateFileName(char* file_name, int part_no)
-{
- if (rb->strlen(file_name) <MAX_PATH)
- {
- int len = rb->strlen(file_name);
- int ext_len = rb->strlen(".mp3");
- if (rb->strcasecmp(
- &file_name[len - ext_len],
- ".mp3") == 0)
- {
- int i = 0;
- /* shift the extension one position to the right*/
- for (i = len; i > len - ext_len; i--)
- {
- file_name[i] = file_name[i - 1];
- }
- file_name[len - ext_len] = '0' + part_no;
- }
- else
- {
- rb->splash(0, "wrong extension");
- rb->button_get(true);
- rb->button_get(true);
- }
- }
- else
- {
- rb->splash(0, "name too long");
- rb->button_get(true);
- rb->button_get(true);
-
- }
-
-}
-
-/**
- * Copy bytes from src to dest while displaying a progressbar.
- * The files must be already open.
- */
-static int copy_file(
- int dest,
- int src,
- unsigned int bytes,
- int prg_y,
- int prg_h)
-{
- long button;
- unsigned char *buffer;
- unsigned int i = 0;
- ssize_t bytes_read = 1; /* ensure the for loop is executed */
- size_t buffer_size;
- buffer = rb->plugin_get_buffer(&buffer_size);
-
- for (i = 0; i < bytes && bytes_read > 0; i += bytes_read)
- {
- ssize_t bytes_written;
- unsigned int bytes_to_read =
- bytes - i > buffer_size ? buffer_size : bytes - i;
- bytes_read = rb->read(src, buffer, bytes_to_read);
- bytes_written = rb->write(dest, buffer, bytes_read);
-
- if (bytes_written < 0) {
- rb->splash(0, "Write failed in copy.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
-
- button = rb->button_get(false);
-
- if (button == SPLITEDIT_QUIT
-#ifdef SPLITEDIT_RC_QUIT
- || button == SPLITEDIT_RC_QUIT:
-#endif
- ) {
- rb->splash(0, "Aborting copy.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
-
- rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, prg_y, LCD_WIDTH,
- prg_h, bytes, 0, i, HORIZONTAL);
- rb->lcd_update_rect(0, prg_y, LCD_WIDTH, prg_h);
- }
-
- return 0;
-}
-
-/**
- * Save the files, if the file_name is not NULL
- */
-static int save(
- struct mp3entry *mp3,
- char *file_name1,
- char *file_name2,
- int splittime)
-{
- int file1, file2, src_file;
- unsigned int end = 0;
- int retval = 0;
-
- /* Verify that file 1 doesn't exit yet */
- if (file_name1 != NULL)
- {
- file1 = rb->open(file_name1, O_RDONLY);
- if (file1 >= 0)
- {
- rb->close(file1);
- rb->splash(0, "File 1 exists. Please rename.");
- rb->button_get(true);
- rb->button_get(true);
- return -1;
- }
- }
-
- /* Verify that file 2 doesn't exit yet */
- if (file_name2 != NULL)
- {
- file2 = rb->open(file_name2, O_RDONLY);
- if (file2 >= 0)
- {
- rb->close(file2);
- rb->splash(0, "File 2 exists. Please rename.");
- rb->button_get(true);
- rb->button_get(true);
- return -2;
- }
- }
-
- /* find the file position of the split point */
- rb->audio_pause();
- rb->audio_ff_rewind(splittime);
- rb->yield();
- rb->yield();
- end = rb->audio_get_file_pos();
-
- /* open the source file */
- src_file = rb->open(mp3->path, O_RDONLY);
- if (src_file >= 0)
- {
- int close_stat = 0;
- int x, y;
- long offset;
- unsigned long last_header = rb->mpeg_get_last_header();
-
- rb->lcd_getstringsize("M", &x, &y);
-
- /* Find the next frame boundary */
- rb->lseek(src_file, end, SEEK_SET);
- rb->find_next_frame(src_file, &offset, 8000, last_header);
- rb->lseek(src_file, 0, SEEK_SET);
- end += offset;
-
- /* write the file 1 */
- if (file_name1 != NULL)
- {
- file1 = rb->open (file_name1, O_WRONLY | O_CREAT, 0666);
- if (file1 >= 0)
- {
- int rc = copy_file(file1, src_file, end, y*2 + 1, y -1);
- close_stat = rb->close(file1);
-
- if (close_stat != 0)
- {
- rb->splashf(0, "failed closing file1: error %d", close_stat);
- rb->button_get(true);
- rb->button_get(true);
- } else {
- /* If there was an error, cleanup */
- if (rc) {
- rb->remove(file_name1);
- }
- }
- }
- else
- {
- rb->splashf(0, "Can't write File1: error %d", file1);
- rb->button_get(true);
- rb->button_get(true);
- retval = -1;
- }
- }
- /* if file1 hasn't been written we're not at the split point yet */
- else
- {
- if (rb->lseek(src_file, end, SEEK_SET) < (off_t)end)
- {
- rb->splashf(0, "Src file to short: error %d", src_file);
- rb->button_get(true);
- rb->button_get(true);
- }
- }
-
- if (file_name2 != NULL)
- {
- /* write file 2 */
- file2 = rb->open (file_name2, O_WRONLY | O_CREAT, 0666);
- if (file2 >= 0)
- {
- end = mp3->filesize - end;
- int rc = copy_file(file2, src_file, end, y * 5 + 1, y -1);
- close_stat = rb->close(file2);
-
- if (close_stat != 0)
- {
- rb->splashf(0, "failed: closing file2: error %d",
- close_stat);
- rb->button_get(true);
- rb->button_get(true);
- } else {
- /* If there was an error, cleanup */
- if (rc) {
- rb->remove(file_name2);
- }
- }
- }
- else
- {
- rb->splashf(0, "Can't write File2: error %d", file2);
- rb->button_get(true);
- rb->button_get(true);
- retval = -2;
- }
- }
-
- close_stat = rb->close(src_file);
- if (close_stat != 0)
- {
- rb->splashf(0, "failed: closing src: error %d", close_stat);
- rb->button_get(true);
- rb->button_get(true);
- }
- }
- else
- {
- rb->splash(0, "Source file not found");
- rb->button_get(true);
- rb->button_get(true);
- retval = -3;
- }
-
- rb->audio_resume();
-
- return retval;
-}
-
-static void puts_wrapper(int x, int y, const char *str, bool scroll, bool selected)
-{
- struct line_desc line = LINE_DESC_DEFINIT;
- struct screen *lcd = rb->screens[SCREEN_MAIN];
- int w = lcd->getcharwidth();
- int h = lcd->getcharheight();
-
- line.scroll = scroll;
- line.style = selected ? STYLE_INVERT : STYLE_DEFAULT;
-
- rb->screens[0]->put_line(x * w, y * h, &line, str);
-}
-
-/**
- * Let the user choose which file to save with which name
- */
-static void save_editor(struct mp3entry *mp3, int splittime)
-{
- bool exit_request = false;
- int choice = 0;
- int button = BUTTON_NONE;
- char part1_name [MAX_PATH];
- char part2_name [MAX_PATH];
- bool part1_save = true;
- bool part2_save = true;
-
- /* file name for left part */
- rb->strlcpy(part1_name, mp3->path, MAX_PATH);
- generateFileName(part1_name, 1);
-
- /* file name for right part */
- rb->strlcpy(part2_name, mp3->path, MAX_PATH);
- generateFileName(part2_name, 2);
-
- while (!exit_request)
- {
- int pos;
- rb->lcd_clear_display();
-
- /* Save file1? */
- puts_wrapper(0, 0, "Save part 1?", false, choice == SE_PART1_SAVE);
- puts_wrapper(7, 0, part1_save?"yes":"no", false, false);
-
- /* trim to display the filename without path */
- for (pos = rb->strlen(part1_name); pos > 0; pos--)
- {
- if (part1_name[pos] == '/')
- break;
- }
- pos++;
-
- /* File name 1 */
- puts_wrapper(0, 1, &part1_name[pos], true, choice == SE_PART1_NAME);
-
- /* Save file2? */
- puts_wrapper(0, 3, "Save part 2?", false, choice == SE_PART2_SAVE);
- puts_wrapper(7, 3, part2_save?"yes":"no", false, false);
-
- /* trim to display the filename without path */
- for (pos = rb->strlen(part2_name); pos > 0; pos --)
- {
- if (part2_name[pos] == '/')
- break;
- }
- pos++;
-
- /* File name 2 */
- puts_wrapper(0, 4, &part2_name[pos], true, choice == SE_PART2_NAME);
-
- /* Save */
- puts_wrapper(0, 6, "Save", false, choice == SE_SAVE);
-
- rb->lcd_update();
-
-
- button = rb->button_get(true);
- switch (button)
- {
- case BUTTON_UP:
- choice = (choice + SE_COUNT - 1) % SE_COUNT;
- break;
-
- case BUTTON_DOWN:
- choice = (choice + 1) % SE_COUNT;
- break;
-
- case SPLITEDIT_MENU_RUN:
- switch (choice)
- {
- int saved;
-
- case SE_PART1_SAVE:
- part1_save = !part1_save;
- break;
-
- case SE_PART1_NAME:
- rb->kbd_input(part1_name, MAX_PATH, NULL);
- break;
-
- case SE_PART2_SAVE:
- part2_save = !part2_save;
- break;
-
- case SE_PART2_NAME:
- rb->kbd_input(part2_name, MAX_PATH, NULL);
- break;
-
- case SE_SAVE:
- rb->lcd_scroll_stop();
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- saved = save
- (
- mp3,
- part1_save?part1_name:NULL,
- part2_save?part2_name:NULL,
- splittime
- );
-
- /* if something failed the user may go on choosing */
- if (saved >= 0)
- {
- exit_request = true;
- }
- break;
- }
- break;
-#ifdef SPLITEDIT_RC_QUIT
- case SPLITEDIT_RC_QUIT:
-#endif
- case SPLITEDIT_QUIT:
- exit_request = true;
- break;
-
- default:
- if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
- {
- splitedit_exit_code = PLUGIN_USB_CONNECTED;
- exit_request = true;
- }
- break;
- }
- }
-}
-
-/**
- * The main loop of the editor
- */
-static unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
- unsigned int split_time,
- unsigned int range)
-{
- int button = BUTTON_NONE;
- int lastbutton = BUTTON_NONE;
- struct mp3entry *mp3 = mp3_to_split;
- unsigned int last_elapsed = 0;
- int lastx = OSCI_X + (OSCI_WIDTH / 2);
- int retval = -1;
-
- if (mp3 != NULL)
- {
- /*unsigned short scheme = SCHEME_SPLIT_EDITOR;*/
- bool exit_request = false;
- set_range_by_time(mp3, split_time, range);
- splitedit_set_loop_mode(LOOP_MODE_ALL);
- update_icons();
-
- /*while (scheme != SCHEME_RETURN) {*/
- while (!exit_request)
- {
- unsigned int elapsed ;
- int x ;
-
- /* get position */
- elapsed = mp3->elapsed;
- x = time_to_xpos(elapsed);
-
- /* are we still in the zoomed range? */
- if (elapsed > play_start && elapsed < play_end)
- {
- /* read volume info */
- unsigned short volume;
- volume = OSCI_HEIGHT / 2;
-
- /* update osci_buffer */
- if (osci_valid || lastx == x)
- {
- int index = x - OSCI_X;
- osci_buffer[index] = MAX(osci_buffer[index], volume);
- }
- else
- {
- int i;
- osci_buffer[x - OSCI_X] = volume;
- for (i = lastx + 1; i < x; i++)
- {
- osci_buffer[i - OSCI_X] = 0;
- }
- }
-
- /* make room */
- rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(lastx + 1, OSCI_Y, x - lastx, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- /* draw a value */
- if (osci_buffer[x - OSCI_X] > 0)
- {
- int i;
- for (i = lastx +1; i <= x; i++)
- {
- rb->lcd_vline
- (
- i, OSCI_Y + OSCI_HEIGHT - 1,
- OSCI_Y + OSCI_HEIGHT - osci_buffer[i - OSCI_X]-1
- );
- }
- }
-
- /* mark the current position */
- if (lastx != x)
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(lastx, OSCI_Y, 1, OSCI_HEIGHT);
- rb->lcd_fillrect(x, OSCI_Y, 1, OSCI_HEIGHT);
- rb->lcd_set_drawmode(DRMODE_SOLID);
- }
-
- /* mark the split point */
- if ((x > split_x - 2) && (lastx < split_x + 3))
- {
- if ((lastx < split_x) && (x >= split_x))
- {
- rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect
- (
- split_x, OSCI_Y + 2,
- 1, OSCI_HEIGHT - 2
- );
- rb->lcd_set_drawmode(DRMODE_SOLID);
- }
- rb->lcd_hline(split_x -2, split_x + 2, OSCI_Y);
- rb->lcd_hline(split_x-1, split_x +1,OSCI_Y+1);
- }
-
- /* make visible */
- if (lastx <= x)
- {
- rb->lcd_update_rect(lastx, OSCI_Y, x-lastx+1, OSCI_HEIGHT);
- }
- else
- {
- rb->lcd_update_rect
- (
- lastx, OSCI_Y,
- OSCI_X + OSCI_WIDTH - lastx, OSCI_HEIGHT
- );
- rb->lcd_update_rect(0, OSCI_Y, x + 1, OSCI_HEIGHT);
- }
-
- lastx = x;
- }
-
- /* we're not in the zoom range -> rewind */
- else
- {
- if (elapsed >= play_end)
- {
- switch (splitedit_get_loop_mode())
- {
- unsigned int range_width;
-
- case LOOP_MODE_ALL:
- case LOOP_MODE_TO:
- rb->audio_pause();
- rb->audio_ff_rewind(range_start);
-#if (CONFIG_STORAGE & STORAGE_MMC)
-/* MMC is slow - wait some time to allow track reload to finish */
- rb->sleep(HZ/20);
- if (mp3->elapsed > play_end) /* reload in progress */
- rb->splash(10*HZ, "Wait - reloading");
-#endif
- rb->audio_resume();
- break;
-
- case LOOP_MODE_FROM:
- rb->audio_pause();
- rb->audio_ff_rewind(xpos_to_time(split_x));
-#if (CONFIG_STORAGE & STORAGE_MMC)
-/* MMC is slow - wait some time to allow track reload to finish */
- rb->sleep(HZ/20);
- if (mp3->elapsed > play_end) /* reload in progress */
- rb->splash(10*HZ, "Wait - reloading");
-#endif
- rb->audio_resume();
- break;
-
- case LOOP_MODE_FREE:
- range_width = range_end - range_start;
- set_range_by_time(mp3,
- range_end + range_width / 2, range_width);
-
- /* play_end und play_start anpassen */
- splitedit_set_loop_mode(LOOP_MODE_FREE);
- rb->memset(osci_buffer, 0, sizeof osci_buffer);
- update_osci();
- rb->lcd_update();
- break;
- }
- }
- }
-
- button = rb->button_get(false);
- rb->yield();
-
- /* here the evaluation of the key scheme starts.
- All functions the user triggers are called from
- within execute_scheme */
- /* key_scheme_execute(button, &scheme); */
- switch (button)
- {
- case SPLITEDIT_PLAY:
-#ifdef SPLITEDIT_PLAY_PRE
- if (lastbutton != SPLITEDIT_PLAY_PRE)
- break;
-#endif
- rb->audio_pause();
- rb->audio_ff_rewind(xpos_to_time(split_x));
- rb->audio_resume();
- break;
-
- case BUTTON_UP:
- splitedit_zoom_in(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- break;
-
- case BUTTON_DOWN:
- splitedit_zoom_out(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- break;
-
- case BUTTON_LEFT:
- case BUTTON_LEFT | BUTTON_REPEAT:
- if (splitedit_get_split_x() > OSCI_X + 2)
- {
- splitedit_set_split_x(splitedit_get_split_x() - 1);
- }
- else
- {
- scroll(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- }
- break;
-
- case BUTTON_RIGHT:
- case BUTTON_RIGHT | BUTTON_REPEAT:
- if (splitedit_get_split_x() < OSCI_X + OSCI_WIDTH-3)
- {
- splitedit_set_split_x(splitedit_get_split_x() + 1);
- }
- else
- {
- scroll(mp3);
- lastx = time_to_xpos(mp3->elapsed);
- }
- break;
-
- case SPLITEDIT_SAVE:
- save_editor(mp3, xpos_to_time(split_x));
- rb->lcd_clear_display();
- update_osci();
- update_timebar(mp3);
- update_icons();
- break;
-
- case SPLITEDIT_LOOP_MODE:
- splitedit_set_loop_mode(splitedit_get_loop_mode() + 1);
- update_icons();
- break;
-
- case SPLITEDIT_SCALE:
- splitedit_invalidate_osci();
- update_icons();
- break;
-
-#ifdef SPLITEDIT_RC_QUIT
- case SPLITEDIT_RC_QUIT:
-#endif
- case SPLITEDIT_QUIT:
- exit_request = true;
- break;
-
- default:
- if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
- {
- splitedit_exit_code = PLUGIN_USB_CONNECTED;
- exit_request = true;
- }
- break;
-
- }
- if (button != BUTTON_NONE)
- lastbutton = button;
-
- if (validation_start == ~(unsigned int)0)
- {
- if (elapsed < range_end && elapsed > range_start)
- {
- validation_start = elapsed;
- }
- else
- {
- int endx = time_to_xpos(range_end);
- validation_start = xpos_to_time(endx - 2);
- }
- last_elapsed = elapsed + 1;
- }
- else
- {
- if ((last_elapsed <= validation_start) &&
- (elapsed > validation_start))
- {
- osci_valid = true;
- }
-
- last_elapsed = elapsed;
- }
- update_data();
-
- if (mp3 != rb->audio_current_track())
- {
- struct mp3entry *new_mp3 = rb->audio_current_track();
- if (rb->strncasecmp(path_mp3, new_mp3->path,
- sizeof (path_mp3)))
- {
- rb->splash(0, "Abort due to file change");
- rb->button_get(true);
- rb->button_get(true);
- exit_request = true;
- }
- else
- {
- mp3 = new_mp3;
- rb->audio_pause();
- rb->audio_flush_and_reload_tracks();
- rb->audio_ff_rewind(range_start);
- rb->audio_resume();
- }
- }
- }
- }
- return retval;
-}
-
-enum plugin_status plugin_start(const void* parameter)
-{
- struct mp3entry* mp3;
-
- (void)parameter;
- rb->lcd_clear_display();
- rb->lcd_update();
- mp3 = rb->audio_current_track();
- if (mp3 != NULL)
- {
- if (rb->audio_status() & AUDIO_STATUS_PAUSE)
- {
- rb->audio_resume();
- }
- splitedit_editor(mp3, mp3->elapsed, MIN_RANGE_SIZE * 8);
- }
- else
- {
- rb->splash(0, "Play or pause a mp3 file first.");
- rb->button_get(true);
- rb->button_get(true);
- }
- return splitedit_exit_code;
-}
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)
rb->sleep(1);
rb->lcd_clear_display();
-#if (CONFIG_CODEC == SWCODEC)
/* This will make the stars pulse to the music */
if(pulse){
@@ -255,7 +254,7 @@ static int plugin_main(void)
starfield.z_move = avg_peak;
} /* if pulse */
-#endif
+
starfield_move_and_draw(&starfield);
#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 @@
#endif
#endif
-#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
-#define mas_codec_readreg(x) rand()%MAX_PEAK
-#endif
-
/* Defines x positions on a logarithmic (dBfs) scale. */
unsigned char analog_db_scale[LCD_WIDTH/2];
@@ -780,13 +776,11 @@ static void draw_digital_minimeters(void) {
static void analog_meter(void) {
-#if (CONFIG_CODEC == SWCODEC)
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
#define left_peak peaks.left
#define right_peak peaks.right
-#endif
if(vumeter_settings.analog_use_db_scale) {
left_needle_top_x = analog_db_scale[left_peak * half_width / MAX_PEAK];
@@ -837,13 +831,11 @@ static void analog_meter(void) {
}
static void digital_meter(void) {
-#if (CONFIG_CODEC == SWCODEC)
static struct pcm_peaks peaks;
rb->mixer_channel_calculate_peaks(PCM_MIXER_CHAN_PLAYBACK,
&peaks);
#define left_peak peaks.left
#define right_peak peaks.right
-#endif
if(vumeter_settings.digital_use_db_scale) {
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){
no_yes, 2, NULL);
if (new_setting != settings.sound )
settings.sound=new_setting;
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
break;
@@ -318,7 +318,7 @@ static void options_menu(void){
/* menu */
static bool zxbox_menu(void)
{
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
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)
#ifdef USE_GREY
grey_show(false);
grey_release();
-#endif
+#endif
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
rb->pcm_play_stop();
#endif
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];
#define SPECT_MEM 1
/* Define if sound driver is available. */
-#if CONFIG_CODEC == SWCODEC && !defined SIMULATOR
+#if !defined SIMULATOR
#define HAVE_SOUND
#endif