Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Lebostein on March 30, 2008, 06:42:17 PM

Title: Game.GetMusicPosition() starts with 2999...
Post 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
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: metamorphium on March 30, 2008, 06:51:50 PM
how often do you call the get music position?
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Lebostein on March 30, 2008, 06:52:54 PM
every time in my game_loop.script...
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: metamorphium on March 30, 2008, 08:51:47 PM
can you post a relevant script part?
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Mnemonic on April 03, 2008, 11:15:22 AM
There are imprecisions in GetMusicPosition(), up to the size of the sound buffer. This is a known issue...
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: maze on April 03, 2008, 03:59:52 PM
Also in SetMusicPosition()?
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Mnemonic on April 03, 2008, 04:28:23 PM
No, SetMusicPosition() works ok.
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Lebostein on December 09, 2008, 09:08:24 PM
It don't work ...

add this code to your game.script (for example in the wme demo game, line 136):

Code: [Select]
  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...
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Mnemonic on December 10, 2008, 04:29:58 PM
SetMusicPosition does work properly, GetMusicPosition doesn't.
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: Lebostein on December 11, 2008, 08:02:42 AM
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?
Title: Re: Game.GetMusicPosition() starts with 2999...
Post by: metamorphium on December 11, 2008, 10:09:50 AM
you can always store the lookup values in an array.