Learn R Programming

ProTrackR (version 0.4.4)

fix.PTModule: Attempt to fix PTModule to ProTracker specs

Description

Try to fix non-valid PTModule objects in order to meet with ProTracker specs such that they pass validity tests.

Usage

# S4 method for PTModule,logical
fix.PTModule(mod, verbose = TRUE)

# S4 method for PTModule,missing fix.PTModule(mod)

Value

Returns a copy of object mod in which all non-conformities are attempted to be fixed. (Attempted) fixes are listed printed in the progress report.

Arguments

mod

A PTModule object which needs fixing.

verbose

With the default value of TRUE, the method prints a progress report to the sink. When set to FALSE, the progress report is suppressed.

Author

Pepijn de Vries

Details

Almost any file can be read as a PTModule object (using read.module) when validity is ignored and no unexpected end of file is reached. This package's object validity are very strictly testing for compliance with ProTracker specifications. As many modules could have been created with other trackers (which often will play just as well in ProTracker) it is desirable to convert such object to ProTracker specs. This method attempts to do so, by fixing each aspect, that is also tested in the object validity functions. Note that the attempts are no guarantee for success, and `fixed' modules may not play as intended.

See Also

Other module.operations: PTModule-class, appendPattern(), clearSamples(), clearSong(), deletePattern(), modToWave(), moduleSize(), patternLength(), patternOrderLength(), patternOrder(), playMod(), playingtable(), rawToPTModule(), read.module(), trackerFlag(), write.module()

Examples

Run this code
data("mod.intro")

## Let's do something illegal and destroy mod.intro:
mod.intro@pattern.order <- mod.intro@pattern.order[1:9]

## We should have used the 'patternOrder'-method to
## change the pattern order. Now we have broken the
## object:
validObject(mod.intro, TRUE)

## No worries, we can fix it:
mod.intro <- fix.PTModule(mod.intro)

## See, it's all OK again:
validObject(mod.intro, FALSE)

Run the code above in your browser using DataLab