summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-12-28 16:09:18 +0100
committerPixel <pixel@nobis-crew.org>2009-12-28 16:11:08 +0100
commit3389b6abdab512ff3e03c080f95d0a3ffe1db097 (patch)
tree4eec62984dc151aabb50e6e67a53e6dd4a8af412
parent9e6429099d53b850862ed4cfcf22ac1b8c332437 (diff)
Adding cd-reader.
-rw-r--r--dalos-cd.lua49
-rw-r--r--dalos.lua1
2 files changed, 50 insertions, 0 deletions
diff --git a/dalos-cd.lua b/dalos-cd.lua
new file mode 100644
index 0000000..cb0b6a7
--- /dev/null
+++ b/dalos-cd.lua
@@ -0,0 +1,49 @@
+loadmodule "luacd"
+
+dalosp.cd = {
+ get_settings = function (self)
+ return { filename = self.extra.filename }
+ end,
+
+ configure = function (self)
+ local drives_list = self.extra.drives_list
+ local list = ""
+ for i, v in ipairs(drives_list) do
+ list = list .. v .. "|"
+ end
+ local s, id = iup.GetParam("CD drive", nil, "CD drive: %l|" .. list .. "\n", 0)
+
+ if s then
+ self.extra.filename = "cd:" .. drives_list[id + 1]
+ local s, v = pcall(cdabstract, self.extra.filename)
+ if s then
+ self:set_houtput(v)
+ return
+ end
+ end
+ self:set_houtput(nil)
+ end,
+
+ create = function (d, tab, settings)
+ tab.ninputs = 0
+ tab.noutputs = 1
+ tab.otype = dalos.objtype.HANDLE
+ tab.configure = dalosp.cd.configure
+ tab.default_name = "CD"
+ tab.ntype = "CD"
+ tab.get_settings = dalosp.cd.get_settings
+ local extra = { drives_list = cdprobe() }
+ if settings then extra.filename = settings.filename end
+ local obj = dalos.object(d, tab, extra)
+
+ if extra.filename then
+ local s, v = pcall(cdabstract, extra.filename)
+ if s then obj:set_houtput(v) end
+ end
+
+ return obj
+ end,
+}
+
+dalos.cd = dalosp.cd.create
+dalos:register_obj("CD", dalos.cd, "Basic Inputs")
diff --git a/dalos.lua b/dalos.lua
index c0235cc..68dd7a2 100644
--- a/dalos.lua
+++ b/dalos.lua
@@ -1086,6 +1086,7 @@ load "dalos-buffer.lua"
load "dalos-luafilter.lua"
load "dalos-struct.lua"
load "dalos-textview.lua"
+load "dalos-cd.lua"
----------------