d37bf24d90
Replaces the NATIVE_FREQUENCY constant with a configurable frequency. The user may select 48000Hz if the hardware supports it. The default is still 44100Hz and the minimum is 44100Hz. The setting is located in the playback settings, under "Frequency". "Frequency" was duplicated in english.lang for now to avoid having to fix every .lang file for the moment and throwing everything out of sync because of the new play_frequency feature in features.txt. The next cleanup should combine it with the one included for recording and generalize the ID label. If the hardware doesn't support 48000Hz, no setting will be available. On particular hardware where very high rates are practical and desireable, the upper bound can be extended by patching. The PCM mixer can be configured to play at the full hardware frequency range. The DSP core can configure to the hardware minimum up to the maximum playback setting (some buffers must be reserved according to the maximum rate). If only 44100Hz is supported or possible on a given target for playback, using the DSP and mixer at other samperates is possible if the hardware offers them. Change-Id: I6023cf0c0baa8bc6292b6919b4dd3618a6a25622 Reviewed-on: http://gerrit.rockbox.org/479 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested-by: Michael Sevakis <jethead71@rockbox.org>
78 lines
1.9 KiB
C
78 lines
1.9 KiB
C
#ifndef RBCODECCONFIG_H_INCLUDED
|
|
#define RBCODECCONFIG_H_INCLUDED
|
|
|
|
#include "config.h"
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
/* NULL, offsetof, size_t */
|
|
#include <stddef.h>
|
|
|
|
/* ssize_t, off_t, open, close, read, lseek, SEEK_SET, SEEK_CUR, SEEK_END,
|
|
* O_RDONLY, O_WRONLY, O_CREAT, O_APPEND, MAX_PATH, filesize */
|
|
#include "file.h"
|
|
|
|
/* {,u}int{8,16,32,64}_t, , intptr_t, uintptr_t, bool, true, false, swap16,
|
|
* swap32, hto{be,le}{16,32}, {be,le}toh{16,32}, ROCKBOX_{BIG,LITTLE}_ENDIAN,
|
|
* {,U}INT{8,16,32,64}_{MIN,MAX} */
|
|
#include "system.h"
|
|
|
|
/* Structure to record some info during processing call */
|
|
struct dsp_loop_context
|
|
{
|
|
long last_yield;
|
|
#ifdef CPU_COLDFIRE
|
|
unsigned long old_macsr;
|
|
#endif
|
|
};
|
|
|
|
static inline void dsp_process_start(struct dsp_loop_context *ctx)
|
|
{
|
|
/* At least perform one yield before starting */
|
|
ctx->last_yield = current_tick;
|
|
yield();
|
|
#if defined(CPU_COLDFIRE)
|
|
/* set emac unit for dsp processing, and save old macsr, we're running in
|
|
codec thread context at this point, so can't clobber it */
|
|
ctx->old_macsr = coldfire_get_macsr();
|
|
coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
|
|
#endif
|
|
}
|
|
|
|
static inline void dsp_process_loop(struct dsp_loop_context *ctx)
|
|
{
|
|
/* Yield at least once each tick */
|
|
long tick = current_tick;
|
|
if (TIME_AFTER(tick, ctx->last_yield))
|
|
{
|
|
ctx->last_yield = tick;
|
|
yield();
|
|
}
|
|
}
|
|
|
|
static inline void dsp_process_end(struct dsp_loop_context *ctx)
|
|
{
|
|
#if defined(CPU_COLDFIRE)
|
|
/* set old macsr again */
|
|
coldfire_set_macsr(ctx->old_macsr);
|
|
#endif
|
|
(void)ctx;
|
|
}
|
|
|
|
#define DSP_PROCESS_START() \
|
|
struct dsp_loop_context __ctx; \
|
|
dsp_process_start(&__ctx)
|
|
|
|
#define DSP_PROCESS_LOOP() \
|
|
dsp_process_loop(&__ctx)
|
|
|
|
#define DSP_PROCESS_END() \
|
|
dsp_process_end(&__ctx)
|
|
|
|
#endif
|
|
|
|
#define DSP_OUT_MIN_HZ PLAY_SAMPR_HW_MIN
|
|
#define DSP_OUT_MAX_HZ PLAY_SAMPR_MAX
|
|
#define DSP_OUT_DEFAULT_HZ PLAY_SAMPR_DEFAULT
|
|
|
|
#endif
|