Control audio playback position with slider ?!


Hi everyone,

I'm am trying to control the position of an audio playback with a slider...I've tried so many times and it doesn't work. The audio plays and everything works fine instead of the slider which fails to control and track the song position.

Take a look at the codes and help me with this problem. :)

void ComponentA::sliderValueChanged(Slider* slider)
    if (&sliderControl == slider)

I think that this function should change the position of the the song that is playing and I have add a listener for the slider so it must work. Anyway I am new in juce and need a little help from you.:)


It should work, but is your slider's value range correct?


Actually i don't know how to set the Range of the slider because i tried many times and failed. I mean i dont know what values I should set for the min, max and interval in order to control the position.

If you can help me with that it would be great. :)



Well, think about it..! You need a position in seconds, so it'd need to go from 0 to the length of the thing you're playing.


Well, thanks for the help. I was thinking and gonna keep thinking till i find out how it works. :P

About the Juce have done a great job and I really appreciate it! ;)


Cheers, hope you get your code working!


I hope so. :P

Thanks. ;)