Hi All

I noticed a problem today when trying to enqueue audio files via python:

basically if I queue the same file more than once, the second instance does
not actually play. For example:

for example

(line 1) self.enqueue(self.voice_lib['yes'],None)
(line 2) self.enqueue(self.voice_lib['no'],None)
(line 3) self.enqueue(self.voice_lib['yes'],None)

everything works fine, except line 3 never plays the second 'yes' file.

It does however work if I flush the q before line 3 but surely the
above should work??????

on investigation into the source code it appears that there is a problem in
AmPlaylist.cpp where the initial audio file is never 'rewound' to the
beginning. The result is that the second play of that file doesnt have any
data as it is at the end of the file.

I managed to solve this with the following code, but not sure if there is a
better solution. Possibly we need a variable to flag if a file that has
already been played within the queue so it can be rewound instead of forcing
a rewind for every file (which is unnecessary)

code fix:

void AmPlaylist::updateCurrentItem()
{
  if(!cur_item){
    items_mut.lock();
    if(!items.empty()){
      if (items.front()){
        DBG("making sure the file to be played is rewound\n");
        AmAudioFile * p = (AmAudioFile*)items.front()->play;
        p->rewind();
      }
      cur_item = items.front();
      items.pop_front();
    }
    items_mut.unlock();
  }
}

Cheers
Jason Penton
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to