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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - greenshoe

Pages: [1]
1
Audio / Re: sf::Music loop point implementation problem
« on: August 31, 2013, 10:18:02 pm »
I think I've found the reason why it's not working.

In onGetData, when i change data.sampleCount, I do not take into consideration that onGetData expects a sample count that is in accordance with the channel count of the song. I made a dirty quick fix and it worked like a charm:

Code: [Select]
while (data.sampleCount % this->getChannelCount() != 0)
{
    data.sampleCount++;
}

I'll need to get back to fixing the underlying problem though lol. Thanks for the help eXpl0it3r.

2
Audio / Re: sf::Music loop point implementation problem
« on: August 31, 2013, 09:33:03 pm »
As mentioned in my first post, I'm trying to override sf::Music to support music loop points. The term loop points are usually used in music composing software (eg. Propellerhead Reason). A lot of games also have this feature. Say for instance that you have a song that has an intro and a main theme. In some cases, to create a little extra dynamic flow, you only want to play the intro once, then repeat the main theme over and over (eg. until either you or the boss dies). There are a lot of songs that start out weak and fragile, but picks up and turns into a steady rock and roll beat;D It would certainly be a mood killer if, in the midst of battle, when all the rage is built up and the song simply restarted playing the fragile beginning. Loop points solves this problem since you can have the part with intensity repeated and the intro only played once. Back in 2010, a user requested this be added to the sf::Music class:

http://en.sfml-dev.org/forums/index.php?topic=2957.0

As far as I can see, this feature hasn't been added yet. However, Laurent suggested it could be implemented using the code in this post:

http://en.sfml-dev.org/forums/index.php?topic=2957.msg19539#msg19539

As you can see, that's nearly the same code as what I currently have. I pretty much copy-pasted the whole of that code, but changed the variable names.

3
Audio / sf::Music loop point implementation problem
« on: August 31, 2013, 03:29:35 pm »
Hi,

I've been trying to implement loop points by overriding onGetData and onSeek virtual functions of sf::Music. Long story short, something is wrong.

It seems, whenever I can hear the loop fail the following has been printed in my console window (2ish seconds earlier):

Quote
An internal OpenAL call failed in SoundStream.cpp (327) : AL_INVALID_VALUE, a numeric argument is out of range

I've tried my best to compose a minimal and complete example. I'm hoping one of you guys can help me point out what I'm doing wrong here. I'm using Visual Studio 2012 32-bit on Windows 7.

In my code, begin by scrolling down to the main() function (last function in the main.cpp file). I've written a few comments there on tests I've tried out. Here are the files:

http://www.greenshoe-magic.net/main.cpp
http://www.greenshoe-magic.net/smartguy.wav


Pages: [1]