appendPattern: Append a PTPattern to a PTModule

appendPatternR Documentation

Append a PTPattern to a PTModule

Description

Appends a specified PTPattern to a PTModule.

Usage

## S4 method for signature 'PTModule,PTPattern'
appendPattern(x, pattern)

Arguments

x

A PTModule object to which a PTPattern is to be appended.

pattern

A PTPattern object which is to be appended to the PTModule x.

Details

Depending on the trackerFlag, a ProTracker module can hold either 64 or 100 pattern tables. As long as the number of pattern tables is below this maximum, new pattern tables can be added to the module with this function.

The patternOrder table should hold the maximum index of the available pattern tables in a module, otherwise, the module is not valid. As the maximum index increases, by appending a pattern table, the patternOrder table should be updated. The appendPattern method does this automatically, by replacing the first non-unique index in the order table, outside the current order table's length, with the new maximum index. If this is not possible, the highest element in the order table is set to hold the maximum index.

Value

Returns a PTModule, to which the PTPattern is appended.

Note

As per ProTracker specification, the pattern indices stored in the PTModule and obtained with patternOrder start at 0. Whereas R starts indexing at 1. Beware of this discrepancy.

Author(s)

Pepijn de Vries

See Also

Other pattern.operations: MODPlugToPTPattern(), PTPattern-class, PTPattern-method, PTPatternToMODPlug(), deletePattern(), pasteBlock(), patternLength(), patternOrderLength(), patternOrder()

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

Examples

data("mod.intro")

## append an empty pattern to mod.intro

mod.intro <- appendPattern(mod.intro, new("PTPattern"))

## append a copy of pattern # 1 (this is pattern #0 in the
## patternOrder table) to mod.intro

mod.intro <- appendPattern(mod.intro, PTPattern(mod.intro, 1))


ProTrackR documentation built on Aug. 23, 2023, 1:07 a.m.