PTPattern-method {ProTrackR} | R Documentation |
Coerce to or replace PTPattern
Description
This method will coerce a set of objects to a PTPattern
object. It can also
be used to select specific patterns from PTModule
objects and replace
the selected PTPattern
.
Usage
## S4 method for signature 'raw,missing'
PTPattern(x)
## S4 method for signature 'matrix,missing'
PTPattern(x)
## S4 method for signature 'PTModule,numeric'
PTPattern(x, pattern)
## S4 replacement method for signature 'PTModule,numeric,PTPattern'
PTPattern(x, pattern) <- value
Arguments
x |
Object (any of |
pattern |
When |
value |
An object of |
Details
Method to coerce x
to class PTPattern
.
When x
is a 64 by 16 matrix
of raw
data, each row
implicitly represents the PTCell
objects of each of the
four tracks. Each PTCell
consists of four raw
values. The values in each row are formatted accordingly, where the values of the
cells of each track are concatenated. See PTCell
documentation for
more details on the raw
format of a PTCell
object.
When x
is a 64 by 16 matrix
of character
representations
of PTCell
objects, the character
representation must be
conform the specifications as documented at the PTCell
.
When x
is of class PTModule
, the PTPattern
at the
specified index (pattern
) is returned, or can be replaced.
Value
When PTPattern
is used, a PTPattern
object
based on x
is returned.
When PTPattern<-
is used, object x
is returned in which
the selected PTPattern
is replaced with value
.
Author(s)
Pepijn de Vries
See Also
Other pattern.operations:
MODPlugToPTPattern()
,
PTPattern-class
,
PTPatternToMODPlug()
,
appendPattern()
,
deletePattern()
,
pasteBlock()
,
patternLength()
,
patternOrderLength()
,
patternOrder()
Examples
## This will create an 'empty' PTPattern with
## all 0x00 values, which is equivalent to
## new("PTPattern"):
PTPattern(as.raw(0x00))
## Create a PTPattern based on repeated
## PTCell character representations:
pat <- PTPattern(matrix("F#2 1A 20A", 64, 4))
data("mod.intro")
## Replace the first pattern in the patternOrder
## table in mod.intro with 'pat' (don't forget to
## add one (+1) to the index):
PTPattern(mod.intro,
patternOrder(mod.intro)[1] + 1) <- pat