Waveform how to get playback position?
-
I can see a function to set the playback position, but how do we get it?
My idea is to create a pause button. So the user clicks play, the audio file plays back, they hit pause and it stores the position, when they hit play again I resume from that position.
-
D d.healey marked this topic as a question on
-
-
@ulrik Yes, if I had an audio file, but I have a waveform control linked to a sampler.
-
@d-healey Oh, ok I see
-
@Christoph-Hart Any pointers?
-
Still haven't found a solution to this one. Also it seems
ScriptAudioWaveform.setPlaybackPosition()
doesn't do anything, at least when it's connected to a sampler? -
@d-healey Do you recall if this was ever resolved?
-
@clevername27 Not according to my last post here :)
-
@d-healey I'm baffled how anyone is able to ship a HISE-product. Obviously they do, but I am legit baffled.
-
@clevername27 These are edge-cases, the primary modules & UI elements are very well made and stable :)
-
@iamlamprey I appreciate your response. I do not believe there is a such a thing as an "edge case". An API either works, or it doesn't.
-
Surely the sampler itself should be reporting this, not the WaveForm view ???
My brain looks at this problem more along these lines:
- Get sampler.
- Get currently playing file.
- Get sample position for currently playing file.
- Use a ScriptPanel and a timer.
- Convert sample position into a pixel value.
- Draw a vertical line at the pixel value on the X axis, and as tall as you need it on the Y axis.
- Each time you want to update the position, clear the old line, and draw a new line.
This ScriptPanel would be placed over the top of the existing waveform panel.
This is more or less how I did my sample start/end and loop start/end mechanics.
The only thing I haven't done is any kind of update logic. But I'm sure it is possible. Provided you can get the data from the sampler or currently playing audio file.
-
@Orvillain Thank you - I'm confused, though, because I don't want to use a sampler. I just want to play an audio file. And HISE has a Module to do that:
Except, like so many things in HISE, it doesn't do that.