In the world of digital sound, data and format are invariably coupled. You cannot understand a data stream without an interpretation, and the format is that interpretation.
In the Sound gem, we have Device, Format, and Data objects. A Data has to have a Format for a Device to interpret it.
data = Data.new
data.format = Format.new
device = Device.new
device.interpret data
class Device
def interpret(data)
#given data.format, read data
end
end
A Device has no format, but it interprets Data given one.
No comments:
Post a Comment