marlin r1281 - trunk/marlin
- From: iain svn gnome org
- To: svn-commits-list gnome org
- Subject: marlin r1281 - trunk/marlin
- Date: Tue, 30 Sep 2008 21:04:41 +0000 (UTC)
Author: iain
Date: Tue Sep 30 21:04:40 2008
New Revision: 1281
URL: http://svn.gnome.org/viewvc/marlin?rev=1281&view=rev
Log:
Handle looping correctly
Modified:
trunk/marlin/ChangeLog
trunk/marlin/marlin-block.h
trunk/marlin/marlin-jack-play.c
Modified: trunk/marlin/marlin-block.h
==============================================================================
--- trunk/marlin/marlin-block.h (original)
+++ trunk/marlin/marlin-block.h Tue Sep 30 21:04:40 2008
@@ -39,6 +39,8 @@
#define MARLIN_BLOCK_SIZE (MARLIN_PEAKS_PER_BLOCK * MARLIN_FRAMES_PER_PEAK)
#define MARLIN_BLOCK_SIZE_BYTES (MARLIN_BLOCK_SIZE * sizeof (float))
+#define MARLIN_FRAME_IN_BLOCK(block, frame) (((frame) >= (block)->start) && ((frame) <= (block)->end))
+
struct _MarlinBlock {
MarlinReadWriteLock *lock; /* Lock, do not access any data
without first obtaining the lock */
@@ -55,8 +57,8 @@
gboolean is_mapped;
/* Can the data be unmapped? */
gboolean unmappable;
-
- /* frame_region and peak_region will not be
+
+ /* frame_region and peak_region will not be
valid unless is_mapped == TRUE */
MarlinFileRegion *frame_region, *peak_region;
MarlinFile *frame_file, *peak_file;
Modified: trunk/marlin/marlin-jack-play.c
==============================================================================
--- trunk/marlin/marlin-jack-play.c (original)
+++ trunk/marlin/marlin-jack-play.c Tue Sep 30 21:04:40 2008
@@ -400,14 +400,9 @@
MarlinJackPlayPrivate *priv = jack->priv;
guint frames_needed, copied;
- if (priv->repeating) {
- frames_needed = DEFAULT_RB_SIZE;
- } else {
- frames_needed = MIN (priv->finish - pd->offset,
- DEFAULT_RB_SIZE);
- }
+ frames_needed = MIN (priv->finish - pd->offset, DEFAULT_RB_SIZE);
- if (frames_needed == 0) {
+ if (frames_needed == 0 && priv->repeating == FALSE) {
/* This will tell the reader that we've finished writing */
pd->writer_finished = TRUE;
return 0;
@@ -417,9 +412,19 @@
pd->offset, frames_needed,
&pd->current_block);
- pd->offset += copied;
- pd->offset_in_block = pd->offset - pd->current_block->start;
+ if (frames_needed < DEFAULT_RB_SIZE && priv->repeating) {
+ /* Reset back to the start of the loop */
+ pd->offset = priv->start;
+ /* Check if we're still in the current block before searching */
+ if (!MARLIN_FRAME_IN_BLOCK (pd->current_block, pd->offset)) {
+ pd->current_block = marlin_channel_get_block_for_frame (pd->channel, priv->start);
+ }
+ } else {
+ pd->offset += copied;
+ }
+
+ pd->offset_in_block = pd->offset - pd->current_block->start;
*data = pd->tmp_buffer;
return copied;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]