Author Topic: sound.duration do not work?  (Read 2246 times)

Josepzin

  • Jr. Member
  • **
  • Posts: 10
  • Habitacus!
    • View Profile
    • Blog
sound.duration do not work?
« on: September 11, 2017, 09:53:04 PM »
Get duration o get time do not work, but playing or file_name yes.

Example:
Code: [Select]
local player_sound = fe.add_sound( "D:\\insertcoin.mp3" );
player_sound.playing = true; // or player_sound.playing = false; --> OK
::print( player_sound.file_name ); // --> ok
::print( player_sound.duration ); // --> 0
::print( player_sound.time ); // --> 0

Any suggest??

Josepzin

  • Jr. Member
  • **
  • Posts: 10
  • Habitacus!
    • View Profile
    • Blog
Re: sound.duration do not work?
« Reply #1 on: September 12, 2017, 11:48:54 AM »
"Solved": player_sound.time );

When i start to play the sound (player_sound.playing    = true;) i store the actual tick and then substract this value to the real tick :)
« Last Edit: September 12, 2017, 08:15:52 PM by Josepzin »

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: sound.duration do not work?
« Reply #2 on: September 12, 2017, 01:17:46 PM »
"Solved": player_sound.time );

When i play the sound (player_sound.playing    = true;) i store the actual tick and then substract this value to the real tick :)

I couldn’t figure that shit out either. Good to know you figured out a work around.