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

Author Topic: OpenFromMemory  (Read 22181 times)

0 Members and 1 Guest are viewing this topic.

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
OpenFromMemory
« on: October 14, 2008, 04:27:42 am »
I don't know what I'm doing wrong with OpenFromMemory, but it won't work.

I read out the entire .ogg from memory into a char buffer and call OpenFromMemory with that buffer and the number of bytes read from memory.  When I try to play the sound it freezes my computer.

However, when I make an .ogg file out of what I have read and then play it, it works fine.

What am I doing wrong?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
OpenFromMemory
« Reply #1 on: October 14, 2008, 08:22:41 am »
Are you keeping the contents of your ogg file in memory while the music is playing ? sf::Music uses streaming, which means the source data is not copied but rather directly accessed several times while the music is playing.
Laurent Gomila - SFML developer

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
OpenFromMemory
« Reply #2 on: October 18, 2008, 03:57:00 am »
I wasn't at the time, but I figured out shortly after that that was probably what was happening.

I just made a struct to store the ogg contents and the music pointer.

Thank you.

 

anything