diff options
Diffstat (limited to 'apps/plugins/wavrecord.c')
-rw-r--r-- | apps/plugins/wavrecord.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index 236fc13cb9..f1d1515344 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c | |||
@@ -3164,6 +3164,16 @@ 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 | ||
3167 | /* Define our own source constants since REC_SRC_FMRADIO will intrude on the count */ | ||
3168 | enum { | ||
3169 | WAV_SRC_LINE = 0, | ||
3170 | WAV_SRC_MIC, | ||
3171 | #ifdef HAVE_SPDIF_REC | ||
3172 | WAV_SRC_SPDIF, | ||
3173 | #endif | ||
3174 | WAV_NUM_SRC, | ||
3175 | }; | ||
3176 | |||
3167 | void rec_tick(void) __attribute__((interrupt_handler)); | 3177 | void rec_tick(void) __attribute__((interrupt_handler)); |
3168 | 3178 | ||
3169 | /* variables */ | 3179 | /* variables */ |
@@ -3185,18 +3195,13 @@ static char *samplerate_str[9] = { "8000", "11025", "12000", | |||
3185 | "16000", "22050", "24000", | 3195 | "16000", "22050", "24000", |
3186 | "32000", "44100", "48000" }; | 3196 | "32000", "44100", "48000" }; |
3187 | static char *channel_str[2] = { "mono", "stereo" }; | 3197 | static char *channel_str[2] = { "mono", "stereo" }; |
3188 | static char *source_str[REC_NUM_SOURCES] = { | 3198 | static char *source_str[WAV_NUM_SRC] = { "line in", "mic", |
3189 | [REC_SRC_LINEIN] = "line in", | 3199 | HAVE_SPDIF_REC_("spdif",) }; |
3190 | [REC_SRC_MIC] = "mic", | ||
3191 | #ifdef HAVE_SPDIF_REC | ||
3192 | [REC_SRC_SPDIF] = "spdif", | ||
3193 | #endif | ||
3194 | }; | ||
3195 | 3200 | ||
3196 | struct configdata disk_config[] = { | 3201 | struct configdata disk_config[] = { |
3197 | { TYPE_ENUM, 0, 9, &reccfg_disk.samplerate, "sample rate", samplerate_str, NULL }, | 3202 | { TYPE_ENUM, 0, 9, &reccfg_disk.samplerate, "sample rate", samplerate_str, NULL }, |
3198 | { TYPE_ENUM, 0, 2, &reccfg_disk.channels, "channels", channel_str, NULL }, | 3203 | { TYPE_ENUM, 0, 2, &reccfg_disk.channels, "channels", channel_str, NULL }, |
3199 | { TYPE_ENUM, 0, REC_NUM_SOURCES, &reccfg_disk.source, "source", source_str, NULL }, | 3204 | { TYPE_ENUM, 0, WAV_NUM_SRC, &reccfg_disk.source, "source", source_str, NULL }, |
3200 | }; | 3205 | }; |
3201 | 3206 | ||
3202 | static char recfilename[MAX_PATH]; | 3207 | static char recfilename[MAX_PATH]; |
@@ -3520,21 +3525,21 @@ static int record_file(char *filename) | |||
3520 | 3525 | ||
3521 | switch (reccfg.source) | 3526 | switch (reccfg.source) |
3522 | { | 3527 | { |
3523 | case REC_SRC_LINEIN: | 3528 | case WAV_SRC_LINE: |
3524 | rb->mas_codec_writereg(0, (rb->global_settings->rec_left_gain << 12) | 3529 | rb->mas_codec_writereg(0, (rb->global_settings->rec_left_gain << 12) |
3525 | | (rb->global_settings->rec_right_gain << 8) | 3530 | | (rb->global_settings->rec_right_gain << 8) |
3526 | | 0x07); | 3531 | | 0x07); |
3527 | rb->mas_codec_writereg(8, 0); | 3532 | rb->mas_codec_writereg(8, 0); |
3528 | break; | 3533 | break; |
3529 | 3534 | ||
3530 | case REC_SRC_MIC: | 3535 | case WAV_SRC_MIC: |
3531 | rb->mas_codec_writereg(0, (rb->global_settings->rec_mic_gain << 4) | 3536 | rb->mas_codec_writereg(0, (rb->global_settings->rec_mic_gain << 4) |
3532 | | 0x0d); | 3537 | | 0x0d); |
3533 | rb->mas_codec_writereg(8, 0x8000); /* Copy left channel to right */ | 3538 | rb->mas_codec_writereg(8, 0x8000); /* Copy left channel to right */ |
3534 | break; | 3539 | break; |
3535 | 3540 | ||
3536 | #ifdef HAVE_SPDIF_REC | 3541 | #ifdef HAVE_SPDIF_REC |
3537 | case REC_SRC_SPDIF: | 3542 | case WAV_SRC_SPDIF: |
3538 | rb->mas_codec_writereg(0, 0x01); | 3543 | rb->mas_codec_writereg(0, 0x01); |
3539 | rb->snprintf(buf, sizeof(buf), "16bit %s", | 3544 | rb->snprintf(buf, sizeof(buf), "16bit %s", |
3540 | channel_str[reccfg.channels]); | 3545 | channel_str[reccfg.channels]); |
@@ -3698,11 +3703,11 @@ static int recording_menu(void) | |||
3698 | { "Mono", -1 }, | 3703 | { "Mono", -1 }, |
3699 | { "Stereo", -1 }, | 3704 | { "Stereo", -1 }, |
3700 | }; | 3705 | }; |
3701 | static const struct opt_items srcs[REC_NUM_SOURCES] = { | 3706 | static const struct opt_items srcs[WAV_NUM_SRC] = { |
3702 | [REC_SRC_LINEIN] = { "Line In", -1 }, | 3707 | { "Line In", -1 }, |
3703 | [REC_SRC_MIC] = { "Microphone", -1 }, | 3708 | { "Microphone", -1 }, |
3704 | #ifdef HAVE_SPDIF_REC | 3709 | #ifdef HAVE_SPDIF_REC |
3705 | [REC_SRC_SPDIF] = { "S/PDIF", -1 }, | 3710 | { "S/PDIF", -1 }, |
3706 | #endif | 3711 | #endif |
3707 | }; | 3712 | }; |
3708 | 3713 | ||
@@ -3722,7 +3727,7 @@ static int recording_menu(void) | |||
3722 | break; | 3727 | break; |
3723 | 3728 | ||
3724 | case 2: /* Set source */ | 3729 | case 2: /* Set source */ |
3725 | rb->set_option("Source", &reccfg.source, INT, srcs, REC_NUM_SOURCES, NULL); | 3730 | rb->set_option("Source", &reccfg.source, INT, srcs, WAV_NUM_SRC, NULL); |
3726 | break; | 3731 | break; |
3727 | 3732 | ||
3728 | case 3: /* Start recording */ | 3733 | case 3: /* Start recording */ |