Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Lebostein on March 30, 2008, 06:42:17 PM
-
When I examine the Game.GetMusicPosition() and no music is playing, I see "0", Ok. When I start music, the Game.GetMusicPosition() starts with "2999" (3 seconds) immediately. Why?
When I play a song with length 15000 one time, then Game.GetMusicPosition() returns:
2999......5000.....15000....0......2999
-
how often do you call the get music position?
-
every time in my game_loop.script...
-
can you post a relevant script part?
-
There are imprecisions in GetMusicPosition(), up to the size of the sound buffer. This is a known issue...
-
Also in SetMusicPosition()?
-
No, SetMusicPosition() works ok.
-
It don't work ...
add this code to your game.script (for example in the wme demo game, line 136):
else if(Keyboard.KeyCode == VK_F9)
{
var MusicPos1;
var MusicPos2;
MusicPos1 = Game.GetMusicPosition();
Game.PlayMusic("sounds\Strand_1.ogg", true);
Game.SetMusicPosition(MusicPos1); // ---- Here I set the position to MusicPos1
MusicPos2 = Game.GetMusicPosition(); // ---- After this I get the current position to MusicPos2
actor.Talk(ToString(MusicPos1) + " <> " + ToString(MusicPos2)); // ---- MusicPos1 and MusicPos2 should be the same
}
If you press F9, then the music jumps 2999 ms forward...why? It should be the same position before and after.
(http://www.lebostein.de/temp/WME_muspos.png)
Here is a small music file for testing: http://www.lebostein.de/temp/Strand_1.ogg (http://www.lebostein.de/temp/Strand_1.ogg)
This file was created by the ogg-export of Cubase SE 3... I hope the file is not corrupt... but the same problem I have with a generated wav-file.
I need this for an imuse system. At the moment it's impossible to jump between different music files with the same lenght...
-
SetMusicPosition does work properly, GetMusicPosition doesn't.
-
SetMusicPosition does work properly, GetMusicPosition doesn't.
Sorry I have read over your last post ("There are imprecisions in GetMusicPosition(), up to the size of the sound buffer. This is a known issue...")
OK, I understand... at the moment the GetMusicPosition() function is useless...
But, how can I handle this imprecisions? Can I set or get the size of the music buffer?
-
you can always store the lookup values in an array.