Search Results

Search found 1 results on 1 pages for 'teflo'.

Page 1/1 | 1 

  • How to loop section from a song correctly?

    - by Teflo
    I'm programming a little Music Engine for my game in C# and XNA, and one aspect from it is the possibility to loop a section from a song. For example, my song has an intropart, and when the song reached the end ( or any other specific point ), it jumps back where the intropart is just over. ( A - B - B - B ... ) Now I'm using IrrKlank, which is working perfectly, without any gaps, but I have a problem: The point where to jump back is a bit inaccurate. Here's some example code: public bool Passed(float time) { if ( PlayPosition >= time ) return true; return false; } //somewhere else if( song.Passed( 10.0f ) ) song.JumpTo( 5.0f ); Now the problem is, the song passes the 10 seconds, but play a few milliseconds until 10.1f or so, and then jumps to 5 seconds. It's not that dramatic, but very incorrect for my needs. I tried to fix it like that: public bool Passed( float time ) { if( PlayPosition + 3 * dt >= time && PlayPosition <= time ) return true; return false; } ( dt is the delta time, the elapsed time since the last frame ) But I don't think, that's a good solution for that. I hope, you can understand my problem ( and my english, yay /o/ ) and help me :)

    Read the article

1