diff options
author | Martin Scarratt <mmmm@rockbox.org> | 2006-11-09 12:27:56 +0000 |
---|---|---|
committer | Martin Scarratt <mmmm@rockbox.org> | 2006-11-09 12:27:56 +0000 |
commit | d8103f3ba691adaeb83f8844e32b827c2c564d24 (patch) | |
tree | 06144354862a2ca70287b4a70738a30a53381684 /apps/recorder/recording.c | |
parent | ad70a9b2e602f41d7608d3c3ca58fc897c8c39b8 (diff) | |
download | rockbox-d8103f3ba691adaeb83f8844e32b827c2c564d24.tar.gz rockbox-d8103f3ba691adaeb83f8844e32b827c2c564d24.zip |
Recording trigger for software codec targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11479 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r-- | apps/recorder/recording.c | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 6a053cd12e..d38856db23 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -801,9 +801,16 @@ static void trigger_listener(int trigger_status) | |||
801 | /* if we're already recording this is a retrigger */ | 801 | /* if we're already recording this is a retrigger */ |
802 | else | 802 | else |
803 | { | 803 | { |
804 | rec_new_file(); | 804 | if((audio_status() & AUDIO_STATUS_PAUSE) && |
805 | /* tell recording_screen to reset the time */ | 805 | (global_settings.rec_trigger_type == 1)) |
806 | last_seconds = 0; | 806 | audio_resume_recording(); |
807 | /* New file on trig start*/ | ||
808 | else if (global_settings.rec_trigger_type != 2) | ||
809 | { | ||
810 | rec_new_file(); | ||
811 | /* tell recording_screen to reset the time */ | ||
812 | last_seconds = 0; | ||
813 | } | ||
807 | } | 814 | } |
808 | break; | 815 | break; |
809 | 816 | ||
@@ -811,7 +818,27 @@ static void trigger_listener(int trigger_status) | |||
811 | case TRIG_READY: | 818 | case TRIG_READY: |
812 | if(audio_status() & AUDIO_STATUS_RECORD) | 819 | if(audio_status() & AUDIO_STATUS_RECORD) |
813 | { | 820 | { |
814 | audio_stop(); | 821 | switch(global_settings.rec_trigger_type) |
822 | { | ||
823 | case 0: /* Stop */ | ||
824 | #if CONFIG_CODEC == SWCODEC | ||
825 | audio_stop_recording(); | ||
826 | #else | ||
827 | audio_stop(); | ||
828 | #endif | ||
829 | break; | ||
830 | |||
831 | case 1: /* Pause */ | ||
832 | audio_pause_recording(); | ||
833 | break; | ||
834 | |||
835 | case 2: /* New file on trig stop*/ | ||
836 | rec_new_file(); | ||
837 | /* tell recording_screen to reset the time */ | ||
838 | last_seconds = 0; | ||
839 | break; | ||
840 | } | ||
841 | |||
815 | if (global_settings.rec_trigger_mode != TRIG_MODE_REARM) | 842 | if (global_settings.rec_trigger_mode != TRIG_MODE_REARM) |
816 | { | 843 | { |
817 | peak_meter_set_trigger_listener(NULL); | 844 | peak_meter_set_trigger_listener(NULL); |
@@ -861,6 +888,9 @@ bool recording_screen(bool no_source) | |||
861 | int i; | 888 | int i; |
862 | int filename_offset[NB_SCREENS]; | 889 | int filename_offset[NB_SCREENS]; |
863 | int pm_y[NB_SCREENS]; | 890 | int pm_y[NB_SCREENS]; |
891 | int trig_xpos[NB_SCREENS]; | ||
892 | int trig_ypos[NB_SCREENS]; | ||
893 | int trig_width[NB_SCREENS]; | ||
864 | 894 | ||
865 | static const unsigned char *byte_units[] = { | 895 | static const unsigned char *byte_units[] = { |
866 | ID2P(LANG_BYTE), | 896 | ID2P(LANG_BYTE), |
@@ -1602,6 +1632,10 @@ bool recording_screen(bool no_source) | |||
1602 | line[i] = 3; | 1632 | line[i] = 3; |
1603 | break; | 1633 | break; |
1604 | #endif | 1634 | #endif |
1635 | default: | ||
1636 | line[i] = 5; /* to prevent uninitialisation | ||
1637 | warnings for line[0] */ | ||
1638 | break; | ||
1605 | } /* end switch */ | 1639 | } /* end switch */ |
1606 | #ifdef HAVE_AGC | 1640 | #ifdef HAVE_AGC |
1607 | if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i])) | 1641 | if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i])) |
@@ -1747,12 +1781,28 @@ bool recording_screen(bool no_source) | |||
1747 | } | 1781 | } |
1748 | 1782 | ||
1749 | /* draw the trigger status */ | 1783 | /* draw the trigger status */ |
1784 | FOR_NB_SCREENS(i) | ||
1785 | { | ||
1786 | trig_width[i] = ((screens[i].height < 64) || | ||
1787 | ((screens[i].height < 72) && (PM_HEIGHT > 1))) ? | ||
1788 | screens[i].width - 14 * w : screens[i].width; | ||
1789 | trig_xpos[i] = screens[i].width - trig_width[i]; | ||
1790 | trig_ypos[i] = ((screens[i].height < 72) && (PM_HEIGHT > 1)) ? | ||
1791 | h*2 : | ||
1792 | h*(1 + filename_offset[i] + PM_HEIGHT + line[i] | ||
1793 | #ifdef HAVE_AGC | ||
1794 | + 1 | ||
1795 | #endif | ||
1796 | ); | ||
1797 | } | ||
1798 | |||
1750 | if (peak_meter_trigger_status() != TRIG_OFF) | 1799 | if (peak_meter_trigger_status() != TRIG_OFF) |
1751 | { | 1800 | { |
1752 | peak_meter_draw_trig(LCD_WIDTH - TRIG_WIDTH, 4 * h); | 1801 | peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, |
1802 | screen_update); | ||
1753 | for(i = 0; i < screen_update; i++){ | 1803 | for(i = 0; i < screen_update; i++){ |
1754 | screens[i].update_rect(LCD_WIDTH - (TRIG_WIDTH + 2), 4 * h, | 1804 | screens[i].update_rect(trig_xpos[i], trig_ypos[i], |
1755 | TRIG_WIDTH + 2, TRIG_HEIGHT); | 1805 | trig_width[i] + 2, TRIG_HEIGHT); |
1756 | } | 1806 | } |
1757 | } | 1807 | } |
1758 | } | 1808 | } |