Skip to content

ISampleTools

#include "crosspad/sampletools/ISampleTools.hpp"

Generated from crosspad/sampletools/ISampleTools.hpp in crosspad-core. Edit the header’s doxygen comments to change this page.

What a take records.

ValueValueDescription
Micthe built-in microphones
Linethe line-in jack
Padswhat the pads play: a resample, digital, no codec in the way
Usbwhat the computer plays into the board over USB audio, before the mixer’s fader
PitchA Pitch Play instrument on the pads.

Declared in crosspad/sampletools/ISampleTools.hpp:13.

Where a file job (listing, overview, saving, export) is.

ValueValueDescription
Idle
Busy
Ready
Failed

Declared in crosspad/sampletools/ISampleTools.hpp:31.

FieldTypeDescription
recordingbool
framesuint32_twritten so far, or the length of the last take
sampleRateuint32_t
filestd::stringfull path of the take being written or last written
errorstd::stringwhy the last take failed; empty when it did not
withSongboollined up with the song: frame 0 is bar fromBar
fromBaruint32_t
waitingboolarmed with the song, which has not sounded yet

Declared in crosspad/sampletools/ISampleTools.hpp:33.

A picture of part of a WAV: min/max per column for drawing, and a level envelope for finding the hits (see SliceMath).

FieldTypeDescription
filestd::string
framesuint32_tthe whole file
sampleRateuint32_t
startuint32_t
enduint32_tthe range the columns cover
lostd::vector< int8_t >
histd::vector< int8_t >per column, -127..127
hopuint32_tframes per envelope value, from start
envelopestd::vector< uint8_t >level per hop, SliceMath::kEnvDbPerStep dB a step

Declared in crosspad/sampletools/ISampleTools.hpp:46.

A folder on the card as the tools list it: its folders, then its WAVs, each by name.

The names are one block of text, not a string each, which keeps large folders cheap to list.

FieldTypeDescription
kMaxEntriesconstexpr size_t
pathstd::stringthe folder listed, full path
namesstd::stringevery name, each ended by ‘\0’
offsetsstd::vector< uint32_t >where each name starts in names
foldersuint32_tthe first folders names are folders
truncatedboolmore than kMaxEntries: the rest is not listed

Members

MemberDescription
size
name
isFolder

Methods

size_t size() const
const char * name(size_t i) const
bool isFolder(size_t i) const

Declared in crosspad/sampletools/ISampleTools.hpp:60.

A sliced loop to write as a kit: slice i is [starts[i], starts[i+1]), the last one ends at end.

At most 16, one per pad.

FieldTypeDescription
sourcestd::stringfull path of the WAV
namestd::stringthe kit’s folder and name
startsstd::vector< uint32_t >sorted
enduint32_t
bpmuint16_t0 = not known
attackMsuint16_tevery slice’s rise (SliceMath::attackFrames)
semitonesint8_tevery slice transposed, varispeed (SliceMath::pitchRatio)

Declared in crosspad/sampletools/ISampleTools.hpp:74.

How a preview sounds: transposed, filtered, and/or as a kit’s slice.

FieldTypeDescription
semitonesint8_tvarispeed, -12..+12 (SliceMath::pitchRatio)
sliceboolrising over attackMs, with the slice’s fades (SliceMath::sliceGain)
attackMsuint16_t
hpHzuint16_thigh pass, 0 = off (SampleFilters)
lpHzuint16_tlow pass, 0 = off
reverseboolfrom end to start; previewFrame() then runs backwards

Declared in crosspad/sampletools/ISampleTools.hpp:85.

Recording, looking at and cutting samples: the platform’s side of the Recorder and the Slicer.

The card is never waited for. File work is a request that returns at once; job() says when it is done and jobResult() what came of it. One job at a time: a request while one runs is refused. Recording and preview are realtime and run beside the jobs.

Members

