PTCell-method {ProTrackR} | R Documentation |
Coerce to or replace PTCell
Description
This method will coerce a set of objects to a PTCell
object. It can also
be used to select specific cells from PTModule
,
PTPattern
and PTTrack
objects and replace
the selected PTCell
.
Usage
## S4 method for signature 'raw,missing,missing,missing'
PTCell(x)
## S4 method for signature 'character,missing,missing,missing'
PTCell(x)
## S4 method for signature 'PTModule,numeric,numeric,numeric'
PTCell(x, row, track, pattern)
## S4 replacement method for signature 'PTModule,numeric,numeric,numeric,PTCell'
PTCell(x, row, track, pattern) <- value
## S4 method for signature 'PTPattern,numeric,numeric,missing'
PTCell(x, row, track)
## S4 replacement method for signature 'PTPattern,numeric,numeric,missing,PTCell'
PTCell(x, row, track) <- value
## S4 method for signature 'PTTrack,numeric,missing,missing'
PTCell(x, row)
## S4 replacement method for signature 'PTTrack,numeric,missing,missing,PTCell'
PTCell(x, row) <- value
Arguments
x |
Object (any of |
row |
When |
track |
When |
pattern |
When |
value |
An object of |
Details
Method to coerce x
to class PTCell
.
When x
is raw
data, it should consist of a vector
of
4 elements, formatted as specified in the PTCell
.
When x
is a character
string, it should be formatted as follows:
"NNO SS EEE
", where NN
is the note (for instance
"C-" or "A#", where the dash has no particular meaning and may be omitted,
the hash sign indicates a sharp note). Use a dash if the cell holds no note.
O
is the octave (with a value of 0, or a dash, if a note
is missing, otherwise any of 1, 2 or 3). SS
is the sample index
number, formatted as two hexadecimal digits (for example 1A
). EEE
is
a three hexadecimal digit effect
or trigger code (for more details see the
PTCell
). The method is not case sensitive, so
you can use both upper and lower case. White spaces are ignored, you can use
as many as you would like. A correct character
input for x
would be for example: "A#2 01 A0F"
. A blank
character
representation would look like this: "--- 00 000"
.
When x
is of class PTTrack
, PTPattern
, or
PTModule
, the PTCell
at the specified indices (row
,
track
and pattern
) is returned, or can be replaced.
Value
When PTCell
is used, a PTCell
object
based on x
is returned.
When PTCell<-
is used, object x
is returned in which
the selected PTCell
is replaced with value
.
Author(s)
Pepijn de Vries
See Also
Other cell.operations:
PTCell-class
,
effect()
,
note()
,
sampleNumber()
Examples
## This will create an empty PTCell (equivalent
## to new("PTCell"):
PTCell(raw(4))
## Use a character representation to create
## a new PTCell object. A cell with note
## B in octave 2, sample number 10 and with
## effect '105':
cell <- PTCell("B-2 0A 105")
data("mod.intro")
## replace PTCell at pattern number 1, track
## number 2, and row number 3:
PTCell(mod.intro, 3, 2, 1) <- cell