mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
AS3525v1/v2:
Fix problems with volume of recorded material by converting 14-bit samples to 16-bit. Remove duplicate samples from recorded data and support proper samplerate since ADC runs 1/2 the codec clock. Support monitoring mono on both output channels by feeding data manually to I2SOUT under the right conditions. DMA is no longer used for recording since frames must be processed as described above but it does allow full-duplex audio. Miscellaneous change includes a proper constant (HW_SAMPR_DEFAULT) to reset the hardware samplerate when recording is closed. PP5024 and AS3525 have different default recording rates (22kHz and 44kHz respectively) but both have half-speed ADC. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31180 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2c7379757c
commit
e42a3194de
17 changed files with 272 additions and 212 deletions
|
|
@ -24,16 +24,33 @@
|
|||
#include "audio.h"
|
||||
#include "audiohw.h"
|
||||
#include "sound.h"
|
||||
#include "general.h"
|
||||
|
||||
int audio_channels = 2;
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
int audio_output_source = AUDIO_SRC_PLAYBACK;
|
||||
#endif
|
||||
|
||||
void audio_set_output_source(int source)
|
||||
{
|
||||
bitset32(&CGU_PERI, CGU_I2SOUT_APB_CLOCK_ENABLE);
|
||||
if (source == AUDIO_SRC_PLAYBACK)
|
||||
I2SOUT_CONTROL &= ~(1<<5);
|
||||
|
||||
if ((unsigned)source >= AUDIO_NUM_SOURCES)
|
||||
source = AUDIO_SRC_PLAYBACK;
|
||||
|
||||
bool loopback = source != AUDIO_SRC_PLAYBACK;
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
loopback = loopback && audio_channels > 1;
|
||||
|
||||
audio_output_source = source;
|
||||
#endif
|
||||
|
||||
if (loopback)
|
||||
I2SOUT_CONTROL |= (1<<5); /* loopback from i2sin fifo */
|
||||
else
|
||||
I2SOUT_CONTROL |= 1<<5; /* source = loopback from i2sin fifo */
|
||||
I2SOUT_CONTROL &= ~(1<<5); /* normal i2sout */
|
||||
}
|
||||
|
||||
void audio_input_mux(int source, unsigned flags)
|
||||
|
|
@ -108,4 +125,33 @@ void audio_input_mux(int source, unsigned flags)
|
|||
}
|
||||
|
||||
last_source = source;
|
||||
|
||||
#if CONFIG_CPU == AS3525
|
||||
/* Sync on behalf of change in number of channels */
|
||||
audio_set_output_source(audio_output_source);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SAMPR_TYPES
|
||||
unsigned int pcm_sampr_to_hw_sampr(unsigned int samplerate,
|
||||
unsigned int type)
|
||||
{
|
||||
#ifdef HAVE_RECORDING
|
||||
if (samplerate != HW_SAMPR_RESET && type == SAMPR_TYPE_REC)
|
||||
{
|
||||
/* Check if the samplerate is in the list of recordable rates.
|
||||
* Fail to default if not */
|
||||
int index = round_value_to_list32(samplerate, rec_freq_sampr,
|
||||
REC_NUM_FREQ, false);
|
||||
if (samplerate != rec_freq_sampr[index])
|
||||
samplerate = REC_SAMPR_DEFAULT;
|
||||
|
||||
samplerate *= 2; /* Recording rates are 1/2 the codec clock */
|
||||
}
|
||||
#endif /* HAVE_RECORDING */
|
||||
|
||||
return samplerate;
|
||||
(void)type;
|
||||
}
|
||||
#endif /* CONFIG_SAMPR_TYPES */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue