0
0

I’m currently developing an audio player using FMOD and GTK for Linux. All FMOD functionalities work very well, and I’ve added few things to them to implement them, but I am having an issue with file callbacks after the scroll bar is changed (and this randomly) : the file is read in a fast-forward manner to the end of the file.

Every file that is read is opened as a stream using [i:3twzucw1]FMOD_CREATESTREAM[/i:3twzucw1].

I have a timer that calls back the SystemUpdate function every 500 milliseconds, but maybe this behavior means that it’s not being called often enough ? Here’s a snipet of the timer on the scrollbar :

[code:3twzucw1]int timerscroll(GtkWidget *wid)
{
GtkWidget *range, *plabel;
unsigned int len;
unsigned int pos;

isSettingValue2 = 1;
puts("@@@@@@@@@@@@@@@@@@@@@@@@@@");

if(chanson == NULL)
{
puts("No song");
return 0;
}
else
{
range = lookup_widget(GTK_WIDGET(wid), "hscale1");/* range is now a pointer on the scrollbar */

  if (isSettingValue) /* The scrollbar has been moved since the last time */
{
  puts("La barre a ete bougee");
      if (isPlaying_sound(&channel))
    {
      puts("Le buffer va etre decalle");
      pos = (int)gtk_range_get_value(GTK_RANGE(range));
      printf("Progress = %i \n",pos);
      range = lookup_widget(GTK_WIDGET(wid), "hscale1");
      length_sound(&len, &sound);      
      set_position(&channel, ((float)len * pos/100.0));
      puts("Le buffer est decalle");
    }
  else
    {
      gtk_range_set_value(GTK_RANGE(range), 0);/* Puts the scrollbar to the zero position */
    }
}
  else
{
  puts("Progression normale va etre effectuee");
  length_sound(&len,&sound);
  pos = get_position(&channel);
  gtk_range_set_value(GTK_RANGE(range), ((pos)*(100./len)));  
  puts("Progression normale OK");
}

}

isSettingValue = 0;
isSettingValue2 = 0;
puts("bool a faux, on sort");

return 1;
}
[/code:3twzucw1]

If there is anything more that I should specify, let me know. It seems odd to think that this would be coming from my code, but maybe I missed a bit in the Doc.

  • You must to post comments
0
0

I guess what I’m asking is : are there known issues with setposition or more generally FMOD using linux ?

  • You must to post comments
0
0

In short, the actual problem is that when I play around with the position scrollbar, After letting go after an X number of time or playing around with it, the song plays really fast till to the end and I cannot control it. When I try to pause it, the sound is paused but the scroll bar continues to quickly move forward and all it does is position itself according to the position in the song (no setpositions, sorry :/, only getpositions).

note : the X is random too, it can be either 1 or 23 or 12..and I’m reading MP3s in this case

  • You must to post comments
0
0

Thank you brett ! FMOD_ACCURATETIME seems to have fixed my "bug"!

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.