summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c89
1 files changed, 39 insertions, 50 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 0981cb8811..0323ae12ff 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -183,7 +183,7 @@ static void set_gain(void)
183 } 183 }
184 else 184 else
185 { 185 {
186 /* AUDIO_SRC_LINEIN, AUDIO_SRC_SPDIF, AUDIO_SRC_FMRADIO */ 186 /* AUDIO_SRC_LINEIN, AUDIO_SRC_FMRADIO, AUDIO_SRC_SPDIF */
187 audio_set_recording_gain(global_settings.rec_left_gain, 187 audio_set_recording_gain(global_settings.rec_left_gain,
188 global_settings.rec_right_gain, 188 global_settings.rec_right_gain,
189 AUDIO_GAIN_LINEIN); 189 AUDIO_GAIN_LINEIN);
@@ -235,13 +235,12 @@ static bool agc_gain_is_max(bool left, bool right)
235 235
236 switch (global_settings.rec_source) 236 switch (global_settings.rec_source)
237 { 237 {
238 case AUDIO_SRC_LINEIN: 238 HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
239#ifdef HAVE_FMRADIO_IN 239 HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
240 case AUDIO_SRC_FMRADIO:
241#endif
242 gain_current_l = global_settings.rec_left_gain; 240 gain_current_l = global_settings.rec_left_gain;
243 gain_current_r = global_settings.rec_right_gain; 241 gain_current_r = global_settings.rec_right_gain;
244 break; 242 break;
243 case AUDIO_SRC_MIC:
245 default: 244 default:
246 gain_current_l = global_settings.rec_mic_gain; 245 gain_current_l = global_settings.rec_mic_gain;
247 gain_current_r = global_settings.rec_mic_gain; 246 gain_current_r = global_settings.rec_mic_gain;
@@ -257,14 +256,12 @@ static void change_recording_gain(bool increment, bool left, bool right)
257 256
258 switch (global_settings.rec_source) 257 switch (global_settings.rec_source)
259 { 258 {
260 case AUDIO_SRC_LINEIN: 259 HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
261#ifdef HAVE_FMRADIO_IN 260 HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
262 case AUDIO_SRC_FMRADIO: 261 if (left) global_settings.rec_left_gain += factor;
263#endif
264 if(left) global_settings.rec_left_gain += factor;
265 if (right) global_settings.rec_right_gain += factor; 262 if (right) global_settings.rec_right_gain += factor;
266 break; 263 break;
267 default: 264 case AUDIO_SRC_MIC:
268 global_settings.rec_mic_gain += factor; 265 global_settings.rec_mic_gain += factor;
269 } 266 }
270} 267}
@@ -469,31 +466,27 @@ static void adjust_cursor(void)
469#ifdef HAVE_AGC 466#ifdef HAVE_AGC
470 switch(global_settings.rec_source) 467 switch(global_settings.rec_source)
471 { 468 {
472 case AUDIO_SRC_MIC: 469 case REC_SRC_MIC:
473 if(cursor == 2) 470 if(cursor == 2)
474 cursor = 4; 471 cursor = 4;
475 else if(cursor == 3) 472 else if(cursor == 3)
476 cursor = 1; 473 cursor = 1;
477 case AUDIO_SRC_LINEIN: 474 HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
478#ifdef HAVE_FMRADIO_IN 475 HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
479 case AUDIO_SRC_FMRADIO:
480#endif
481 max_cursor = 5; 476 max_cursor = 5;
482 break; 477 break;
483 default: 478 default:
484 max_cursor = 0; 479 max_cursor = 0;
485 break; 480 break;
486 } 481 }
487#else 482#else /* !HAVE_AGC */
488 switch(global_settings.rec_source) 483 switch(global_settings.rec_source)
489 { 484 {
490 case AUDIO_SRC_MIC: 485 case AUDIO_SRC_MIC:
491 max_cursor = 1; 486 max_cursor = 1;
492 break; 487 break;
493 case AUDIO_SRC_LINEIN: 488 HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
494#ifdef HAVE_FMRADIO_IN 489 HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
495 case AUDIO_SRC_FMRADIO:
496#endif
497 max_cursor = 3; 490 max_cursor = 3;
498 break; 491 break;
499 default: 492 default:
@@ -556,7 +549,7 @@ int rec_create_directory(void)
556 549
557#if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) 550#if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR)
558 551
559# ifdef HAVE_SPDIF_IN 552# ifdef HAVE_SPDIF_REC
560# ifdef HAVE_ADJUSTABLE_CPU_FREQ 553# ifdef HAVE_ADJUSTABLE_CPU_FREQ
561static void rec_boost(bool state) 554static void rec_boost(bool state)
562{ 555{
@@ -588,7 +581,7 @@ void rec_set_source(int source, unsigned flags)
588 /** Do power up/down of associated device(s) **/ 581 /** Do power up/down of associated device(s) **/
589 582
590 /** SPDIF **/ 583 /** SPDIF **/
591#ifdef HAVE_SPDIF_IN 584#ifdef HAVE_SPDIF_REC
592 /* Always boost for SPDIF */ 585 /* Always boost for SPDIF */
593 rec_boost(source == AUDIO_SRC_SPDIF); 586 rec_boost(source == AUDIO_SRC_SPDIF);
594#endif /* HAVE_SPDIF_IN */ 587#endif /* HAVE_SPDIF_IN */
@@ -766,7 +759,7 @@ bool recording_screen(bool no_source)
766 int warning_counter = 0; 759 int warning_counter = 0;
767 #define WARNING_PERIOD 7 760 #define WARNING_PERIOD 7
768#endif 761#endif
769#ifdef HAVE_FMRADIO_IN 762#ifdef HAVE_FMRADIO_REC
770 /* Radio is left on if: 763 /* Radio is left on if:
771 * 1) Is was on at the start and the initial source is FM Radio 764 * 1) Is was on at the start and the initial source is FM Radio
772 * 2) 1) and the source was never changed to something else 765 * 2) 1) and the source was never changed to something else
@@ -849,7 +842,7 @@ bool recording_screen(bool no_source)
849 agc_preset = global_settings.rec_agc_preset_line; 842 agc_preset = global_settings.rec_agc_preset_line;
850 agc_maxgain = global_settings.rec_agc_maxgain_line; 843 agc_maxgain = global_settings.rec_agc_maxgain_line;
851 } 844 }
852#endif 845#endif /* HAVE_AGC */
853 846
854 FOR_NB_SCREENS(i) 847 FOR_NB_SCREENS(i)
855 { 848 {
@@ -1117,7 +1110,7 @@ bool recording_screen(bool no_source)
1117 global_settings.rec_agc_maxgain_line = agc_maxgain; 1110 global_settings.rec_agc_maxgain_line = agc_maxgain;
1118 } 1111 }
1119 break; 1112 break;
1120#endif 1113#endif /* HAVE_AGC */
1121 } 1114 }
1122 set_gain(); 1115 set_gain();
1123 update_countdown = 1; /* Update immediately */ 1116 update_countdown = 1; /* Update immediately */
@@ -1185,7 +1178,7 @@ bool recording_screen(bool no_source)
1185 global_settings.rec_agc_maxgain_line = agc_maxgain; 1178 global_settings.rec_agc_maxgain_line = agc_maxgain;
1186 } 1179 }
1187 break; 1180 break;
1188#endif 1181#endif /* HAVE_AGC */
1189 } 1182 }
1190 set_gain(); 1183 set_gain();
1191 update_countdown = 1; /* Update immediately */ 1184 update_countdown = 1; /* Update immediately */
@@ -1194,7 +1187,7 @@ bool recording_screen(bool no_source)
1194 case ACTION_STD_MENU: 1187 case ACTION_STD_MENU:
1195 if(audio_stat != AUDIO_STATUS_RECORD) 1188 if(audio_stat != AUDIO_STATUS_RECORD)
1196 { 1189 {
1197#ifdef HAVE_FMRADIO_IN 1190#ifdef HAVE_FMRADIO_REC
1198 const int prev_rec_source = global_settings.rec_source; 1191 const int prev_rec_source = global_settings.rec_source;
1199#endif 1192#endif
1200 1193
@@ -1206,13 +1199,13 @@ bool recording_screen(bool no_source)
1206 { 1199 {
1207 done = true; 1200 done = true;
1208 been_in_usb_mode = true; 1201 been_in_usb_mode = true;
1209#ifdef HAVE_FMRADIO_IN 1202#ifdef HAVE_FMRADIO_REC
1210 radio_status = FMRADIO_OFF; 1203 radio_status = FMRADIO_OFF;
1211#endif 1204#endif
1212 } 1205 }
1213 else 1206 else
1214 { 1207 {
1215#ifdef HAVE_FMRADIO_IN 1208#ifdef HAVE_FMRADIO_REC
1216 /* If input changes away from FM Radio, radio will 1209 /* If input changes away from FM Radio, radio will
1217 remain off when recording screen closes. */ 1210 remain off when recording screen closes. */
1218 if (global_settings.rec_source != prev_rec_source 1211 if (global_settings.rec_source != prev_rec_source
@@ -1306,7 +1299,7 @@ bool recording_screen(bool no_source)
1306 default_event_handler(SYS_USB_CONNECTED); 1299 default_event_handler(SYS_USB_CONNECTED);
1307 done = true; 1300 done = true;
1308 been_in_usb_mode = true; 1301 been_in_usb_mode = true;
1309#ifdef HAVE_FMRADIO_IN 1302#ifdef HAVE_FMRADIO_REC
1310 radio_status = FMRADIO_OFF; 1303 radio_status = FMRADIO_OFF;
1311#endif 1304#endif
1312 } 1305 }
@@ -1493,11 +1486,10 @@ bool recording_screen(bool no_source)
1493 PM_HEIGHT + 3, buf); 1486 PM_HEIGHT + 3, buf);
1494 } 1487 }
1495 } 1488 }
1496 else if(global_settings.rec_source == AUDIO_SRC_LINEIN 1489 else if(0
1497#ifdef HAVE_FMRADIO_IN 1490 HAVE_LINE_REC_( || global_settings.rec_source == AUDIO_SRC_LINEIN)
1498 || global_settings.rec_source == AUDIO_SRC_FMRADIO 1491 HAVE_FMRADIO_REC_( || global_settings.rec_source == AUDIO_SRC_FMRADIO)
1499#endif 1492 )
1500 )
1501 { 1493 {
1502 /* Draw LINE or FMRADIO recording gain */ 1494 /* Draw LINE or FMRADIO recording gain */
1503 snprintf(buf, sizeof(buf), "%s:%s", 1495 snprintf(buf, sizeof(buf), "%s:%s",
@@ -1541,16 +1533,14 @@ bool recording_screen(bool no_source)
1541 { 1533 {
1542 switch (global_settings.rec_source) 1534 switch (global_settings.rec_source)
1543 { 1535 {
1544 case AUDIO_SRC_LINEIN: 1536 HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
1545#ifdef HAVE_FMRADIO_IN 1537 HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
1546 case AUDIO_SRC_FMRADIO:
1547#endif
1548 line[i] = 5; 1538 line[i] = 5;
1549 break; 1539 break;
1550 case AUDIO_SRC_MIC: 1540 case AUDIO_SRC_MIC:
1551 line[i] = 4; 1541 line[i] = 4;
1552 break; 1542 break;
1553#ifdef HAVE_SPDIF_IN 1543#ifdef HAVE_SPDIF_REC
1554 case AUDIO_SRC_SPDIF: 1544 case AUDIO_SRC_SPDIF:
1555 line[i] = 3; 1545 line[i] = 3;
1556 break; 1546 break;
@@ -1615,12 +1605,11 @@ bool recording_screen(bool no_source)
1615 screens[i].puts_style_offset(0, filename_offset[i] + 1605 screens[i].puts_style_offset(0, filename_offset[i] +
1616 PM_HEIGHT + line[i], buf, STYLE_INVERT,0); 1606 PM_HEIGHT + line[i], buf, STYLE_INVERT,0);
1617 } 1607 }
1618 else if (global_settings.rec_source == AUDIO_SRC_MIC 1608 else if (
1619 || global_settings.rec_source == AUDIO_SRC_LINEIN 1609 global_settings.rec_source == AUDIO_SRC_MIC
1620#ifdef HAVE_FMRADIO_IN 1610 HAVE_LINE_REC_(|| global_settings.rec_source == AUDIO_SRC_LINEIN)
1621 || global_settings.rec_source == AUDIO_SRC_FMRADIO 1611 HAVE_FMRADIO_REC_(|| global_settings.rec_source == AUDIO_SRC_FMRADIO)
1622#endif 1612 )
1623 )
1624 { 1613 {
1625 for(i = 0; i < screen_update; i++) { 1614 for(i = 0; i < screen_update; i++) {
1626 if (display_agc[i]) { 1615 if (display_agc[i]) {
@@ -1629,7 +1618,7 @@ bool recording_screen(bool no_source)
1629 } 1618 }
1630 } 1619 }
1631 } 1620 }
1632 1621
1633 if (global_settings.rec_source == AUDIO_SRC_MIC) 1622 if (global_settings.rec_source == AUDIO_SRC_MIC)
1634 { 1623 {
1635 if(agc_maxgain < (global_settings.rec_mic_gain)) 1624 if(agc_maxgain < (global_settings.rec_mic_gain))
@@ -1642,7 +1631,7 @@ bool recording_screen(bool no_source)
1642 if(agc_maxgain < (global_settings.rec_right_gain)) 1631 if(agc_maxgain < (global_settings.rec_right_gain))
1643 change_recording_gain(false, false, true); 1632 change_recording_gain(false, false, true);
1644 } 1633 }
1645#else 1634#else /* !HAVE_AGC */
1646 } 1635 }
1647#endif /* HAVE_AGC */ 1636#endif /* HAVE_AGC */
1648 1637
@@ -1758,7 +1747,7 @@ bool recording_screen(bool no_source)
1758 audio_stop_recording(); 1747 audio_stop_recording();
1759 audio_close_recording(); 1748 audio_close_recording();
1760 1749
1761#ifdef HAVE_FMRADIO_IN 1750#ifdef HAVE_FMRADIO_REC
1762 if (radio_status != FMRADIO_OFF) 1751 if (radio_status != FMRADIO_OFF)
1763 /* Restore radio playback - radio_status should be unchanged if started 1752 /* Restore radio playback - radio_status should be unchanged if started
1764 through fm radio screen (barring usb connect) */ 1753 through fm radio screen (barring usb connect) */