path: root/apps/pcmbuf.h
diff options
authorMichael Sevakis <>2011-08-28 07:45:35 +0000
committerMichael Sevakis <>2011-08-28 07:45:35 +0000
commit7ad2cad173ffa094bb285112582afee1c9aea4e5 (patch)
treece23e816cfdffb1767ebe44f4f960c304d8a5fb9 /apps/pcmbuf.h
parent463b3ed8b2630d1b9d656dd2a52bbcbd429b4c08 (diff)
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:// a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/pcmbuf.h')
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 @@
#ifndef PCMBUF_H
#define PCMBUF_H
+#include <sys/types.h>
/* Commit PCM data */
void *pcmbuf_request_buffer(int *count);
-void pcmbuf_write_complete(int count);
+void pcmbuf_write_complete(int count, unsigned long elapsed, off_t offset);
/* Init */
size_t pcmbuf_init(unsigned char *bufend);
@@ -33,20 +35,30 @@ void pcmbuf_play_start(void);
void pcmbuf_play_stop(void);
void pcmbuf_pause(bool pause);
void pcmbuf_monitor_track_change(bool monitor);
-bool pcmbuf_start_track_change(bool manual_skip);
+void pcmbuf_sync_position_update(void);
+/* Track change origin type */
+enum pcm_track_change_type
+ TRACK_CHANGE_NONE = 0, /* No track change pending */
+ TRACK_CHANGE_MANUAL, /* Manual change (from user) */
+ TRACK_CHANGE_AUTO, /* Automatic change (from codec) */
+ TRACK_CHANGE_END_OF_DATA, /* Expect no more data (from codec) */
+void pcmbuf_start_track_change(enum pcm_track_change_type type);
/* Crossfade */
bool pcmbuf_is_crossfade_active(void);
-void pcmbuf_request_crossfade_enable(bool on_off);
+void pcmbuf_request_crossfade_enable(int setting);
bool pcmbuf_is_same_size(void);
/* Dummy functions with sensible returns */
-static inline bool pcmbuf_is_crossfade_active(void)
+static FORCE_INLINE bool pcmbuf_is_crossfade_active(void)
{ return false; }
-static inline void pcmbuf_request_crossfade_enable(bool on_off)
+static FORCE_INLINE void pcmbuf_request_crossfade_enable(bool on_off)
{ return; (void)on_off; }
-static inline bool pcmbuf_is_same_size(void)
+static FORCE_INLINE bool pcmbuf_is_same_size(void)
{ return true; }
@@ -59,9 +71,7 @@ size_t pcmbuf_free(void);
size_t pcmbuf_get_bufsize(void);
int pcmbuf_descs(void);
int pcmbuf_used_descs(void);
-unsigned char *pcmbuf_get_meminfo(size_t *length);
+unsigned int pcmbuf_get_position_key(void);
/* Misc */
void pcmbuf_fade(bool fade, bool in);
@@ -69,6 +79,5 @@ bool pcmbuf_fading(void);
void pcmbuf_soft_mode(bool shhh);
bool pcmbuf_is_lowdata(void);
void pcmbuf_set_low_latency(bool state);
-unsigned long pcmbuf_get_latency(void);