Time control

All the time values in the waave library are uint32_t type and in the millisecond unit. The overflow appears after 50 days witch is confortable.

Relative seek

The simpliest way to move the playback position in a stream is to seek relative to the current playback position. By this way we doesn't need to take in consideration the duration of the stream and the distance between stream's beginning and end. To do this we just need to give shift amount and direction :

  /* seek 3 seconds forward */
  WV_rseekStream(myStream, 3000, WV_SEEK_FORWARD);

  /* seek 240 millisecionds backward */
  WV_rseekStream(myStream, 240, WV_SEEK_BACKWARD);

Seek with absolute position

The first thing to do when we thread with obsolute position is to get the total stream duration :

  /* get stream duration */
  uint32_t streamDuration;
  streamDuration = WV_getStreamDuration(myStream); 

We can now make, for exemple, a progress bar to seek where we want in the stream :

  /* get progress bar informations */
  int barSeekPos = ..... ;
  int barSize = ...... ;
  
  /* compute corresponding stream position */
  double normalizedPos = (double)barSeekPos/barSize;
  normalizedPos *= (double)streamDuration;

  /* seek to it */
  uint32_t streamPos = normalizedPos; //convert to uint32_t
  WV_seekStream(myStream, streamPos);