Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

appendPattern

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

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

Manipulate and Play 'ProTracker' Modules

v0.3.7
GPL-3
Authors
Pepijn de Vries [aut, cre, dtc]
Initial release
2020-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.