diff options
author | Andy <andy@rockbox.org> | 2005-11-12 04:00:56 +0000 |
---|---|---|
committer | Andy <andy@rockbox.org> | 2005-11-12 04:00:56 +0000 |
commit | e6e5496535a6fa45ee5cb63fb80886514ae72231 (patch) | |
tree | ebd73be009933c4c7eaf224ccec308aa56dd7b99 /firmware/mpeg.c | |
parent | 663fba13996c32e13d4cca89ffda86de8d536c7f (diff) | |
download | rockbox-e6e5496535a6fa45ee5cb63fb80886514ae72231.tar.gz rockbox-e6e5496535a6fa45ee5cb63fb80886514ae72231.zip |
iRiver: Initial support for wav-recording in recording menu. Supports mic/line-in (and radio), monitor mode, time-splitting (and byte-splitting), pause/resume etc. Things todo: Prerecording, peakmeter (should be simple), frequency other than 44.1 kHz, etc..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7818 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r-- | firmware/mpeg.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 022a321602..caeb3b96b6 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -2115,7 +2115,7 @@ void audio_init_playback(void) | |||
2115 | /**************************************************************************** | 2115 | /**************************************************************************** |
2116 | * Recording functions | 2116 | * Recording functions |
2117 | ***************************************************************************/ | 2117 | ***************************************************************************/ |
2118 | void mpeg_init_recording(void) | 2118 | void audio_init_recording(void) |
2119 | { | 2119 | { |
2120 | init_recording_done = false; | 2120 | init_recording_done = false; |
2121 | queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL); | 2121 | queue_post(&mpeg_queue, MPEG_INIT_RECORDING, NULL); |
@@ -2224,7 +2224,7 @@ static void init_recording(void) | |||
2224 | call mpeg_set_recording_options(). */ | 2224 | call mpeg_set_recording_options(). */ |
2225 | } | 2225 | } |
2226 | 2226 | ||
2227 | void mpeg_record(const char *filename) | 2227 | void audio_record(const char *filename) |
2228 | { | 2228 | { |
2229 | mpeg_errno = 0; | 2229 | mpeg_errno = 0; |
2230 | 2230 | ||
@@ -2234,12 +2234,12 @@ void mpeg_record(const char *filename) | |||
2234 | queue_post(&mpeg_queue, MPEG_RECORD, NULL); | 2234 | queue_post(&mpeg_queue, MPEG_RECORD, NULL); |
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | void mpeg_pause_recording(void) | 2237 | void audio_pause_recording(void) |
2238 | { | 2238 | { |
2239 | queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL); | 2239 | queue_post(&mpeg_queue, MPEG_PAUSE_RECORDING, NULL); |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | void mpeg_resume_recording(void) | 2242 | void audio_resume_recording(void) |
2243 | { | 2243 | { |
2244 | queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL); | 2244 | queue_post(&mpeg_queue, MPEG_RESUME_RECORDING, NULL); |
2245 | } | 2245 | } |
@@ -2435,9 +2435,10 @@ static void stop_recording(void) | |||
2435 | resume_recording(); | 2435 | resume_recording(); |
2436 | } | 2436 | } |
2437 | 2437 | ||
2438 | void mpeg_set_recording_options(int frequency, int quality, | 2438 | void audio_set_recording_options(int frequency, int quality, |
2439 | int source, int channel_mode, | 2439 | int source, int channel_mode, |
2440 | bool editable, int prerecord_time) | 2440 | bool editable, int prerecord_time, |
2441 | bool monitor) | ||
2441 | { | 2442 | { |
2442 | bool is_mpeg1; | 2443 | bool is_mpeg1; |
2443 | 2444 | ||
@@ -2461,7 +2462,7 @@ void mpeg_set_recording_options(int frequency, int quality, | |||
2461 | 2462 | ||
2462 | DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute); | 2463 | DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute); |
2463 | 2464 | ||
2464 | shadow_io_control_main = ((1 << 10) | /* Monitoring ON */ | 2465 | shadow_io_control_main = ((monitor?(1 << 10):0) | /* Monitoring ON */ |
2465 | ((source < 2)?1:2) << 8) | /* Input select */ | 2466 | ((source < 2)?1:2) << 8) | /* Input select */ |
2466 | (1 << 5) | /* SDO strobe invert */ | 2467 | (1 << 5) | /* SDO strobe invert */ |
2467 | ((is_mpeg1?0:1) << 3) | | 2468 | ((is_mpeg1?0:1) << 3) | |
@@ -2497,13 +2498,13 @@ void mpeg_set_recording_options(int frequency, int quality, | |||
2497 | } | 2498 | } |
2498 | 2499 | ||
2499 | /* If use_mic is true, the left gain is used */ | 2500 | /* If use_mic is true, the left gain is used */ |
2500 | void mpeg_set_recording_gain(int left, int right, bool use_mic) | 2501 | void audio_set_recording_gain(int left, int right, int type) |
2501 | { | 2502 | { |
2502 | /* Enable both left and right A/D */ | 2503 | /* Enable both left and right A/D */ |
2503 | shadow_codec_reg0 = (left << 12) | | 2504 | shadow_codec_reg0 = (left << 12) | |
2504 | (right << 8) | | 2505 | (right << 8) | |
2505 | (left << 4) | | 2506 | (left << 4) | |
2506 | (use_mic?0x0008:0) | /* Connect left A/D to mic */ | 2507 | (type==AUDIO_GAIN_MIC?0x0008:0) | /* Connect left A/D to mic */ |
2507 | 0x0007; | 2508 | 0x0007; |
2508 | mas_codec_writereg(0x0, shadow_codec_reg0); | 2509 | mas_codec_writereg(0x0, shadow_codec_reg0); |
2509 | } | 2510 | } |
@@ -2539,7 +2540,7 @@ void audio_beep(int duration) | |||
2539 | while (current_tick - starttick < duration); | 2540 | while (current_tick - starttick < duration); |
2540 | } | 2541 | } |
2541 | 2542 | ||
2542 | void mpeg_new_file(const char *filename) | 2543 | void audio_new_file(const char *filename) |
2543 | { | 2544 | { |
2544 | mpeg_errno = 0; | 2545 | mpeg_errno = 0; |
2545 | 2546 | ||
@@ -2549,7 +2550,7 @@ void mpeg_new_file(const char *filename) | |||
2549 | queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL); | 2550 | queue_post(&mpeg_queue, MPEG_NEW_FILE, NULL); |
2550 | } | 2551 | } |
2551 | 2552 | ||
2552 | unsigned long mpeg_recorded_time(void) | 2553 | unsigned long audio_recorded_time(void) |
2553 | { | 2554 | { |
2554 | if(is_prerecording) | 2555 | if(is_prerecording) |
2555 | return prerecord_count * HZ; | 2556 | return prerecord_count * HZ; |
@@ -2565,7 +2566,7 @@ unsigned long mpeg_recorded_time(void) | |||
2565 | return 0; | 2566 | return 0; |
2566 | } | 2567 | } |
2567 | 2568 | ||
2568 | unsigned long mpeg_num_recorded_bytes(void) | 2569 | unsigned long audio_num_recorded_bytes(void) |
2569 | { | 2570 | { |
2570 | int num_bytes; | 2571 | int num_bytes; |
2571 | int index; | 2572 | int index; |
@@ -2599,7 +2600,7 @@ void audio_init_playback(void) | |||
2599 | { | 2600 | { |
2600 | /* a dummy */ | 2601 | /* a dummy */ |
2601 | } | 2602 | } |
2602 | unsigned long mpeg_recorded_time(void) | 2603 | unsigned long audio_recorded_time(void) |
2603 | { | 2604 | { |
2604 | /* a dummy */ | 2605 | /* a dummy */ |
2605 | return 0; | 2606 | return 0; |
@@ -2609,42 +2610,42 @@ void audio_beep(int duration) | |||
2609 | /* a dummy */ | 2610 | /* a dummy */ |
2610 | (void)duration; | 2611 | (void)duration; |
2611 | } | 2612 | } |
2612 | void mpeg_pause_recording(void) | 2613 | void audio_pause_recording(void) |
2613 | { | 2614 | { |
2614 | /* a dummy */ | 2615 | /* a dummy */ |
2615 | } | 2616 | } |
2616 | void mpeg_resume_recording(void) | 2617 | void audio_resume_recording(void) |
2617 | { | 2618 | { |
2618 | /* a dummy */ | 2619 | /* a dummy */ |
2619 | } | 2620 | } |
2620 | unsigned long mpeg_num_recorded_bytes(void) | 2621 | unsigned long audio_num_recorded_bytes(void) |
2621 | { | 2622 | { |
2622 | /* a dummy */ | 2623 | /* a dummy */ |
2623 | return 0; | 2624 | return 0; |
2624 | } | 2625 | } |
2625 | void mpeg_record(const char *filename) | 2626 | void audio_record(const char *filename) |
2626 | { | 2627 | { |
2627 | /* a dummy */ | 2628 | /* a dummy */ |
2628 | (void)filename; | 2629 | (void)filename; |
2629 | } | 2630 | } |
2630 | void mpeg_new_file(const char *filename) | 2631 | void audio_new_file(const char *filename) |
2631 | { | 2632 | { |
2632 | /* a dummy */ | 2633 | /* a dummy */ |
2633 | (void)filename; | 2634 | (void)filename; |
2634 | } | 2635 | } |
2635 | 2636 | ||
2636 | void mpeg_set_recording_gain(int left, int right, bool use_mic) | 2637 | void audio_set_recording_gain(int left, int right, int type) |
2637 | { | 2638 | { |
2638 | /* a dummy */ | 2639 | /* a dummy */ |
2639 | (void)left; | 2640 | (void)left; |
2640 | (void)right; | 2641 | (void)right; |
2641 | (void)use_mic; | 2642 | (void)type; |
2642 | } | 2643 | } |
2643 | void mpeg_init_recording(void) | 2644 | void audio_init_recording(void) |
2644 | { | 2645 | { |
2645 | /* a dummy */ | 2646 | /* a dummy */ |
2646 | } | 2647 | } |
2647 | void mpeg_set_recording_options(int frequency, int quality, | 2648 | void audio_set_recording_options(int frequency, int quality, |
2648 | int source, int channel_mode, | 2649 | int source, int channel_mode, |
2649 | bool editable, int prerecord_time) | 2650 | bool editable, int prerecord_time) |
2650 | { | 2651 | { |
@@ -2710,6 +2711,12 @@ void audio_stop(void) | |||
2710 | #endif /* SIMULATOR */ | 2711 | #endif /* SIMULATOR */ |
2711 | } | 2712 | } |
2712 | 2713 | ||
2714 | /* dummy */ | ||
2715 | void audio_stop_recording(void) | ||
2716 | { | ||
2717 | audio_stop(); | ||
2718 | } | ||
2719 | |||
2713 | void audio_pause(void) | 2720 | void audio_pause(void) |
2714 | { | 2721 | { |
2715 | #ifndef SIMULATOR | 2722 | #ifndef SIMULATOR |