File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed
Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -778,29 +778,29 @@ class Sound extends EventDispatcher
778778 return new ID3Info ();
779779 }
780780
781- @:noCompletion private function get_length (): Int
781+ @:noCompletion private function get_length (): Float
782782 {
783783 #if lime
784784 if (__buffer != null )
785785 {
786786 #if (js && html5 && howlerjs)
787- return Std . int ( __buffer .src .duration () * 1000 ) ;
787+ return __buffer .src .duration () * 1000 ;
788788 #else
789- if (__buffer .data != null )
789+ #if lime_funkin
790+ if (__buffer .decoder != null )
790791 {
791- var samples = ( __buffer .data . length * 8.0 ) / ( __buffer . channels * __buffer . bitsPerSample );
792- return Std . int (samples / __buffer .sampleRate * 1000 ) ;
792+ var samples : Int64 = __buffer .decoder . total ( );
793+ return ( samples . high * 4294967296.0 + (samples . low >>> 0 )) / __buffer .decoder . sampleRate * 1000 ;
793794 }
794- else if (__buffer .__srcVorbisFile != null )
795- {
796- var samples = Int64 .toInt (__buffer .__srcVorbisFile .pcmTotal ());
797- return Std .int (samples / __buffer .sampleRate * 1000 );
798- }
799- else
795+ #else
796+ if (__buffer .__srcVorbisFile != null )
800797 {
801- return 0 ;
798+ var samples : Int64 = __buffer .__srcVorbisFile .pcmTotal ();
799+ return (samples .high * 4294967296.0 + (samples .low >>> 0 )) / __buffer .sampleRate * 1000 ;
802800 }
803801 #end
802+ else if (__buffer .data != null ) return __buffer .data .length / (__buffer .bitsPerSample >> 3 ) / __buffer .channels / __buffer .sampleRate * 1000 ;
803+ #end
804804 }
805805 #end
806806
Original file line number Diff line number Diff line change @@ -339,7 +339,12 @@ import lime.utils.Int16Array;
339339
340340 if (__isValid )
341341 {
342- #if lime
342+ #if lime_funkin
343+ __audioSource .gain = volume ;
344+ __audioSource .pan = pan ;
345+
346+ return value ;
347+ #else
343348 __audioSource .gain = volume ;
344349
345350 var position = __audioSource .position ;
You can’t perform that action at this time.
0 commit comments