summaryrefslogtreecommitdiff
path: root/firmware/mpeg.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-06 18:07:30 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-06 18:07:30 +0000
commit0f5cb94aa4a334366a746fcbb22f3335ca413265 (patch)
tree8f89a96628c1810d51ee9816daf78edb8c76fcd4 /firmware/mpeg.c
parent0b22795e26ee09de14f6ac23219adeda12f2fd5b (diff)
downloadrockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.tar.gz
rockbox-0f5cb94aa4a334366a746fcbb22f3335ca413265.zip
Big Patch adds primarily: Samplerate and format selection to recording for SWCODEC. Supprort for samplerates changing in playback (just goes with the recording part inseparably). Samplerates to all encoders. Encoders can be configured individually on a menu specific to the encoder in the recording menu. File creation is delayed until flush time to reduce spinups when splitting. Misc: statusbar icons for numbers are individual digits to display any number. Audio buffer was rearranged to maximize memory available to recording and properly reinitialized when trashed. ColdFire PCM stuff moved to target tree to avoid a complicated mess when adding samplerate switching. Some needed API changes and to neaten up growing gap between hardware and software codecs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11452 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/mpeg.c')
-rw-r--r--firmware/mpeg.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index ce1d995461..bb438a3ab4 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -2453,34 +2453,32 @@ static void stop_recording(void)
2453 resume_recording(); 2453 resume_recording();
2454} 2454}
2455 2455
2456void audio_set_recording_options(int frequency, int quality, 2456void audio_set_recording_options(struct audio_recording_options *options)
2457 int source, int channel_mode,
2458 bool editable, int prerecord_time)
2459{ 2457{
2460 bool is_mpeg1; 2458 bool is_mpeg1;
2461 2459
2462 is_mpeg1 = (frequency < 3)?true:false; 2460 is_mpeg1 = (options->rec_frequency < 3)?true:false;
2463 2461
2464 rec_version_index = is_mpeg1?3:2; 2462 rec_version_index = is_mpeg1?3:2;
2465 rec_frequency_index = frequency % 3; 2463 rec_frequency_index = options->rec_frequency % 3;
2466 2464
2467 shadow_encoder_control = (quality << 17) | 2465 shadow_encoder_control = (options->rec_quality << 17) |
2468 (rec_frequency_index << 10) | 2466 (rec_frequency_index << 10) |
2469 ((is_mpeg1?1:0) << 9) | 2467 ((is_mpeg1?1:0) << 9) |
2470 (((channel_mode * 2 + 1) & 3) << 6) | 2468 (((options->rec_channels * 2 + 1) & 3) << 6) |
2471 (1 << 5) /* MS-stereo */ | 2469 (1 << 5) /* MS-stereo */ |
2472 (1 << 2) /* Is an original */; 2470 (1 << 2) /* Is an original */;
2473 mas_writemem(MAS_BANK_D0, MAS_D0_ENCODER_CONTROL, &shadow_encoder_control,1); 2471 mas_writemem(MAS_BANK_D0, MAS_D0_ENCODER_CONTROL, &shadow_encoder_control,1);
2474 2472
2475 DEBUGF("mas_writemem(MAS_BANK_D0, ENCODER_CONTROL, %x)\n", shadow_encoder_control); 2473 DEBUGF("mas_writemem(MAS_BANK_D0, ENCODER_CONTROL, %x)\n", shadow_encoder_control);
2476 2474
2477 shadow_soft_mute = editable?4:0; 2475 shadow_soft_mute = options->rec_editable?4:0;
2478 mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1); 2476 mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1);
2479 2477
2480 DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute); 2478 DEBUGF("mas_writemem(MAS_BANK_D0, SOFT_MUTE, %x)\n", shadow_soft_mute);
2481 2479
2482 shadow_io_control_main = ((1 << 10) | /* Monitoring ON */ 2480 shadow_io_control_main = ((1 << 10) | /* Monitoring ON */
2483 ((source < 2)?1:2) << 8) | /* Input select */ 2481 ((options->rec_source < 2)?1:2) << 8) | /* Input select */
2484 (1 << 5) | /* SDO strobe invert */ 2482 (1 << 5) | /* SDO strobe invert */
2485 ((is_mpeg1?0:1) << 3) | 2483 ((is_mpeg1?0:1) << 3) |
2486 (1 << 2) | /* Inverted SIBC clock signal */ 2484 (1 << 2) | /* Inverted SIBC clock signal */
@@ -2489,7 +2487,7 @@ void audio_set_recording_options(int frequency, int quality,
2489 2487
2490 DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main); 2488 DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main);
2491 2489
2492 if(source == AUDIO_SRC_MIC) 2490 if(options->rec_source == AUDIO_SRC_MIC)
2493 { 2491 {
2494 /* Copy left channel to right (mono mode) */ 2492 /* Copy left channel to right (mono mode) */
2495 mas_codec_writereg(8, 0x8000); 2493 mas_codec_writereg(8, 0x8000);
@@ -2500,7 +2498,7 @@ void audio_set_recording_options(int frequency, int quality,
2500 mas_codec_writereg(8, 0); 2498 mas_codec_writereg(8, 0);
2501 } 2499 }
2502 2500
2503 prerecording_max_seconds = prerecord_time; 2501 prerecording_max_seconds = options->rec_prerecord_time;
2504 if(prerecording_max_seconds) 2502 if(prerecording_max_seconds)
2505 { 2503 {
2506 prerecording = true; 2504 prerecording = true;