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 class 'raw,missing,missing,missing'
PTCell(x)
# S4 method for class 'character,missing,missing,missing'
PTCell(x)
# S4 method for class 'PTModule,numeric,numeric,numeric'
PTCell(x, row, track, pattern)
# S4 method for class 'PTModule,numeric,numeric,numeric,PTCell'
PTCell(x, row, track, pattern) <- value
# S4 method for class 'PTPattern,numeric,numeric,missing'
PTCell(x, row, track)
# S4 method for class 'PTPattern,numeric,numeric,missing,PTCell'
PTCell(x, row, track) <- value
# S4 method for class 'PTTrack,numeric,missing,missing'
PTCell(x, row)
# S4 method for class 'PTTrack,numeric,missing,missing,PTCell'
PTCell(x, row) <- valueArguments
- x
Object (any of
rawdata, acharacterstring, aPTTrack, aPTPatternor aPTModule) to coerce to aPTCell. See details below for the required format ofx.- row
When
xis aPTTrack, aPTPattern, or aPTModule, provide an index [1,64] of the row that needs to be coerced to aPTCell.- track
When
xis aPTPattern, or aPTModule, provide an index [1,4] of the track that needs to be coerced to aPTCell.- pattern
When
xis aPTModule, provide an index of the pattern that needs to be coerced to aPTCell. Note that ProTracker uses indices for patterns that start at zero, whereas R uses indices that start at one. Hence add one to an index obtained from aPTModuleobject (e.g.,x$pattern.order)- value
An object of
PTCellwith which thePTCellobject at the specified indices in objectxneeds to 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.
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.
See also
Other cell.operations:
PTCell-class,
effect(),
note(),
sampleNumber()
Examples
## This will create an empty PTCell (equivalent
## to new("PTCell"):
PTCell(raw(4))
#> [1] "--- 00 000"
## 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