Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Seeking music files?  (Read 23589 times)

0 Members and 1 Guest are viewing this topic.

SpartanJ

  • Newbie
  • *
  • Posts: 6
    • View Profile
Seeking music files?
« on: August 16, 2008, 02:40:09 am »
Simply i want to know if will be a Seek function for sound streams.
Thank's for all!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #1 on: August 16, 2008, 10:27:35 am »
That's impossible, a stream is not loaded in memory.
Laurent Gomila - SFML developer

quasius

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Seeking music files?
« Reply #2 on: August 16, 2008, 02:24:35 pm »
Quote from: "Laurent"
That's impossible, a stream is not loaded in memory.


Why does that make it impossible?  Wouldn't that just make it take longer to go get the new chunk from the HD?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #3 on: August 16, 2008, 03:20:42 pm »
It could potentially be possible for sf::Music (if underlying libraries allow it), but definitively not at the SoundStream level.

I'll check that and let you know ;)
Laurent Gomila - SFML developer

SpartanJ

  • Newbie
  • *
  • Posts: 6
    • View Profile
Seeking music files?
« Reply #4 on: August 16, 2008, 06:21:18 pm »
Well, i'm talking about seeking a music file, like any music player, i didn't want to say to implement the seeking function on SoundStream class. And basically i need this for ogg files. So i think that it's possible.
Thank's for all!

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Seeking music files?
« Reply #5 on: August 16, 2008, 08:42:54 pm »
What is sf::SoundBuffer::GetSamples() for?

I thought it was for seeking through the samples to get information.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #6 on: August 16, 2008, 08:50:29 pm »
Quote
I thought it was for seeking through the samples to get information.

Yes it is. But it doesn't allow you to change the current playing position.
Laurent Gomila - SFML developer

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Seeking music files?
« Reply #7 on: August 16, 2008, 09:29:03 pm »
Ohh! That kind of seeking.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #8 on: August 17, 2008, 07:38:29 am »
Quote from: "Wizzard"
Ohh! That kind of seeking.

I guess that's what SpartanJ wants :)
Laurent Gomila - SFML developer

Limo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Seeking music files?
« Reply #9 on: July 29, 2010, 01:31:14 pm »
Hello,
any news about setting the current playing position?

For example I would like to invoke the "play" method with "from" and "to" parameters expressed in milliseconds.

Is this change in your thoughts?  :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #10 on: July 29, 2010, 01:39:17 pm »
It is already implemented in SFML 2 ;)
Laurent Gomila - SFML developer

Limo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Seeking music files?
« Reply #11 on: July 29, 2010, 02:18:56 pm »
Very well!  :D

I see that I can use SetPlayingOffset to define the "start" position but I can't find how to define the "end" position. I would like to play just a piece of music, not from "start" to the end of the file.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #12 on: July 29, 2010, 02:29:12 pm »
There's no direct way to do it, but you can watch the current playing position and stop the music as soon as it reaches the desired value.
Laurent Gomila - SFML developer

Limo

  • Newbie
  • *
  • Posts: 3
    • View Profile
Seeking music files?
« Reply #13 on: July 30, 2010, 07:58:42 pm »
Do you mean to use a thread and polling the current position?
This way the precision is limited to the polling time interval.
SFML should be "Simple"...  :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Seeking music files?
« Reply #14 on: July 30, 2010, 08:07:05 pm »
Quote
Do you mean to use a thread and polling the current position?

Kind of... ok, bad solution ;)
I'll see if there's an easier solution.

Quote
SFML should be "Simple"...

Simple for what it allows to do, it can't contain easy functions for every single feature that people want :P
Laurent Gomila - SFML developer

 

anything