diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-08-28 07:45:35 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-08-28 07:45:35 +0000 |
commit | 7ad2cad173ffa094bb285112582afee1c9aea4e5 (patch) | |
tree | ce23e816cfdffb1767ebe44f4f960c304d8a5fb9 /apps/pcmbuf.h | |
parent | 463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08 (diff) | |
download | rockbox-7ad2cad173ffa094bb285112582afee1c9aea4e5.tar.gz rockbox-7ad2cad173ffa094bb285112582afee1c9aea4e5.zip |
Commit work started in FS#12153 to put timing/position information in PCM
buffer chunks.
* Samples and position indication is closely associated with audio data
instead of compensating by a latency constant. Alleviates problems with
using the elapsed as a track indicator where it could be off by several
steps.
* Timing is accurate throughout track even if resampling for pitch shift,
whereas before it updated during transition latency at the normal 1:1 rate.
* Simpler PCM buffer with a constant chunk size, no linked lists.
In converting crossfade, a minor change was made to not change the WPS until
the fade-in of the incoming track, whereas before it would change upon the
start of the fade-out of the outgoing track possibly having the WPS change
with far too much lead time.
Codec changes are to set elapsed times *before* writing next PCM frame because
time and position data last set are saved in the next committed PCM chunk.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30366 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.h')
-rw-r--r-- | apps/pcmbuf.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h index a5cd3163e1..3261b20b35 100644 --- a/apps/pcmbuf.h +++ b/apps/pcmbuf.h | |||
@@ -21,9 +21,11 @@ | |||
21 | #ifndef PCMBUF_H | 21 | #ifndef PCMBUF_H |
22 | #define PCMBUF_H | 22 | #define PCMBUF_H |
23 | 23 | ||
24 | #include <sys/types.h> | ||
25 | |||
24 | /* Commit PCM data */ | 26 | /* Commit PCM data */ |
25 | void *pcmbuf_request_buffer(int *count); | 27 | void *pcmbuf_request_buffer(int *count); |
26 | void pcmbuf_write_complete(int count); | 28 | void pcmbuf_write_complete(int count, unsigned long elapsed, off_t offset); |
27 | 29 | ||
28 | /* Init */ | 30 | /* Init */ |
29 | size_t pcmbuf_init(unsigned char *bufend); | 31 | size_t pcmbuf_init(unsigned char *bufend); |
@@ -33,20 +35,30 @@ void pcmbuf_play_start(void); | |||
33 | void pcmbuf_play_stop(void); | 35 | void pcmbuf_play_stop(void); |
34 | void pcmbuf_pause(bool pause); | 36 | void pcmbuf_pause(bool pause); |
35 | void pcmbuf_monitor_track_change(bool monitor); | 37 | void pcmbuf_monitor_track_change(bool monitor); |
36 | bool pcmbuf_start_track_change(bool manual_skip); | 38 | void pcmbuf_sync_position_update(void); |
39 | |||
40 | /* Track change origin type */ | ||
41 | enum pcm_track_change_type | ||
42 | { | ||
43 | TRACK_CHANGE_NONE = 0, /* No track change pending */ | ||
44 | TRACK_CHANGE_MANUAL, /* Manual change (from user) */ | ||
45 | TRACK_CHANGE_AUTO, /* Automatic change (from codec) */ | ||
46 | TRACK_CHANGE_END_OF_DATA, /* Expect no more data (from codec) */ | ||
47 | }; | ||
48 | void pcmbuf_start_track_change(enum pcm_track_change_type type); | ||
37 | 49 | ||
38 | /* Crossfade */ | 50 | /* Crossfade */ |
39 | #ifdef HAVE_CROSSFADE | 51 | #ifdef HAVE_CROSSFADE |
40 | bool pcmbuf_is_crossfade_active(void); | 52 | bool pcmbuf_is_crossfade_active(void); |
41 | void pcmbuf_request_crossfade_enable(bool on_off); | 53 | void pcmbuf_request_crossfade_enable(int setting); |
42 | bool pcmbuf_is_same_size(void); | 54 | bool pcmbuf_is_same_size(void); |
43 | #else | 55 | #else |
44 | /* Dummy functions with sensible returns */ | 56 | /* Dummy functions with sensible returns */ |
45 | static inline bool pcmbuf_is_crossfade_active(void) | 57 | static FORCE_INLINE bool pcmbuf_is_crossfade_active(void) |
46 | { return false; } | 58 | { return false; } |
47 | static inline void pcmbuf_request_crossfade_enable(bool on_off) | 59 | static FORCE_INLINE void pcmbuf_request_crossfade_enable(bool on_off) |
48 | { return; (void)on_off; } | 60 | { return; (void)on_off; } |
49 | static inline bool pcmbuf_is_same_size(void) | 61 | static FORCE_INLINE bool pcmbuf_is_same_size(void) |
50 | { return true; } | 62 | { return true; } |
51 | #endif | 63 | #endif |
52 | 64 | ||
@@ -59,9 +71,7 @@ size_t pcmbuf_free(void); | |||
59 | size_t pcmbuf_get_bufsize(void); | 71 | size_t pcmbuf_get_bufsize(void); |
60 | int pcmbuf_descs(void); | 72 | int pcmbuf_descs(void); |
61 | int pcmbuf_used_descs(void); | 73 | int pcmbuf_used_descs(void); |
62 | #ifdef ROCKBOX_HAS_LOGF | 74 | unsigned int pcmbuf_get_position_key(void); |
63 | unsigned char *pcmbuf_get_meminfo(size_t *length); | ||
64 | #endif | ||
65 | 75 | ||
66 | /* Misc */ | 76 | /* Misc */ |
67 | void pcmbuf_fade(bool fade, bool in); | 77 | void pcmbuf_fade(bool fade, bool in); |
@@ -69,6 +79,5 @@ bool pcmbuf_fading(void); | |||
69 | void pcmbuf_soft_mode(bool shhh); | 79 | void pcmbuf_soft_mode(bool shhh); |
70 | bool pcmbuf_is_lowdata(void); | 80 | bool pcmbuf_is_lowdata(void); |
71 | void pcmbuf_set_low_latency(bool state); | 81 | void pcmbuf_set_low_latency(bool state); |
72 | unsigned long pcmbuf_get_latency(void); | ||
73 | 82 | ||
74 | #endif | 83 | #endif |