#108 inconsistent loop end convention

open
nobody
None
4
2013-01-18
2009-07-30
Patric Schmitz
No

There are two places where the sequence loop_start and loop_end values are initialized with defaults in case they are -1.

1. song.c:208, bt_song_update_play_seek_event:
if(loop_start==-1) loop_start=0;
if(loop_end==-1) loop_end=length-1;

2. sequence.c, bt_sequence_set_property:
...
if(self->priv->loop_end==-1) {
self->priv->loop_end=self->priv->length;
...
if(self->priv->loop_end!=-1) {
// make sure its more then loop-start
if(self->priv->loop_start>-1) {
if(self->priv->loop_end<self->priv->loop_start)
self->priv->loop_end=self->priv->loop_start+1;
}
// make sure its less then or equal to length
if(self->priv->length>0) {
if(self->priv->loop_end>self->priv->length)
self->priv->loop_end=self->priv->length;
}

I guess it should be length, not length-1 in song.c.
could you verify this?

Discussion

  • Stefan Sauer
    Stefan Sauer
    2009-07-31

    ah, its the not-looping case and what you say makes sense. does it fix it for you? if so, please change.

     
  • Patric Schmitz
    Patric Schmitz
    2009-07-31

    it does not visibly change any behavior. i just noticed that the loop_end is initialized to length in the one case and length-1 in the other. i figured this might be a bug. or is this intended behavior, like length-1 represents looping and length not, or the other was around.. I just wanted to bring this to your attention to re-check on the consistency of the convention.