diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2005-08-06 10:12:19 +0000 |
---|---|---|
committer | Christian Gmeiner <christian.gmeiner@gmail.com> | 2005-08-06 10:12:19 +0000 |
commit | 14e80671afca494b26354753c8fddc3c3a787d4c (patch) | |
tree | 68fa16731953a3bff3fcb531dc0ef61cddad6f89 /apps/pcm_recording.c | |
parent | 095854b98925f5b01643b78f664dc4e6eace72be (diff) |
iAudio: First unfinished attempt for tlv320 driver and rockbox integration
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7286 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcm_recording.c')
-rw-r--r-- | apps/pcm_recording.c | 79 |
1 files changed, 50 insertions, 29 deletions
diff --git a/apps/pcm_recording.c b/apps/pcm_recording.c index 67f7d4da3c..9df44a5b30 100644 --- a/apps/pcm_recording.c +++ b/apps/pcm_recording.c @@ -48,10 +48,14 @@ #include "sound.h" #include "ata.h" #include "logf.h" +#if defined(HAVE_UDA1380) #include "uda1380.h" +#elif defined(HAVE_TLV320) +#include "tlv320.h" +#endif #include "pcm_record.h" -#ifdef HAVE_UDA1380 +#if defined(HAVE_UDA1380) || defined(HAVE_TLV320) bool pcm_rec_screen(void) { @@ -64,36 +68,45 @@ bool pcm_rec_screen(void) int rec_time; int done, button; int w, h; - + lcd_setfont(FONT_SYSFIXED); lcd_getstringsize("M", &w, &h); lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); - - play_vol = 120; + + play_vol = 120; //cpu_boost(true); +#if defined(HAVE_UDA1380) uda1380_enable_output(true); +#elif defined(HAVE_TLV320) + tlv320_enable_output(true); +#endif + +#if defined(HAVE_UDA1380) uda1380_set_master_vol(play_vol, play_vol); - +#elif defined(HAVE_TLV320) + tlv320_set_headphone_vol(play_vol, play_vol); +#endif + rec_monitor = 0; // No record feedback rec_source = 1; // Mic rec_gain = 0; // 0-15 rec_vol = 0; // 0-255 rec_count = 0; rec_waveform = 0; - + pcm_open_recording(); pcm_set_recording_options(rec_source, rec_waveform); pcm_set_recording_gain(rec_gain, rec_vol); - + //rec_create_directory(); - + done = 0; while(!done) { line = 0; - + snprintf(buf, sizeof(buf), "PlayVolume: %3d", play_vol); lcd_puts(0,line++, buf); snprintf(buf, sizeof(buf), "Gain : %2d Volume : %2d", rec_gain, rec_vol); @@ -112,10 +125,10 @@ bool pcm_rec_screen(void) snprintf(buf, sizeof(buf), "File : %s", filename); lcd_puts(0,line++, buf); snprintf(buf, sizeof(buf), "Time : %02d:%02d.%02d", rec_time/HZ/60, (rec_time/HZ)%60, rec_time%HZ); - lcd_puts(0,line++, buf); - + lcd_puts(0,line++, buf); + line++; - + snprintf(buf, sizeof(buf), "MODE : Select source"); lcd_puts(0,line++, buf); snprintf(buf, sizeof(buf), "UP/DOWN : Record volume"); @@ -127,10 +140,10 @@ bool pcm_rec_screen(void) snprintf(buf, sizeof(buf), "RMT PLAY: Toggle waveform"); lcd_puts(0,line++, buf); - + lcd_update(); - - + + button = button_get_w_tmo(HZ/8); switch (button) { @@ -142,14 +155,14 @@ bool pcm_rec_screen(void) if (pcm_status() & AUDIO_STATUS_RECORD) { pcm_stop_recording(); - + } else { snprintf(filename, MAX_PATH, "/record-%0d.wav", rec_count++); pcm_record(filename); } break; - + case BUTTON_ON: break; @@ -162,7 +175,7 @@ bool pcm_rec_screen(void) case BUTTON_RIGHT | BUTTON_REPEAT: if (rec_gain < 15) rec_gain++; - + pcm_set_recording_gain(rec_gain, rec_vol); break; @@ -170,20 +183,22 @@ bool pcm_rec_screen(void) case BUTTON_LEFT | BUTTON_REPEAT: if (rec_gain > 0) rec_gain--; - + pcm_set_recording_gain(rec_gain, rec_vol); break; - + case BUTTON_RC_MENU: rec_monitor = 1 - rec_monitor; +#if defined(HAVE_UDA1380) uda1380_set_monitor(rec_monitor); +#endif break; - + case BUTTON_RC_ON: rec_waveform = 1 - rec_waveform; pcm_set_recording_options(rec_source, rec_waveform); break; - + case BUTTON_UP: case BUTTON_UP | BUTTON_REPEAT: if (rec_vol<255) @@ -205,23 +220,29 @@ bool pcm_rec_screen(void) } else { pcm_stop_recording(); - +#if defined(HAVE_UDA1380) uda1380_enable_output(false); - +#elif defined(HAVE_TLV320) + tlv320_enable_output(false); +#endif default_event_handler(SYS_USB_CONNECTED); return false; } break; - + } - + } - + pcm_stop_recording(); pcm_close_recording(); - + +#if defined(HAVE_UDA1380) uda1380_enable_output(false); - +#elif defined(HAVE_TLV320) + tlv320_enable_output(false); +#endif + return true; } |