Skip to contents

This method treats a vector of raw data as if it where a file, and converts it into a PTModule object.

Usage

# S4 method for raw
rawToPTModule(x, ignore.validity = F)

Arguments

x

A vector of raw data, conform ProTracker file specs.

ignore.validity

A logical value. When set as TRUE this method will attempt to decode the raw data (x), even when it is invalid. When set to FALSE (default) validity is checked and an error is thrown when invalidity occurs.

Value

returns a PTModule object.

Details

Data is read from a vector of raw data as if it where a file and converted into a PTModule object. This method can be useful for module files stored on virtual Amiga Disk Files (adf), which can be read as raw data, using the AmigaFFH package.

Use as.raw to achieve the inverse.

Author

Pepijn de Vries

Examples

if (FALSE) {
## convert the example mod into raw data
data("mod.intro")
mod.raw <- as.raw(mod.intro)

## restore it as a PTModule-class object
mod.restored <- rawToPTModule(mod.raw)

## In this case the result is identical to the original:
identical(mod.restored, mod.intro)
}