summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-05-20 20:59:33 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-05-20 20:59:33 +0000
commit6dbf4081df9fc827be940c70c95dfc0725b1b31a (patch)
tree056b32b448660050eed851e0461a39a6f708a585
parent4a2ed72b5ca25b1aee524b2321f62f65aaf454bf (diff)
downloadrockbox-6dbf4081df9fc827be940c70c95dfc0725b1b31a.tar.gz
rockbox-6dbf4081df9fc827be940c70c95dfc0725b1b31a.zip
Fix the wavrecord errors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13450 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/wavrecord.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c
index 528d790ed5..236fc13cb9 100644
--- a/apps/plugins/wavrecord.c
+++ b/apps/plugins/wavrecord.c
@@ -3164,15 +3164,6 @@ struct riff_header
3164#define PCM_DEPTH_BYTES 2 3164#define PCM_DEPTH_BYTES 2
3165#define PCM_DEPTH_BITS 16 3165#define PCM_DEPTH_BITS 16
3166 3166
3167enum {
3168 SRC_LINE = 0,
3169 SRC_MIC,
3170#ifdef HAVE_SPDIF_IN
3171 SRC_SPDIF,
3172#endif
3173 NUM_SRC,
3174};
3175
3176void rec_tick(void) __attribute__((interrupt_handler)); 3167void rec_tick(void) __attribute__((interrupt_handler));
3177 3168
3178/* variables */ 3169/* variables */
@@ -3194,16 +3185,18 @@ static char *samplerate_str[9] = { "8000", "11025", "12000",
3194 "16000", "22050", "24000", 3185 "16000", "22050", "24000",
3195 "32000", "44100", "48000" }; 3186 "32000", "44100", "48000" };
3196static char *channel_str[2] = { "mono", "stereo" }; 3187static char *channel_str[2] = { "mono", "stereo" };
3197static char *source_str[NUM_SRC] = { "line in", "mic", 3188static char *source_str[REC_NUM_SOURCES] = {
3198#ifdef HAVE_SPDIF_IN 3189 [REC_SRC_LINEIN] = "line in",
3199 "spdif", 3190 [REC_SRC_MIC] = "mic",
3191#ifdef HAVE_SPDIF_REC
3192 [REC_SRC_SPDIF] = "spdif",
3200#endif 3193#endif
3201 }; 3194 };
3202 3195
3203struct configdata disk_config[] = { 3196struct configdata disk_config[] = {
3204 { TYPE_ENUM, 0, 9, &reccfg_disk.samplerate, "sample rate", samplerate_str, NULL }, 3197 { TYPE_ENUM, 0, 9, &reccfg_disk.samplerate, "sample rate", samplerate_str, NULL },
3205 { TYPE_ENUM, 0, 2, &reccfg_disk.channels, "channels", channel_str, NULL }, 3198 { TYPE_ENUM, 0, 2, &reccfg_disk.channels, "channels", channel_str, NULL },
3206 { TYPE_ENUM, 0, NUM_SRC, &reccfg_disk.source, "source", source_str, NULL }, 3199 { TYPE_ENUM, 0, REC_NUM_SOURCES, &reccfg_disk.source, "source", source_str, NULL },
3207}; 3200};
3208 3201
3209static char recfilename[MAX_PATH]; 3202static char recfilename[MAX_PATH];
@@ -3527,21 +3520,21 @@ static int record_file(char *filename)
3527 3520
3528 switch (reccfg.source) 3521 switch (reccfg.source)
3529 { 3522 {
3530 case SRC_LINE: 3523 case REC_SRC_LINEIN:
3531 rb->mas_codec_writereg(0, (rb->global_settings->rec_left_gain << 12) 3524 rb->mas_codec_writereg(0, (rb->global_settings->rec_left_gain << 12)
3532 | (rb->global_settings->rec_right_gain << 8) 3525 | (rb->global_settings->rec_right_gain << 8)
3533 | 0x07); 3526 | 0x07);
3534 rb->mas_codec_writereg(8, 0); 3527 rb->mas_codec_writereg(8, 0);
3535 break; 3528 break;
3536 3529
3537 case SRC_MIC: 3530 case REC_SRC_MIC:
3538 rb->mas_codec_writereg(0, (rb->global_settings->rec_mic_gain << 4) 3531 rb->mas_codec_writereg(0, (rb->global_settings->rec_mic_gain << 4)
3539 | 0x0d); 3532 | 0x0d);
3540 rb->mas_codec_writereg(8, 0x8000); /* Copy left channel to right */ 3533 rb->mas_codec_writereg(8, 0x8000); /* Copy left channel to right */
3541 break; 3534 break;
3542 3535
3543#ifdef HAVE_SPDIF_IN 3536#ifdef HAVE_SPDIF_REC
3544 case SRC_SPDIF: 3537 case REC_SRC_SPDIF:
3545 rb->mas_codec_writereg(0, 0x01); 3538 rb->mas_codec_writereg(0, 0x01);
3546 rb->snprintf(buf, sizeof(buf), "16bit %s", 3539 rb->snprintf(buf, sizeof(buf), "16bit %s",
3547 channel_str[reccfg.channels]); 3540 channel_str[reccfg.channels]);
@@ -3564,7 +3557,7 @@ static int record_file(char *filename)
3564 rb->mas_writemem(MAS_BANK_D0, PCM_IF_STATUS_CONTROL, &mas, 1); 3557 rb->mas_writemem(MAS_BANK_D0, PCM_IF_STATUS_CONTROL, &mas, 1);
3565 3558
3566#ifdef HAVE_SPDIF_IN 3559#ifdef HAVE_SPDIF_IN
3567 if (reccfg.source == SRC_SPDIF) 3560 if (reccfg.source == AUDIO_SRC_SPDIF)
3568 mas = 0x2225; /* recording, S/PDIF input, validate */ 3561 mas = 0x2225; /* recording, S/PDIF input, validate */
3569 else 3562 else
3570#endif 3563#endif
@@ -3705,11 +3698,11 @@ static int recording_menu(void)
3705 { "Mono", -1 }, 3698 { "Mono", -1 },
3706 { "Stereo", -1 }, 3699 { "Stereo", -1 },
3707 }; 3700 };
3708 static const struct opt_items srcs[NUM_SRC] = { 3701 static const struct opt_items srcs[REC_NUM_SOURCES] = {
3709 { "Line In", -1 }, 3702 [REC_SRC_LINEIN] = { "Line In", -1 },
3710 { "Microphone", -1 }, 3703 [REC_SRC_MIC] = { "Microphone", -1 },
3711#ifdef HAVE_SPDIF_IN 3704#ifdef HAVE_SPDIF_REC
3712 { "S/PDIF", -1 }, 3705 [REC_SRC_SPDIF] = { "S/PDIF", -1 },
3713#endif 3706#endif
3714 }; 3707 };
3715 3708
@@ -3729,7 +3722,7 @@ static int recording_menu(void)
3729 break; 3722 break;
3730 3723
3731 case 2: /* Set source */ 3724 case 2: /* Set source */
3732 rb->set_option("Source", &reccfg.source, INT, srcs, NUM_SRC, NULL); 3725 rb->set_option("Source", &reccfg.source, INT, srcs, REC_NUM_SOURCES, NULL);
3733 break; 3726 break;
3734 3727
3735 case 3: /* Start recording */ 3728 case 3: /* Start recording */