2002-11-10 16:42:31 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
2003-09-20 18:02:05 +00:00
|
|
|
#include <stdlib.h>
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
#include "system.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "mpeg.h"
|
2002-11-19 21:07:44 +00:00
|
|
|
#include "mas.h"
|
2002-11-10 16:42:31 +00:00
|
|
|
#include "button.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "icons.h"
|
|
|
|
#include "screens.h"
|
|
|
|
#include "peakmeter.h"
|
|
|
|
#include "status.h"
|
|
|
|
#include "menu.h"
|
2002-11-10 23:18:33 +00:00
|
|
|
#include "sound_menu.h"
|
2002-11-20 00:02:52 +00:00
|
|
|
#include "timefuncs.h"
|
|
|
|
#include "debug.h"
|
2003-03-10 12:19:49 +00:00
|
|
|
#include "misc.h"
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
bool f2_rec_screen(void);
|
|
|
|
bool f3_rec_screen(void);
|
|
|
|
|
|
|
|
#define SOURCE_MIC 0
|
|
|
|
#define SOURCE_LINE 1
|
|
|
|
#define SOURCE_SPDIF 2
|
|
|
|
|
|
|
|
char *freq_str[6] =
|
|
|
|
{
|
|
|
|
"44.1kHz",
|
|
|
|
"48kHz",
|
|
|
|
"32kHz",
|
|
|
|
"22.05kHz",
|
|
|
|
"24kHz",
|
|
|
|
"16kHz"
|
|
|
|
};
|
|
|
|
|
|
|
|
static void set_gain(void)
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == SOURCE_MIC)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
2003-07-22 18:34:23 +00:00
|
|
|
mpeg_set_recording_gain(global_settings.rec_mic_gain, 0, true);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
mpeg_set_recording_gain(global_settings.rec_left_gain,
|
2003-07-22 18:34:23 +00:00
|
|
|
global_settings.rec_right_gain, false);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *fmtstr[] =
|
|
|
|
{
|
|
|
|
"", /* no decimals */
|
|
|
|
"%d.%d %s ", /* 1 decimal */
|
|
|
|
"%d.%02d %s " /* 2 decimals */
|
|
|
|
};
|
|
|
|
|
|
|
|
char *fmt_gain(int snd, int val, char *str, int len)
|
|
|
|
{
|
|
|
|
int tmp, i, d, numdec;
|
|
|
|
char *unit;
|
|
|
|
|
|
|
|
tmp = mpeg_val2phys(snd, val);
|
|
|
|
numdec = mpeg_sound_numdecimals(snd);
|
|
|
|
unit = mpeg_sound_unit(snd);
|
|
|
|
|
|
|
|
i = tmp / (10*numdec);
|
2003-09-19 23:46:57 +00:00
|
|
|
d = abs(tmp % (10*numdec));
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
snprintf(str, len, fmtstr[numdec], i, d, unit);
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2002-12-18 14:57:45 +00:00
|
|
|
static int cursor;
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
void adjust_cursor(void)
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == SOURCE_LINE)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
|
|
|
if(cursor < 0)
|
|
|
|
cursor = 0;
|
|
|
|
|
|
|
|
if(cursor > 2)
|
|
|
|
cursor = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cursor = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-06 00:44:38 +00:00
|
|
|
char *rec_create_filename(void)
|
2002-11-20 00:02:52 +00:00
|
|
|
{
|
|
|
|
static char fname[32];
|
|
|
|
struct tm * tm;
|
|
|
|
|
|
|
|
tm = get_time();
|
|
|
|
|
2003-04-11 00:44:21 +00:00
|
|
|
/* Create a filename: RYYMMDD-HHMMSS.mp3 */
|
|
|
|
snprintf(fname, 32, "/R%02d%02d%02d-%02d%02d%02d.mp3",
|
2003-01-27 14:43:32 +00:00
|
|
|
tm->tm_year%100, tm->tm_mon+1, tm->tm_mday,
|
2002-11-20 00:02:52 +00:00
|
|
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
|
|
|
|
|
|
|
DEBUGF("Filename: %s\n", fname);
|
|
|
|
return fname;
|
|
|
|
}
|
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
bool recording_screen(void)
|
|
|
|
{
|
|
|
|
int button;
|
|
|
|
bool done = false;
|
|
|
|
char buf[32];
|
|
|
|
char buf2[32];
|
|
|
|
long timeout = current_tick + HZ/10;
|
|
|
|
int gain;
|
|
|
|
int w, h;
|
|
|
|
int update_countdown = 1;
|
2002-11-11 13:19:17 +00:00
|
|
|
bool have_recorded = false;
|
2003-11-20 00:33:43 +00:00
|
|
|
unsigned int seconds;
|
|
|
|
unsigned int last_seconds = 0;
|
2002-11-19 21:07:44 +00:00
|
|
|
int hours, minutes;
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
cursor = 0;
|
|
|
|
mpeg_init_recording();
|
2002-11-24 00:23:49 +00:00
|
|
|
|
|
|
|
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
status_set_playmode(STATUS_STOP);
|
2003-03-25 02:13:54 +00:00
|
|
|
|
|
|
|
/* Yes, we use the D/A for monitoring */
|
|
|
|
peak_meter_playback(true);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
peak_meter_enabled = true;
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
mpeg_set_recording_options(global_settings.rec_frequency,
|
|
|
|
global_settings.rec_quality,
|
|
|
|
global_settings.rec_source,
|
2003-04-20 22:00:30 +00:00
|
|
|
global_settings.rec_channels,
|
|
|
|
global_settings.rec_editable);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
2002-11-13 08:27:18 +00:00
|
|
|
set_gain();
|
|
|
|
|
2003-01-15 13:57:10 +00:00
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_getstringsize("M", &w, &h);
|
2003-04-24 12:57:15 +00:00
|
|
|
lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8);
|
2002-11-20 00:02:52 +00:00
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
while(!done)
|
|
|
|
{
|
2003-02-14 09:44:34 +00:00
|
|
|
button = button_get_w_tmo(HZ / peak_meter_fps);
|
2002-11-10 16:42:31 +00:00
|
|
|
switch(button)
|
|
|
|
{
|
|
|
|
case BUTTON_OFF:
|
|
|
|
if(mpeg_status())
|
|
|
|
{
|
|
|
|
mpeg_stop();
|
|
|
|
status_set_playmode(STATUS_STOP);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
peak_meter_playback(true);
|
|
|
|
peak_meter_enabled = false;
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_PLAY:
|
2002-11-11 08:16:18 +00:00
|
|
|
/* Only act if the mpeg is stopped */
|
|
|
|
if(!mpeg_status())
|
|
|
|
{
|
2002-11-11 13:19:17 +00:00
|
|
|
have_recorded = true;
|
2003-11-06 00:44:38 +00:00
|
|
|
mpeg_record(rec_create_filename());
|
2002-11-11 08:16:18 +00:00
|
|
|
status_set_playmode(STATUS_RECORD);
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
}
|
2003-11-02 11:24:38 +00:00
|
|
|
else
|
|
|
|
{
|
2003-11-06 00:44:38 +00:00
|
|
|
mpeg_new_file(rec_create_filename());
|
2003-11-02 11:24:38 +00:00
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
}
|
2003-11-20 00:33:43 +00:00
|
|
|
last_seconds = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_UP:
|
|
|
|
cursor--;
|
|
|
|
adjust_cursor();
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_DOWN:
|
|
|
|
cursor++;
|
|
|
|
adjust_cursor();
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_RIGHT:
|
2003-03-10 11:23:57 +00:00
|
|
|
case BUTTON_RIGHT | BUTTON_REPEAT:
|
2002-11-10 16:42:31 +00:00
|
|
|
switch(cursor)
|
|
|
|
{
|
|
|
|
case 0:
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == SOURCE_MIC)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_mic_gain++;
|
|
|
|
if(global_settings.rec_mic_gain >
|
|
|
|
mpeg_sound_max(SOUND_MIC_GAIN))
|
|
|
|
global_settings.rec_mic_gain =
|
|
|
|
mpeg_sound_max(SOUND_MIC_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
gain = MAX(global_settings.rec_left_gain,
|
|
|
|
global_settings.rec_right_gain) + 1;
|
2002-11-10 16:42:31 +00:00
|
|
|
if(gain > mpeg_sound_max(SOUND_MIC_GAIN))
|
|
|
|
gain = mpeg_sound_max(SOUND_MIC_GAIN);
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_left_gain = gain;
|
|
|
|
global_settings.rec_right_gain = gain;
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_left_gain++;
|
|
|
|
if(global_settings.rec_left_gain >
|
|
|
|
mpeg_sound_max(SOUND_LEFT_GAIN))
|
|
|
|
global_settings.rec_left_gain =
|
|
|
|
mpeg_sound_max(SOUND_LEFT_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_right_gain++;
|
|
|
|
if(global_settings.rec_right_gain >
|
|
|
|
mpeg_sound_max(SOUND_RIGHT_GAIN))
|
|
|
|
global_settings.rec_right_gain =
|
|
|
|
mpeg_sound_max(SOUND_RIGHT_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
set_gain();
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_LEFT:
|
2003-03-10 11:23:57 +00:00
|
|
|
case BUTTON_LEFT | BUTTON_REPEAT:
|
2002-11-10 16:42:31 +00:00
|
|
|
switch(cursor)
|
|
|
|
{
|
|
|
|
case 0:
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == SOURCE_MIC)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_mic_gain--;
|
|
|
|
if(global_settings.rec_mic_gain <
|
|
|
|
mpeg_sound_min(SOUND_MIC_GAIN))
|
|
|
|
global_settings.rec_mic_gain =
|
|
|
|
mpeg_sound_min(SOUND_MIC_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
gain = MAX(global_settings.rec_left_gain,
|
|
|
|
global_settings.rec_right_gain) - 1;
|
2002-11-10 16:42:31 +00:00
|
|
|
if(gain < mpeg_sound_min(SOUND_LEFT_GAIN))
|
|
|
|
gain = mpeg_sound_min(SOUND_LEFT_GAIN);
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_left_gain = gain;
|
|
|
|
global_settings.rec_right_gain = gain;
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_left_gain--;
|
|
|
|
if(global_settings.rec_left_gain <
|
|
|
|
mpeg_sound_min(SOUND_LEFT_GAIN))
|
|
|
|
global_settings.rec_left_gain =
|
|
|
|
mpeg_sound_min(SOUND_LEFT_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_right_gain--;
|
|
|
|
if(global_settings.rec_right_gain <
|
|
|
|
mpeg_sound_min(SOUND_MIC_GAIN))
|
|
|
|
global_settings.rec_right_gain =
|
|
|
|
mpeg_sound_min(SOUND_MIC_GAIN);
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
set_gain();
|
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
case BUTTON_F1:
|
2003-11-20 00:33:43 +00:00
|
|
|
if (recording_menu(false))
|
2002-11-10 23:18:33 +00:00
|
|
|
return SYS_USB_CONNECTED;
|
|
|
|
settings_save();
|
2002-11-11 08:16:18 +00:00
|
|
|
mpeg_set_recording_options(global_settings.rec_frequency,
|
|
|
|
global_settings.rec_quality,
|
|
|
|
global_settings.rec_source,
|
2003-04-20 22:00:30 +00:00
|
|
|
global_settings.rec_channels,
|
|
|
|
global_settings.rec_editable);
|
2002-11-11 08:16:18 +00:00
|
|
|
|
|
|
|
set_gain();
|
2002-11-10 23:18:33 +00:00
|
|
|
update_countdown = 1; /* Update immediately */
|
|
|
|
break;
|
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
case BUTTON_F2:
|
2003-05-02 01:37:05 +00:00
|
|
|
if(!mpeg_status())
|
2003-04-20 22:00:30 +00:00
|
|
|
{
|
|
|
|
if (f2_rec_screen())
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
|
|
|
have_recorded = true;
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
update_countdown = 1; /* Update immediately */
|
2003-04-20 22:00:30 +00:00
|
|
|
}
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_F3:
|
2003-05-02 01:37:05 +00:00
|
|
|
if(!mpeg_status())
|
2003-04-20 22:00:30 +00:00
|
|
|
{
|
|
|
|
if (f3_rec_screen())
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
|
|
|
have_recorded = true;
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
update_countdown = 1; /* Update immediately */
|
2003-04-20 22:00:30 +00:00
|
|
|
}
|
2002-11-10 16:42:31 +00:00
|
|
|
break;
|
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
/* Only accept USB connection when not recording */
|
|
|
|
if(!mpeg_status())
|
|
|
|
{
|
|
|
|
usb_screen();
|
|
|
|
have_recorded = true; /* Refreshes the browser later on */
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
break;
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
peak_meter_peek();
|
|
|
|
|
|
|
|
if(TIME_AFTER(current_tick, timeout))
|
|
|
|
{
|
2003-02-14 03:31:45 +00:00
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
timeout = current_tick + HZ/10;
|
|
|
|
|
2003-02-14 02:48:12 +00:00
|
|
|
seconds = mpeg_recorded_time() / HZ;
|
2003-06-19 12:08:22 +00:00
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
update_countdown--;
|
2002-11-19 21:07:44 +00:00
|
|
|
if(update_countdown == 0 || seconds > last_seconds)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
2003-11-20 00:33:43 +00:00
|
|
|
unsigned int dseconds, dhours, dminutes;
|
2003-04-24 12:57:15 +00:00
|
|
|
int pos = 0;
|
|
|
|
|
2002-11-19 21:07:44 +00:00
|
|
|
update_countdown = 5;
|
|
|
|
last_seconds = seconds;
|
|
|
|
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_clear_display();
|
2002-11-19 21:07:44 +00:00
|
|
|
|
|
|
|
hours = seconds / 3600;
|
|
|
|
minutes = (seconds - (hours * 3600)) / 60;
|
2003-02-14 02:48:12 +00:00
|
|
|
snprintf(buf, 32, "%s %02d:%02d:%02d",
|
|
|
|
str(LANG_RECORDING_TIME),
|
|
|
|
hours, minutes, seconds%60);
|
|
|
|
lcd_puts(0, 0, buf);
|
2003-06-04 13:48:50 +00:00
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
dseconds = rec_timesplit_seconds();
|
2003-06-04 13:48:50 +00:00
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
/* Display the split interval if the record timesplit
|
|
|
|
is active */
|
|
|
|
if (global_settings.rec_timesplit)
|
|
|
|
{
|
2003-06-04 13:48:50 +00:00
|
|
|
/* Display the record timesplit interval rather than
|
|
|
|
the file size if the record timer is active */
|
|
|
|
dhours = dseconds / 3600;
|
|
|
|
dminutes = (dseconds - (dhours * 3600)) / 60;
|
|
|
|
snprintf(buf, 32, "%s %02d:%02d",
|
|
|
|
str(LANG_RECORD_TIMESPLIT_REC),
|
|
|
|
dhours, dminutes);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
snprintf(buf, 32, "%s %s", str(LANG_RECORDING_SIZE),
|
|
|
|
num2max5(mpeg_num_recorded_bytes(), buf2));
|
2002-11-19 21:07:44 +00:00
|
|
|
lcd_puts(0, 1, buf);
|
2003-02-14 02:48:12 +00:00
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
/* We will do file splitting regardless, since the OFF
|
|
|
|
setting really means 24 hours. This is to make sure
|
|
|
|
that the recorded files don't get too big. */
|
|
|
|
if (mpeg_status() && (seconds >= dseconds))
|
|
|
|
{
|
|
|
|
mpeg_new_file(rec_create_filename());
|
|
|
|
update_countdown = 1;
|
|
|
|
last_seconds = 0;
|
|
|
|
}
|
|
|
|
|
2002-11-19 21:07:44 +00:00
|
|
|
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
/* Show mic gain if input source is Mic */
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == 0)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
|
|
|
snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN),
|
2002-11-10 23:18:33 +00:00
|
|
|
fmt_gain(SOUND_MIC_GAIN,
|
|
|
|
global_settings.rec_mic_gain,
|
2002-11-10 16:42:31 +00:00
|
|
|
buf2, sizeof(buf2)));
|
2003-04-24 12:57:15 +00:00
|
|
|
if (global_settings.invert_cursor && (pos++ == cursor))
|
|
|
|
lcd_puts_style(0, 3, buf, STYLE_INVERT);
|
|
|
|
else
|
|
|
|
lcd_puts(0, 3, buf);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source == SOURCE_LINE)
|
2002-11-10 16:42:31 +00:00
|
|
|
{
|
2002-11-10 23:18:33 +00:00
|
|
|
gain = MAX(global_settings.rec_left_gain,
|
|
|
|
global_settings.rec_right_gain);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN),
|
|
|
|
fmt_gain(SOUND_LEFT_GAIN, gain,
|
|
|
|
buf2, sizeof(buf2)));
|
2003-04-24 12:57:15 +00:00
|
|
|
if (global_settings.invert_cursor && (pos++ == cursor))
|
|
|
|
lcd_puts_style(0, 3, buf, STYLE_INVERT);
|
|
|
|
else
|
|
|
|
lcd_puts(0, 3, buf);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT),
|
2002-11-10 23:18:33 +00:00
|
|
|
fmt_gain(SOUND_LEFT_GAIN,
|
|
|
|
global_settings.rec_left_gain,
|
2002-11-10 16:42:31 +00:00
|
|
|
buf2, sizeof(buf2)));
|
2003-04-24 12:57:15 +00:00
|
|
|
if (global_settings.invert_cursor && (pos++ == cursor))
|
|
|
|
lcd_puts_style(0, 4, buf, STYLE_INVERT);
|
|
|
|
else
|
|
|
|
lcd_puts(0, 4, buf);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT),
|
2002-11-10 23:18:33 +00:00
|
|
|
fmt_gain(SOUND_RIGHT_GAIN,
|
|
|
|
global_settings.rec_right_gain,
|
2002-11-10 16:42:31 +00:00
|
|
|
buf2, sizeof(buf2)));
|
2003-04-24 12:57:15 +00:00
|
|
|
if (global_settings.invert_cursor && (pos++ == cursor))
|
|
|
|
lcd_puts_style(0, 5, buf, STYLE_INVERT);
|
|
|
|
else
|
|
|
|
lcd_puts(0, 5, buf);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
if(global_settings.rec_source != SOURCE_SPDIF)
|
2002-11-10 16:42:31 +00:00
|
|
|
put_cursorxy(0, 3 + cursor, true);
|
|
|
|
|
|
|
|
snprintf(buf, 32, "%s %s [%d]",
|
2002-11-10 23:18:33 +00:00
|
|
|
freq_str[global_settings.rec_frequency],
|
|
|
|
global_settings.rec_channels?
|
2002-11-10 16:42:31 +00:00
|
|
|
str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO),
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_quality);
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_puts(0, 6, buf);
|
2003-02-14 03:31:45 +00:00
|
|
|
|
2003-05-26 09:26:16 +00:00
|
|
|
status_draw(true);
|
2003-02-14 03:31:45 +00:00
|
|
|
|
2002-11-24 00:23:49 +00:00
|
|
|
lcd_update();
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-19 21:07:44 +00:00
|
|
|
lcd_clearrect(0, 8 + h*2, LCD_WIDTH, h);
|
|
|
|
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
|
|
|
|
lcd_update_rect(0, 8 + h*2, LCD_WIDTH, h);
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
}
|
2003-06-19 12:08:22 +00:00
|
|
|
|
|
|
|
if(mpeg_status() & MPEG_STATUS_ERROR)
|
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(mpeg_status() & MPEG_STATUS_ERROR)
|
|
|
|
{
|
|
|
|
status_set_playmode(STATUS_STOP);
|
|
|
|
splash(0, 0, true, str(LANG_DISK_FULL));
|
|
|
|
status_draw(true);
|
|
|
|
lcd_update();
|
|
|
|
mpeg_error_clear();
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
button = button_get(true);
|
|
|
|
if(button == (BUTTON_OFF | BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mpeg_init_playback();
|
|
|
|
|
2002-11-24 00:23:49 +00:00
|
|
|
mpeg_sound_channel_config(global_settings.channel_config);
|
|
|
|
mpeg_sound_set(SOUND_BASS, global_settings.bass);
|
|
|
|
mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
|
|
|
|
mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
|
|
|
|
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
|
|
|
|
mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
|
|
|
|
mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
|
|
|
|
mpeg_sound_set(SOUND_AVC, global_settings.avc);
|
2003-11-20 00:33:43 +00:00
|
|
|
|
2003-01-15 13:57:10 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2002-11-11 13:19:17 +00:00
|
|
|
return have_recorded;
|
2002-11-10 16:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool f2_rec_screen(void)
|
|
|
|
{
|
|
|
|
bool exit = false;
|
|
|
|
bool used = false;
|
|
|
|
int w, h;
|
|
|
|
char buf[32];
|
|
|
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
lcd_getstringsize("A",&w,&h);
|
|
|
|
|
|
|
|
while (!exit) {
|
|
|
|
char* ptr=NULL;
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
/* Recording quality */
|
|
|
|
lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_QUALITY));
|
2002-11-10 23:18:33 +00:00
|
|
|
snprintf(buf, 32, "%d", global_settings.rec_quality);
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_putsxy(0, LCD_HEIGHT/2-h, buf);
|
|
|
|
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
|
|
|
|
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
|
|
|
|
|
|
|
|
/* Frequency */
|
|
|
|
snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY));
|
|
|
|
lcd_getstringsize(buf,&w,&h);
|
|
|
|
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf);
|
2002-11-10 23:18:33 +00:00
|
|
|
ptr = freq_str[global_settings.rec_frequency];
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_getstringsize(ptr, &w, &h);
|
|
|
|
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
|
|
|
|
lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
|
|
|
|
LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true);
|
|
|
|
|
|
|
|
/* Channel mode */
|
2002-11-10 23:18:33 +00:00
|
|
|
switch ( global_settings.rec_channels ) {
|
2002-11-10 16:42:31 +00:00
|
|
|
case 0:
|
|
|
|
ptr = str(LANG_CHANNEL_STEREO);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
ptr = str(LANG_CHANNEL_MONO);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
lcd_getstringsize(str(LANG_RECORDING_CHANNELS), &w, &h);
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2,
|
2002-11-10 23:18:33 +00:00
|
|
|
str(LANG_RECORDING_CHANNELS));
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_getstringsize(str(LANG_F2_MODE), &w, &h);
|
|
|
|
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
|
|
|
|
lcd_getstringsize(ptr, &w, &h);
|
|
|
|
lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
|
|
|
|
lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
|
|
|
|
LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true);
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
switch (button_get(true)) {
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
case BUTTON_F2 | BUTTON_LEFT:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_quality++;
|
|
|
|
if(global_settings.rec_quality > 7)
|
|
|
|
global_settings.rec_quality = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_DOWN:
|
|
|
|
case BUTTON_F2 | BUTTON_DOWN:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_frequency++;
|
|
|
|
if(global_settings.rec_frequency > 5)
|
|
|
|
global_settings.rec_frequency = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_RIGHT:
|
|
|
|
case BUTTON_F2 | BUTTON_RIGHT:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_channels++;
|
|
|
|
if(global_settings.rec_channels > 1)
|
|
|
|
global_settings.rec_channels = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_F2 | BUTTON_REL:
|
|
|
|
if ( used )
|
|
|
|
exit = true;
|
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_F2 | BUTTON_REPEAT:
|
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
usb_screen();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
mpeg_set_recording_options(global_settings.rec_frequency,
|
|
|
|
global_settings.rec_quality,
|
|
|
|
global_settings.rec_source,
|
2003-04-20 22:00:30 +00:00
|
|
|
global_settings.rec_channels,
|
|
|
|
global_settings.rec_editable);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
set_gain();
|
|
|
|
|
|
|
|
settings_save();
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool f3_rec_screen(void)
|
|
|
|
{
|
|
|
|
bool exit = false;
|
|
|
|
bool used = false;
|
|
|
|
int w, h;
|
2002-11-10 23:18:33 +00:00
|
|
|
char *src_str[] =
|
|
|
|
{
|
|
|
|
str(LANG_RECORDING_SRC_MIC),
|
|
|
|
str(LANG_RECORDING_SRC_LINE),
|
|
|
|
str(LANG_RECORDING_SRC_DIGITAL)
|
|
|
|
};
|
2002-11-10 16:42:31 +00:00
|
|
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
lcd_getstringsize("A",&w,&h);
|
|
|
|
|
|
|
|
while (!exit) {
|
|
|
|
char* ptr=NULL;
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
/* Recording source */
|
|
|
|
lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_RECORDING_SOURCE));
|
2002-11-10 23:18:33 +00:00
|
|
|
ptr = src_str[global_settings.rec_source];
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_getstringsize(ptr, &w, &h);
|
|
|
|
lcd_putsxy(0, LCD_HEIGHT/2-h, ptr);
|
|
|
|
lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
|
|
|
|
LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true);
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
|
|
|
|
switch (button_get(true)) {
|
|
|
|
case BUTTON_LEFT:
|
|
|
|
case BUTTON_F3 | BUTTON_LEFT:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_source++;
|
|
|
|
if(global_settings.rec_source > 2)
|
|
|
|
global_settings.rec_source = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_DOWN:
|
|
|
|
case BUTTON_F3 | BUTTON_DOWN:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_frequency++;
|
|
|
|
if(global_settings.rec_frequency > 5)
|
|
|
|
global_settings.rec_frequency = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_RIGHT:
|
|
|
|
case BUTTON_F3 | BUTTON_RIGHT:
|
2002-11-10 23:18:33 +00:00
|
|
|
global_settings.rec_channels++;
|
|
|
|
if(global_settings.rec_channels > 1)
|
|
|
|
global_settings.rec_channels = 0;
|
2002-11-10 16:42:31 +00:00
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_F3 | BUTTON_REL:
|
|
|
|
if ( used )
|
|
|
|
exit = true;
|
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUTTON_F3 | BUTTON_REPEAT:
|
|
|
|
used = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
usb_screen();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
mpeg_set_recording_options(global_settings.rec_frequency,
|
|
|
|
global_settings.rec_quality,
|
|
|
|
global_settings.rec_source,
|
2003-04-20 22:00:30 +00:00
|
|
|
global_settings.rec_channels,
|
|
|
|
global_settings.rec_editable);
|
2002-11-10 16:42:31 +00:00
|
|
|
|
2002-11-10 23:18:33 +00:00
|
|
|
set_gain();
|
|
|
|
|
|
|
|
settings_save();
|
2002-11-10 16:42:31 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|