1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Björn Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
26 #include "mp3_playback.h"
30 #ifdef HAVE_LCD_BITMAP
40 "%d.%d %s ", /* 1 decimal */
41 "%d.%02d %s " /* 2 decimals */
44 bool set_sound(char* string
,
57 int talkunit
= UNIT_INT
;
59 unit
= mpeg_sound_unit(setting
);
60 numdec
= mpeg_sound_numdecimals(setting
);
61 min
= mpeg_sound_min(setting
);
62 max
= mpeg_sound_max(setting
);
63 if (*unit
== 'd') /* crude reconstruction */
65 else if (*unit
== '%')
66 talkunit
= UNIT_PERCENT
;
68 #ifdef HAVE_LCD_BITMAP
69 if(global_settings
.statusbar
)
70 lcd_setmargins(0, STATUSBAR_HEIGHT
);
75 lcd_puts_scroll(0,0,string
);
79 val
= mpeg_val2phys(setting
, *variable
);
82 integer
= val
/ (10 * numdec
);
83 dec
= val
% (10 * numdec
);
84 snprintf(str
,sizeof str
, fmt
[numdec
], integer
, dec
, unit
);
88 snprintf(str
,sizeof str
,"%d %s ", val
, unit
);
90 if (global_settings
.talk_menu
)
91 talk_value(val
, talkunit
, false); /* speak it */
98 switch( button_get_w_tmo(HZ
/2) ) {
99 #ifdef HAVE_RECORDER_KEYPAD
101 case BUTTON_UP
| BUTTON_REPEAT
:
104 case BUTTON_RIGHT
| BUTTON_REPEAT
:
112 #ifdef HAVE_RECORDER_KEYPAD
114 case BUTTON_DOWN
| BUTTON_REPEAT
:
117 case BUTTON_LEFT
| BUTTON_REPEAT
:
125 #ifdef HAVE_RECORDER_KEYPAD
135 case SYS_USB_CONNECTED
:
140 mpeg_sound_set(setting
, *variable
);
142 if(setting
== SOUND_BALANCE
)
143 mpeg_sound_set(SOUND_VOLUME
, global_settings
.volume
);
151 static bool volume(void)
153 return set_sound(str(LANG_VOLUME
), &global_settings
.volume
, SOUND_VOLUME
);
156 static bool balance(void)
158 return set_sound(str(LANG_BALANCE
), &global_settings
.balance
,
162 static bool bass(void)
164 return set_sound(str(LANG_BASS
), &global_settings
.bass
, SOUND_BASS
);
167 static bool treble(void)
169 return set_sound(str(LANG_TREBLE
), &global_settings
.treble
, SOUND_TREBLE
);
173 static bool loudness(void)
175 return set_sound(str(LANG_LOUDNESS
), &global_settings
.loudness
,
179 static bool bass_boost(void)
181 return set_sound(str(LANG_BBOOST
), &global_settings
.bass_boost
,
185 static void set_avc(int val
)
187 mpeg_sound_set(SOUND_AVC
, val
);
190 static bool avc(void)
192 struct opt_items names
[] = {
194 { "2s", TALK_ID(2, UNIT_SEC
) },
195 { "4s", TALK_ID(4, UNIT_SEC
) },
196 { "8s", TALK_ID(8, UNIT_SEC
) }
198 return set_option(str(LANG_DECAY
), &global_settings
.avc
, INT
,
202 static bool recsource(void)
204 struct opt_items names
[] = {
205 { STR(LANG_RECORDING_SRC_MIC
) },
206 { STR(LANG_RECORDING_SRC_LINE
) },
207 { STR(LANG_RECORDING_SRC_DIGITAL
) }
209 return set_option(str(LANG_RECORDING_SOURCE
),
210 &global_settings
.rec_source
, INT
,
214 static bool recfrequency(void)
216 struct opt_items names
[] = {
217 { "44.1kHz", TALK_ID(44, UNIT_KHZ
) },
218 { "48kHz", TALK_ID(48, UNIT_KHZ
) },
219 { "32kHz", TALK_ID(32, UNIT_KHZ
) },
220 { "22.05kHz", TALK_ID(22, UNIT_KHZ
) },
221 { "24kHz", TALK_ID(24, UNIT_KHZ
) },
222 { "16kHz", TALK_ID(16, UNIT_KHZ
) }
224 return set_option(str(LANG_RECORDING_FREQUENCY
),
225 &global_settings
.rec_frequency
, INT
,
229 static bool recchannels(void)
231 struct opt_items names
[] = {
232 { STR(LANG_CHANNEL_STEREO
) },
233 { STR(LANG_CHANNEL_MONO
) }
235 return set_option(str(LANG_RECORDING_CHANNELS
),
236 &global_settings
.rec_channels
, INT
,
240 static bool recquality(void)
242 return set_int(str(LANG_RECORDING_QUALITY
), "", UNIT_INT
,
243 &global_settings
.rec_quality
,
247 static bool receditable(void)
249 return set_bool(str(LANG_RECORDING_EDITABLE
),
250 &global_settings
.rec_editable
);
253 static bool rectimesplit(void)
255 struct opt_items names
[] = {
257 { "00:05" , TALK_ID(5, UNIT_MIN
) },
258 { "00:10" , TALK_ID(10, UNIT_MIN
) },
259 { "00:15" , TALK_ID(15, UNIT_MIN
) },
260 { "00:30" , TALK_ID(30, UNIT_MIN
) },
261 { "01:00" , TALK_ID(1, UNIT_HOUR
) },
262 { "02:00" , TALK_ID(2, UNIT_HOUR
) },
263 { "04:00" , TALK_ID(4, UNIT_HOUR
) },
264 { "06:00" , TALK_ID(6, UNIT_HOUR
) },
265 { "08:00" , TALK_ID(8, UNIT_HOUR
) },
266 { "10:00" , TALK_ID(10, UNIT_HOUR
) },
267 { "12:00" , TALK_ID(12, UNIT_HOUR
) },
268 { "18:00" , TALK_ID(18, UNIT_HOUR
) },
269 { "24:00" , TALK_ID(24, UNIT_HOUR
) }
271 return set_option(str(LANG_RECORD_TIMESPLIT
),
272 &global_settings
.rec_timesplit
, INT
,
276 static bool recprerecord(void)
278 struct opt_items names
[] = {
280 { "1s", TALK_ID(1, UNIT_SEC
) },
281 { "2s", TALK_ID(2, UNIT_SEC
) },
282 { "3s", TALK_ID(3, UNIT_SEC
) },
283 { "4s", TALK_ID(4, UNIT_SEC
) },
284 { "5s", TALK_ID(5, UNIT_SEC
) },
285 { "6s", TALK_ID(6, UNIT_SEC
) },
286 { "7s", TALK_ID(7, UNIT_SEC
) },
287 { "8s", TALK_ID(8, UNIT_SEC
) },
288 { "9s", TALK_ID(9, UNIT_SEC
) },
289 { "10s", TALK_ID(10, UNIT_SEC
) },
290 { "11s", TALK_ID(11, UNIT_SEC
) },
291 { "12s", TALK_ID(12, UNIT_SEC
) },
292 { "13s", TALK_ID(13, UNIT_SEC
) },
293 { "14s", TALK_ID(14, UNIT_SEC
) },
294 { "15s", TALK_ID(15, UNIT_SEC
) },
295 { "16s", TALK_ID(16, UNIT_SEC
) },
296 { "17s", TALK_ID(17, UNIT_SEC
) },
297 { "18s", TALK_ID(18, UNIT_SEC
) },
298 { "19s", TALK_ID(19, UNIT_SEC
) },
299 { "20s", TALK_ID(20, UNIT_SEC
) },
300 { "21s", TALK_ID(21, UNIT_SEC
) },
301 { "22s", TALK_ID(22, UNIT_SEC
) },
302 { "23s", TALK_ID(23, UNIT_SEC
) },
303 { "24s", TALK_ID(24, UNIT_SEC
) },
304 { "25s", TALK_ID(25, UNIT_SEC
) },
305 { "26s", TALK_ID(26, UNIT_SEC
) },
306 { "27s", TALK_ID(27, UNIT_SEC
) },
307 { "28s", TALK_ID(28, UNIT_SEC
) },
308 { "29s", TALK_ID(29, UNIT_SEC
) },
309 { "30s", TALK_ID(30, UNIT_SEC
) }
311 return set_option(str(LANG_RECORD_PRERECORD_TIME
),
312 &global_settings
.rec_prerecord_time
, INT
,
316 static bool recdirectory(void)
318 struct opt_items names
[] = {
319 { rec_base_directory
, -1 },
320 { STR(LANG_RECORD_CURRENT_DIR
) }
322 return set_option(str(LANG_RECORD_DIRECTORY
),
323 &global_settings
.rec_directory
, INT
,
327 #endif /* HAVE_MAS3587F */
329 static void set_chanconf(int val
)
331 mpeg_sound_set(SOUND_CHANNELS
, val
);
334 static bool chanconf(void)
336 struct opt_items names
[] = {
337 { STR(LANG_CHANNEL_STEREO
) },
338 #ifdef HAVE_LCD_CHARCELLS
339 { STR(LANG_CHANNEL_STEREO_NARROW_PLAYER
) },
341 { STR(LANG_CHANNEL_STEREO_NARROW_RECORDER
) },
343 { STR(LANG_CHANNEL_MONO
) },
344 { STR(LANG_CHANNEL_LEFT
) },
345 { STR(LANG_CHANNEL_RIGHT
) },
346 { STR(LANG_CHANNEL_KARAOKE
) },
347 { STR(LANG_CHANNEL_STEREO_WIDE
) }
349 return set_option(str(LANG_CHANNEL
), &global_settings
.channel_config
, INT
,
350 names
, 7, set_chanconf
);
353 bool sound_menu(void)
357 struct menu_item items
[] = {
358 { STR(LANG_VOLUME
), volume
},
359 { STR(LANG_BASS
), bass
},
360 { STR(LANG_TREBLE
), treble
},
361 { STR(LANG_BALANCE
), balance
},
362 { STR(LANG_CHANNEL_MENU
), chanconf
},
364 { STR(LANG_LOUDNESS
), loudness
},
365 { STR(LANG_BBOOST
), bass_boost
},
366 { STR(LANG_AUTOVOL
), avc
}
370 m
=menu_init( items
, sizeof(items
) / sizeof(*items
), NULL
,
372 result
= menu_run(m
);
379 bool recording_menu(bool no_source
)
383 struct menu_item items
[8];
386 items
[i
].desc
= str(LANG_RECORDING_QUALITY
);
387 items
[i
].voice_id
= LANG_RECORDING_QUALITY
;
388 items
[i
++].function
= recquality
;
389 items
[i
].desc
= str(LANG_RECORDING_FREQUENCY
);
390 items
[i
].voice_id
= LANG_RECORDING_FREQUENCY
;
391 items
[i
++].function
= recfrequency
;
393 items
[i
].desc
= str(LANG_RECORDING_SOURCE
);
394 items
[i
].voice_id
= LANG_RECORDING_SOURCE
;
395 items
[i
++].function
= recsource
;
397 items
[i
].desc
= str(LANG_RECORDING_CHANNELS
);
398 items
[i
].voice_id
= LANG_RECORDING_CHANNELS
;
399 items
[i
++].function
= recchannels
;
400 items
[i
].desc
= str(LANG_RECORDING_EDITABLE
);
401 items
[i
].voice_id
= LANG_RECORDING_EDITABLE
;
402 items
[i
++].function
= receditable
;
403 items
[i
].desc
= str(LANG_RECORD_TIMESPLIT
);
404 items
[i
].voice_id
= LANG_RECORD_TIMESPLIT
;
405 items
[i
++].function
= rectimesplit
;
406 items
[i
].desc
= str(LANG_RECORD_PRERECORD_TIME
);
407 items
[i
].voice_id
= LANG_RECORD_PRERECORD_TIME
;
408 items
[i
++].function
= recprerecord
;
409 items
[i
].desc
= str(LANG_RECORD_DIRECTORY
);
410 items
[i
].voice_id
= LANG_RECORD_DIRECTORY
;
411 items
[i
++].function
= recdirectory
;
413 m
=menu_init( items
, i
, NULL
, NULL
, NULL
, NULL
);
414 result
= menu_run(m
);