Posted 06 July 2012 - 02:42 PM
Well dan200, genius as he is. He cannot determine when the music stops.
As for me, I don't really want to listen to all this.
So this is where you come in!
Just run this program next to a disk drive with a music disk in it.
And time it with the spacebar!
Then make a note for each music disk.
Then when you are sure you have the exact times for each music disk, Just post back in here with it :P/>/>
I'm more then happy to make a API which would use this.
But you can do it easily as well.
Just have
Except the titles will have the be the same as the ones that computer fetches with disk.getAudioTitle(side)
As for me, I don't really want to listen to all this.
So this is where you come in!
Just run this program next to a disk drive with a music disk in it.
And time it with the spacebar!
Then make a note for each music disk.
Then when you are sure you have the exact times for each music disk, Just post back in here with it :P/>/>
I'm more then happy to make a API which would use this.
But you can do it easily as well.
Just have
getAudioTime(Title)
if Title == mellohi then return 40
elseif Title == 13 then return 20
end
You get the idea :)/>/>Except the titles will have the be the same as the ones that computer fetches with disk.getAudioTitle(side)
--Time music
function Clear()
term.clear()
term.setCursorPos(1,1)
end
function Check()
for _,side in ipairs(rs.getSides()) do
if disk.hasAudio(side) then
return side
end
end
end
function Time(Side)
local Timed = nil
Clear()
print("Press spacebar to start timing, I will play the disk "..disk.getAudioTitle(Side).." at "..Side)
while true do
event,param1,param2 = os.pullEvent()
if event == "key" then
if param1 == 57 then
if Timed == nil then
print("Recording")
Timed = 0
Tenth = os.startTimer(0.1)
disk.playAudio(Side)
else
print("Stopped recording, disk "..disk.getAudioTitle(Side).." was "..Timed.." seconds long")
Tenth = os.startTimer(0)
end
end
elseif event == "timer" and param1 == Tenth then
Timed = (Timed+.1)
Tenth = os.startTimer(0.1)
end
end
end
local Status = "Go"
repeat
if Check() then
Side = Check()
Clear()
for n=1,5 do -- Dont judge me!
print()
end
print(string.rep("-", 49))
print("Music disk \""..disk.getAudioTitle(Side).."\" found at side "..Side)
print(string.rep("-", 49))
print("Do you want to play and time this disk? Press \"T\"")
print(string.rep("-", 49))
print("You can always check again with \"C\"")
print(string.rep("-", 49))
print("\"Q\" to quit")
print(string.rep("-", 49))
while true do
event,param1 = os.pullEvent()
if event == "char" then
if param1 == "t" then
Time(Side)
elseif param1 == "q" then
Status = "Stop"
break
elseif param1 == "c" then
break
end
end
end
else
Clear()
print("No music disk found")
os.pullEvent()
end
until Status == "Stop"