The API used to have some un-exposed features, but you’re right. The docs do not elaborate on how to determine the current position you are at in a song.
There used to be some unexposed OpenAL features, but they were never supported officially and I think they may be dead. NOT DEAD (see my posts below.)
That said, here is a code snippet to give you a starting point to research them (supply your own audio file):
local song = audio.loadStream( "Dub Eastern.mp3" ) print(song) local channel, source = audio.play( song ) print("Channel: " .. tostring(channel) ) print("Source: " .. tostring(source) ) for k,v in pairs( al ) do print( k, v) end --al.Source(source, al.PITCH, 1.5) -- Crashes?
That prints out this:
10:02:49.432 Channel: 1 10:02:49.432 Source: 177221568 10:02:49.432 GetEnumValue function: 0A8CC6E0 10:02:49.432 BITS 8194 10:02:49.432 VENDOR 45057 10:02:49.432 DIRECTION 4101 10:02:49.432 DISTANCE\_MODEL 53248 10:02:49.432 FALSE 0 10:02:49.432 GetError function: 0A8CC7C0 10:02:49.432 TRUE 1 10:02:49.432 INVERSE\_DISTANCE 53249 10:02:49.432 BUFFERS\_PROCESSED 4118 10:02:49.432 SOURCE\_TYPE 4135 10:02:49.432 IsEnabled function: 0A8CC580 10:02:49.432 FORMAT\_MONO16 4353 10:02:49.432 GetSource function: 0A8CC6A0 10:02:49.432 PLAYING 4114 10:02:49.432 FORMAT\_STEREO8 4354 10:02:49.432 INVALID\_OPERATION 40964 10:02:49.432 CONE\_OUTER\_ANGLE 4098 10:02:49.432 MIN\_GAIN 4109 10:02:49.432 FORMAT\_MONO8 4352 10:02:49.432 MAX\_DISTANCE 4131 10:02:49.432 DistanceModel function: 0A8CC800 10:02:49.432 DOPPLER\_FACTOR 49152 10:02:49.432 SIZE 8196 10:02:49.432 Source function: 0A8CC5E0 10:02:49.432 SOURCE\_STATE 4112 10:02:49.432 Enable function: 0A8CC680 10:02:49.432 FREQUENCY 8193 10:02:49.432 \_VERSION 1.1 10:02:49.432 INVERSE\_DISTANCE\_CLAMPED 53250 10:02:49.432 MAX\_GAIN 4110 10:02:49.432 ROLLOFF\_FACTOR 4129 10:02:49.432 VERSION 45058 10:02:49.432 DopplerVelocity function: 0A8CC840 10:02:49.432 SpeedOfSound function: 0A8CC7A0 10:02:49.432 STOPPED 4116 10:02:49.432 EXPONENT\_DISTANCE\_CLAMPED 53254 10:02:49.432 IsExtensionPresent function: 0A8CC720 10:02:49.432 VELOCITY 4102 10:02:49.432 SPEED\_OF\_SOUND 49155 10:02:49.432 EXPONENT\_DISTANCE 53253 10:02:49.432 GAIN 4106 10:02:49.432 LINEAR\_DISTANCE\_CLAMPED 53252 10:02:49.432 DopplerFactor function: 0A8CC6C0 10:02:49.432 LINEAR\_DISTANCE 53251 10:02:49.432 CHANNELS 8195 10:02:49.432 STATIC 4136 10:02:49.432 SEC\_OFFSET 4132 10:02:49.432 NONE 0 10:02:49.432 FORMAT\_STEREO16 4355 10:02:49.432 STREAMING 4137 10:02:49.432 RENDERER 45059 10:02:49.432 OUT\_OF\_MEMORY 40965 10:02:49.432 ILLEGAL\_ENUM 40962 10:02:49.432 SAMPLE\_OFFSET 4133 10:02:49.432 ILLEGAL\_COMMAND 40964 10:02:49.432 INVALID\_VALUE 40963 10:02:49.432 UNDETERMINED 4144 10:02:49.432 INVALID\_NAME 40961 10:02:49.432 PAUSED 4115 10:02:49.432 DOPPLER\_VELOCITY 49153 10:02:49.432 INVALID -1 10:02:49.432 GetListener function: 0A8CC760 10:02:49.432 BYTE\_OFFSET 4134 10:02:49.432 LOOPING 4103 10:02:49.432 POSITION 4100 10:02:49.432 Listener function: 0A8CC540 10:02:49.432 Disable function: 0A8CC620 10:02:49.432 BUFFERS\_QUEUED 4117 10:02:49.432 CONE\_INNER\_ANGLE 4097 10:02:49.432 BUFFER 4105 10:02:49.432 NO\_ERROR 0 10:02:49.432 CONE\_OUTER\_GAIN 4130 10:02:49.432 SOURCE\_RELATIVE 514 10:02:49.432 REFERENCE\_DISTANCE 4128 10:02:49.432 EXTENSIONS 45060 10:02:49.432 INITIAL 4113 10:02:49.432 PITCH 4099 10:02:49.432 ORIENTATION 4111