mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-05-12 11:43:16 -04:00
pcmbuf: remove pcmbuf_sampr
Change-Id: I5da91acbf8a3e23446d38b9e62d4e1c67d41aba9
This commit is contained in:
parent
498a9fffeb
commit
cfb01cfd58
4 changed files with 11 additions and 24 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "kernel.h"
|
||||
#include "codecs.h"
|
||||
#include "codec_thread.h"
|
||||
#include "pcm_mixer.h"
|
||||
#include "pcmbuf.h"
|
||||
#include "audio_thread.h"
|
||||
#include "playback.h"
|
||||
|
|
@ -518,7 +519,7 @@ static void run_codec(void)
|
|||
codec_queue_ack(Q_CODEC_RUN);
|
||||
|
||||
trigger_cpu_boost();
|
||||
dsp_configure(ci.dsp, DSP_SET_OUT_FREQUENCY, pcmbuf_get_frequency());
|
||||
dsp_configure(ci.dsp, DSP_SET_OUT_FREQUENCY, mixer_get_frequency());
|
||||
|
||||
if (!encoder)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,17 +69,20 @@
|
|||
chunks */
|
||||
|
||||
/* Return data level in 1/4-second increments */
|
||||
#define DATA_LEVEL(quarter_secs) (pcmbuf_sampr * (quarter_secs))
|
||||
static inline unsigned int data_level(int quarter_secs)
|
||||
{
|
||||
return mixer_get_frequency() * quarter_secs;
|
||||
}
|
||||
|
||||
/* Number of bytes played per second */
|
||||
#define BYTERATE (pcmbuf_sampr * PCMBUF_SAMPLE_SIZE)
|
||||
#define BYTERATE (mixer_get_frequency() * PCMBUF_SAMPLE_SIZE)
|
||||
|
||||
#if MEMORYSIZE > 2
|
||||
/* Keep watermark high for large memory target - at least (2s) */
|
||||
#define PCMBUF_WATERMARK (BYTERATE * 2)
|
||||
#define MIN_BUFFER_SIZE (BYTERATE * 3)
|
||||
/* 1 seconds of buffer is low data */
|
||||
#define LOW_DATA DATA_LEVEL(4)
|
||||
#define LOW_DATA data_level(4)
|
||||
#else
|
||||
#define PCMBUF_WATERMARK (BYTERATE / 4) /* 0.25 seconds */
|
||||
#define MIN_BUFFER_SIZE (BYTERATE * 1)
|
||||
|
|
@ -109,7 +112,6 @@ static size_t pcmbuf_size;
|
|||
static struct chunkdesc *pcmbuf_descriptors;
|
||||
static unsigned int pcmbuf_desc_count;
|
||||
static unsigned int position_key = 1;
|
||||
static unsigned int pcmbuf_sampr = 0;
|
||||
|
||||
static size_t chunk_ridx;
|
||||
static size_t chunk_widx;
|
||||
|
|
@ -482,7 +484,7 @@ void * pcmbuf_request_buffer(int *count)
|
|||
if (low_latency_mode)
|
||||
{
|
||||
/* 1/4s latency. */
|
||||
if (remaining > DATA_LEVEL(1))
|
||||
if (remaining > data_level(1))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -724,7 +726,7 @@ void pcmbuf_start_track_change(enum pcm_track_change_type type)
|
|||
else if (crossfade_setting != CROSSFADE_ENABLE_OFF)
|
||||
{
|
||||
if (crossfade_status == CROSSFADE_INACTIVE &&
|
||||
pcmbuf_unplayed_bytes() >= DATA_LEVEL(2) &&
|
||||
pcmbuf_unplayed_bytes() >= data_level(2) &&
|
||||
!low_latency_mode)
|
||||
{
|
||||
switch (crossfade_setting)
|
||||
|
|
@ -1151,7 +1153,7 @@ static void crossfade_start(void)
|
|||
size_t unplayed = pcmbuf_unplayed_bytes();
|
||||
|
||||
/* Reject crossfade if less than .5s of data */
|
||||
if (unplayed < DATA_LEVEL(2))
|
||||
if (unplayed < data_level(2))
|
||||
{
|
||||
logf("crossfade rejected");
|
||||
crossfade_cancel();
|
||||
|
|
@ -1447,13 +1449,3 @@ void pcmbuf_set_low_latency(bool state)
|
|||
{
|
||||
low_latency_mode = state;
|
||||
}
|
||||
|
||||
void pcmbuf_update_frequency(void)
|
||||
{
|
||||
pcmbuf_sampr = mixer_get_frequency();
|
||||
}
|
||||
|
||||
unsigned int pcmbuf_get_frequency(void)
|
||||
{
|
||||
return pcmbuf_sampr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,5 @@ void pcmbuf_sync_position_update(void);
|
|||
/* Misc */
|
||||
bool pcmbuf_is_lowdata(void);
|
||||
void pcmbuf_set_low_latency(bool state);
|
||||
void pcmbuf_update_frequency(void);
|
||||
unsigned int pcmbuf_get_frequency(void);
|
||||
|
||||
#endif /* PCMBUF_H */
|
||||
|
|
|
|||
|
|
@ -3036,7 +3036,6 @@ static void audio_start_playback(const struct audio_resume_info *resume_info,
|
|||
skip_resume_adjustments = id3_get(PLAYING_ID3)->skip_resume_adjustments;
|
||||
|
||||
track_list_clear(TRACK_LIST_CLEAR_ALL);
|
||||
pcmbuf_update_frequency();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3049,7 +3048,6 @@ static void audio_start_playback(const struct audio_resume_info *resume_info,
|
|||
pcmbuf_start_track_change(TRACK_CHANGE_MANUAL);
|
||||
wipe_track_metadata(true);
|
||||
}
|
||||
pcmbuf_update_frequency();
|
||||
|
||||
/* Set after track finish event in case skip was in progress */
|
||||
skip_pending = TRACK_SKIP_NONE;
|
||||
|
|
@ -3071,7 +3069,6 @@ static void audio_start_playback(const struct audio_resume_info *resume_info,
|
|||
#ifndef PLATFORM_HAS_VOLUME_CHANGE
|
||||
sound_set_volume(global_status.volume);
|
||||
#endif
|
||||
pcmbuf_update_frequency();
|
||||
|
||||
/* Be sure channel is audible */
|
||||
pcmbuf_fade(false, true);
|
||||
|
|
@ -4315,7 +4312,6 @@ void INIT_ATTR playback_init(void)
|
|||
mutex_init(&id3_mutex);
|
||||
track_list_init();
|
||||
buffering_init();
|
||||
pcmbuf_update_frequency();
|
||||
#ifdef HAVE_CROSSFADE
|
||||
/* Set crossfade setting for next buffer init which should be about... */
|
||||
pcmbuf_request_crossfade_enable(global_settings.crossfade);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue