Skip to content

Commit

Permalink
exp: add duration to sounds table
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Nov 12, 2024
1 parent c71c805 commit c22df7f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Misc/qs_pak/scripts/expmode_engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ local function sounds_onupdate(self)
imTableSetupScrollFreeze(0, 1)
imTableSetupColumn('Index', imTableColumnWidthFixed)
imTableSetupColumn('Name')
imTableSetupColumn('Duration', imTableColumnWidthFixed)
imTableSetupColumn('Size', imTableColumnWidthFixed)
imTableHeadersRow()

Expand All @@ -428,6 +429,8 @@ local function sounds_onupdate(self)
imTableNextColumn()
imText(entry.name)
imTableNextColumn()
imText(entry.duration)
imTableNextColumn()
imText(entry.size)
end

Expand All @@ -444,12 +447,16 @@ local function sounds_onshow(self)
local entries = {}

for i, sound in ipairs(sounds) do
local framecount = sound.framecount
local framerate = sound.framerate
local duration = (framecount and framerate and framerate ~= 0) and (framecount / framerate)
local soundsize = sound.size
local entry =
{
index = tostring(i),
name = sound.name,
size = soundsize and tostring(soundsize) or '<not loaded>',
duration = duration and format('%.3f', duration) or '-',
size = soundsize and tostring(soundsize) or '-',
}
insert(entries, entry)
end
Expand Down

0 comments on commit c22df7f

Please sign in to comment.