Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Game.GetMusicPosition() starts with 2999...  (Read 6413 times)

0 Members and 1 Guest are viewing this topic.

Lebostein

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 16
    • View Profile
Game.GetMusicPosition() starts with 2999...
« 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
« Last Edit: March 30, 2008, 06:52:06 PM by Lebostein »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.GetMusicPosition() starts with 2999...
« Reply #1 on: March 30, 2008, 06:51:50 PM »

how often do you call the get music position?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Lebostein

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 16
    • View Profile
Re: Game.GetMusicPosition() starts with 2999...
« Reply #2 on: March 30, 2008, 06:52:54 PM »

every time in my game_loop.script...
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.GetMusicPosition() starts with 2999...
« Reply #3 on: March 30, 2008, 08:51:47 PM »

can you post a relevant script part?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.GetMusicPosition() starts with 2999...
« Reply #4 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...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

maze

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 59
  • Good news
    • View Profile
Re: Game.GetMusicPosition() starts with 2999...
« Reply #5 on: April 03, 2008, 03:59:52 PM »

Also in SetMusicPosition()?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.GetMusicPosition() starts with 2999...
« Reply #6 on: April 03, 2008, 04:28:23 PM »

No, SetMusicPosition() works ok.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Lebostein

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 16
    • View Profile
Re: Game.GetMusicPosition() starts with 2999...
« Reply #7 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.



Here is a small music file for testing: 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...
« Last Edit: December 09, 2008, 10:27:09 PM by Lebostein »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.GetMusicPosition() starts with 2999...
« Reply #8 on: December 10, 2008, 04:29:58 PM »

SetMusicPosition does work properly, GetMusicPosition doesn't.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Lebostein

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 16
    • View Profile
Re: Game.GetMusicPosition() starts with 2999...
« Reply #9 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?
« Last Edit: December 11, 2008, 08:10:19 AM by Lebostein »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.GetMusicPosition() starts with 2999...
« Reply #10 on: December 11, 2008, 10:09:50 AM »

you can always store the lookup values in an array.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.025 seconds with 18 queries.