diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/radio.c | 8 | ||||
-rw-r--r-- | apps/recorder/recording.c | 107 | ||||
-rw-r--r-- | apps/recorder/recording.h | 4 |
3 files changed, 21 insertions, 98 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 9f3228be1f..23e820e835 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -509,9 +509,9 @@ int radio_screen(void) | |||
509 | 509 | ||
510 | /* turn on radio */ | 510 | /* turn on radio */ |
511 | #if CONFIG_CODEC == SWCODEC | 511 | #if CONFIG_CODEC == SWCODEC |
512 | rec_set_source(AUDIO_SRC_FMRADIO, | 512 | audio_set_input_source(AUDIO_SRC_FMRADIO, |
513 | (radio_status == FMRADIO_PAUSED) ? | 513 | (radio_status == FMRADIO_PAUSED) ? |
514 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); | 514 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); |
515 | #else | 515 | #else |
516 | if (radio_status == FMRADIO_OFF) | 516 | if (radio_status == FMRADIO_OFF) |
517 | radio_start(); | 517 | radio_start(); |
@@ -985,7 +985,7 @@ int radio_screen(void) | |||
985 | else | 985 | else |
986 | { | 986 | { |
987 | #if CONFIG_CODEC == SWCODEC | 987 | #if CONFIG_CODEC == SWCODEC |
988 | rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); | 988 | audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); |
989 | #else | 989 | #else |
990 | radio_stop(); | 990 | radio_stop(); |
991 | #endif | 991 | #endif |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 5738a34949..226ff9a17f 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -547,80 +547,6 @@ int rec_create_directory(void) | |||
547 | return 0; | 547 | return 0; |
548 | } | 548 | } |
549 | 549 | ||
550 | #if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) | ||
551 | |||
552 | # ifdef HAVE_SPDIF_REC | ||
553 | # ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
554 | static void rec_boost(bool state) | ||
555 | { | ||
556 | static bool cpu_boosted = false; | ||
557 | |||
558 | if (state != cpu_boosted) | ||
559 | { | ||
560 | cpu_boost(state); | ||
561 | cpu_boosted = state; | ||
562 | } | ||
563 | } | ||
564 | # endif | ||
565 | # endif | ||
566 | |||
567 | /** | ||
568 | * Selects an audio source for recording or playback | ||
569 | * powers/unpowers related devices and sets up monitoring. | ||
570 | * Here because it calls app code and used only for HAVE_RECORDING atm. | ||
571 | * Would like it in pcm_record.c. | ||
572 | * | ||
573 | * Behaves like a firmware function in that it does not use global settings | ||
574 | * to determine the state. | ||
575 | * | ||
576 | * The order of setting monitoring may need tweaking dependent upon the | ||
577 | * selected source to get the smoothest transition. | ||
578 | */ | ||
579 | void rec_set_source(int source, unsigned flags) | ||
580 | { | ||
581 | /** Do power up/down of associated device(s) **/ | ||
582 | |||
583 | /** SPDIF **/ | ||
584 | #ifdef HAVE_SPDIF_REC | ||
585 | /* Always boost for SPDIF */ | ||
586 | rec_boost(source == AUDIO_SRC_SPDIF); | ||
587 | #endif /* HAVE_SPDIF_IN */ | ||
588 | |||
589 | #ifdef HAVE_SPDIF_POWER | ||
590 | /* Check if S/PDIF output power should be switched off or on. NOTE: assumes | ||
591 | both optical in and out is controlled by the same power source, which is | ||
592 | the case on H1x0. */ | ||
593 | spdif_power_enable((source == AUDIO_SRC_SPDIF) || | ||
594 | global_settings.spdif_enable); | ||
595 | /* Set the appropriate feed for spdif output */ | ||
596 | #ifdef HAVE_SPDIF_OUT | ||
597 | spdif_set_output_source(source, global_settings.spdif_enable); | ||
598 | #endif | ||
599 | #else /* !HAVE_SPDIF_POWER */ | ||
600 | #ifdef HAVE_SPDIF_OUT | ||
601 | spdif_set_output_source(source, true); | ||
602 | #endif | ||
603 | #endif /* !HAVE_SPDIF_POWER */ | ||
604 | |||
605 | /** Tuner **/ | ||
606 | #if CONFIG_TUNER | ||
607 | /* Switch radio off or on per source and flags. */ | ||
608 | if (source != AUDIO_SRC_FMRADIO) | ||
609 | radio_stop(); | ||
610 | else if (flags & SRCF_FMRADIO_PAUSED) | ||
611 | radio_pause(); | ||
612 | else | ||
613 | radio_start(); | ||
614 | #endif | ||
615 | |||
616 | /* set hardware inputs */ | ||
617 | audio_set_source(source, flags); | ||
618 | |||
619 | peak_meter_playback((flags & SRCF_RECORDING) == 0); | ||
620 | peak_meter_enabled = true; | ||
621 | } /* rec_set_source */ | ||
622 | #endif /* CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) */ | ||
623 | |||
624 | void rec_init_recording_options(struct audio_recording_options *options) | 550 | void rec_init_recording_options(struct audio_recording_options *options) |
625 | { | 551 | { |
626 | options->rec_source = global_settings.rec_source; | 552 | options->rec_source = global_settings.rec_source; |
@@ -637,6 +563,18 @@ void rec_init_recording_options(struct audio_recording_options *options) | |||
637 | #endif | 563 | #endif |
638 | } | 564 | } |
639 | 565 | ||
566 | #if CONFIG_CODEC == SWCODEC && !defined (SIMULATOR) | ||
567 | void rec_set_source(int source, unsigned flags) | ||
568 | { | ||
569 | /* Set audio input source, power up/down devices */ | ||
570 | audio_set_input_source(source, flags); | ||
571 | |||
572 | /* Set peakmeters for recording or reset to playback */ | ||
573 | peak_meter_playback((flags & SRCF_RECORDING) == 0); | ||
574 | peak_meter_enabled = true; | ||
575 | } | ||
576 | #endif /* CONFIG_CODEC == SWCODEC && !defined (SIMULATOR) */ | ||
577 | |||
640 | void rec_set_recording_options(struct audio_recording_options *options) | 578 | void rec_set_recording_options(struct audio_recording_options *options) |
641 | { | 579 | { |
642 | #if CONFIG_CODEC != SWCODEC | 580 | #if CONFIG_CODEC != SWCODEC |
@@ -2062,20 +2000,6 @@ void rec_set_source(int source, unsigned flags) | |||
2062 | flags = flags; | 2000 | flags = flags; |
2063 | } | 2001 | } |
2064 | 2002 | ||
2065 | #ifdef HAVE_SPDIF_IN | ||
2066 | #ifdef HAVE_SPDIF_POWER | ||
2067 | void audio_set_spdif_power_setting(bool on) | ||
2068 | { | ||
2069 | on = on; | ||
2070 | } | ||
2071 | |||
2072 | bool audio_get_spdif_power_setting(void) | ||
2073 | { | ||
2074 | return true; | ||
2075 | } | ||
2076 | #endif /* HAVE_SPDIF_POWER */ | ||
2077 | #endif /* HAVE_SPDIF_IN */ | ||
2078 | |||
2079 | void audio_set_recording_options(struct audio_recording_options *options) | 2003 | void audio_set_recording_options(struct audio_recording_options *options) |
2080 | { | 2004 | { |
2081 | options = options; | 2005 | options = options; |
@@ -2088,13 +2012,12 @@ void audio_set_recording_gain(int left, int right, int type) | |||
2088 | type = type; | 2012 | type = type; |
2089 | } | 2013 | } |
2090 | 2014 | ||
2091 | void audio_set_output_source(int source) | 2015 | void audio_record(const char *filename) |
2092 | { | 2016 | { |
2093 | source = source; | 2017 | filename = filename; |
2094 | } | 2018 | } |
2095 | 2019 | ||
2096 | 2020 | void audio_new_file(const char *filename) | |
2097 | void audio_record(const char *filename) | ||
2098 | { | 2021 | { |
2099 | filename = filename; | 2022 | filename = filename; |
2100 | } | 2023 | } |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 3ca1f35834..50a73856cf 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -29,7 +29,7 @@ int rec_create_directory(void); | |||
29 | extern bool recording_start_automatic; | 29 | extern bool recording_start_automatic; |
30 | 30 | ||
31 | #if CONFIG_CODEC == SWCODEC | 31 | #if CONFIG_CODEC == SWCODEC |
32 | /* handles device powerup and sets audio source */ | 32 | /* handles device powerup, sets audio source and peakmeter mode */ |
33 | void rec_set_source(int source, unsigned flags); | 33 | void rec_set_source(int source, unsigned flags); |
34 | #endif /* CONFIG_CODEC == SW_CODEC */ | 34 | #endif /* CONFIG_CODEC == SW_CODEC */ |
35 | 35 | ||
@@ -47,4 +47,4 @@ void rec_record(void); | |||
47 | /* creates unique filename and starts recording */ | 47 | /* creates unique filename and starts recording */ |
48 | void rec_new_file(void); | 48 | void rec_new_file(void); |
49 | 49 | ||
50 | #endif | 50 | #endif /* RECORDING_H */ |