MemberDescription
selectInputListen to in: peaks() meters it and the next take records it.
input
inputAvailableWhether in has anything to record right now USB only while the board is in its USB audio profile.
peaksPeaks of the selected input since the last call, 0..1.
startRecordingA new take in the recordings folder, stereo, at the engine’s rate.
startRecordingWithSongA take lined up with the song engine: armed, then the song played from fromBar.
startRecordingWithSongThe same after countInBeats of count-in (ISongEngine::playCountedIn): frame 0 is still the song’s first, on the beat after the last click.
stopRecording
recStatus
releaseInputThe app is closing: stop metering and put the codec input back.
requestRecordings
recordingsFull paths from the recordings folder, newest name first.
requestOverviewColumns and envelope of [start, end) of file; end 0 = to its end.
overview
requestFolderList dir any folder on the card; "" for the recordings folder.
folderThe last finished listing.
cardRootThe card’s top: a listing never goes above it.
requestSaveRegion[start, end) of file as a new file in the recordings folder, wherever file is; jobResult() is its path.
requestExportKitThe slices as a kit on the card, in the kit list at once when there is room; jobResult() is the kit’s name, or why it failed.
requestRenderedThe whole of file played with fx transposed (varispeed, SliceMath::readPitched), then filtered (SampleFilters) into out, written beside it and swapped in so nothing ever reads half a file; an out already there is kept.
job
jobResult
jobProgresspercent
previewPlay [start, end) of file (end 0 = to its end), once or looped.
previewAspreview() shaped as sound says what a kit made with the same settings plays.
stopPreview
previewing
previewFrameThe frame of the file being heard now.
setHandoffA file and the loop marked in it, for the next screen that asks.
takeHandoffTakes it: true once per setHandoff().

Methods

virtual bool selectInput(RecInput in) = 0

Listen to in: peaks() meters it and the next take records it.

The codec input it needs is switched now, and given back by releaseInput().

virtual RecInput input() const =0
virtual bool inputAvailable(RecInput in) const

Whether in has anything to record right now USB only while the board is in its USB audio profile.

virtual void peaks(float &left, float &right) = 0

Peaks of the selected input since the last call, 0..1.

virtual bool startRecording() = 0

A new take in the recordings folder, stereo, at the engine’s rate.

virtual bool startRecordingWithSong(uint32_t fromBar)

A take lined up with the song engine: armed, then the song played from fromBar.

Frame 0 of the take is what came in with the song’s first frame, the delay through the codecs taken off, so the take sits on the song’s bars from fromBar on; nothing before it is kept. stopRecording() stops the song with the take.

virtual bool startRecordingWithSong(uint32_t fromBar, uint8_t countInBeats)

The same after countInBeats of count-in (ISongEngine::playCountedIn): frame 0 is still the song’s first, on the beat after the last click.

virtual void stopRecording() = 0
virtual RecStatus recStatus() = 0
virtual void releaseInput() = 0

The app is closing: stop metering and put the codec input back.

virtual bool requestRecordings() = 0
virtual std::vector< std::string > recordings() = 0

Full paths from the recordings folder, newest name first.

virtual bool requestOverview(const std::string &file, uint32_t start, uint32_t end, uint16_t columns) = 0

Columns and envelope of [start, end) of file; end 0 = to its end.

virtual WaveOverview overview() = 0
virtual bool requestFolder(const std::string &dir)

List dir any folder on the card; "" for the recordings folder.

virtual CardFolder folder()

The last finished listing.

virtual std::string cardRoot() const

The card’s top: a listing never goes above it.

virtual bool requestSaveRegion(const std::string &file, uint32_t start, uint32_t end) = 0

[start, end) of file as a new file in the recordings folder, wherever file is; jobResult() is its path.

virtual bool requestExportKit(const SliceKit &kit) = 0

The slices as a kit on the card, in the kit list at once when there is room; jobResult() is the kit’s name, or why it failed.

virtual bool requestRendered(const std::string &file, const std::string &out, const SampleFx &fx)

The whole of file played with fx transposed (varispeed, SliceMath::readPitched), then filtered (SampleFilters) into out, written beside it and swapped in so nothing ever reads half a file; an out already there is kept.

jobResult() is out. What a sampler pad with pitch or filters plays (renderedSamplePath()).

virtual ToolJob job() const =0
virtual std::string jobResult() = 0
virtual uint8_t jobProgress() const =0

percent

virtual bool preview(const std::string &file, uint32_t start, uint32_t end, bool loop) = 0

Play [start, end) of file (end 0 = to its end), once or looped.

virtual bool previewAs(const std::string &file, uint32_t start, uint32_t end, bool loop, const PreviewSound &sound)

preview() shaped as sound says what a kit made with the same settings plays.

previewFrame() stays in the file’s frames whatever the pitch. A platform without it plays it plain.

virtual void stopPreview() = 0
virtual bool previewing() const =0
virtual uint32_t previewFrame() const =0

The frame of the file being heard now.

virtual void setHandoff(const std::string &file, uint32_t start, uint32_t end) = 0

A file and the loop marked in it, for the next screen that asks.

virtual bool takeHandoff(std::string &file, uint32_t &start, uint32_t &end) = 0

Takes it: true once per setHandoff().

Declared in crosspad/sampletools/ISampleTools.hpp:101.