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.
RecInput
Section titled “RecInput”What a take records.
| Value | Value | Description |
|---|---|---|
Mic | the built-in microphones | |
Line | the line-in jack | |
Pads | what the pads play: a resample, digital, no codec in the way | |
Usb | what the computer plays into the board over USB audio, before the mixer’s fader | |
Pitch | A Pitch Play instrument on the pads. |
Declared in crosspad/sampletools/ISampleTools.hpp:13.
ToolJob
Section titled “ToolJob”Where a file job (listing, overview, saving, export) is.
| Value | Value | Description |
|---|---|---|
Idle | ||
Busy | ||
Ready | ||
Failed |
Declared in crosspad/sampletools/ISampleTools.hpp:31.
crosspad::RecStatus
Section titled “crosspad::RecStatus”| Field | Type | Description |
|---|---|---|
recording | bool | |
frames | uint32_t | written so far, or the length of the last take |
sampleRate | uint32_t | |
file | std::string | full path of the take being written or last written |
error | std::string | why the last take failed; empty when it did not |
withSong | bool | lined up with the song: frame 0 is bar fromBar |
fromBar | uint32_t | |
waiting | bool | armed with the song, which has not sounded yet |
Declared in crosspad/sampletools/ISampleTools.hpp:33.
crosspad::WaveOverview
Section titled “crosspad::WaveOverview”A picture of part of a WAV: min/max per column for drawing, and a level envelope for finding the hits (see SliceMath).
| Field | Type | Description |
|---|---|---|
file | std::string | |
frames | uint32_t | the whole file |
sampleRate | uint32_t | |
start | uint32_t | |
end | uint32_t | the range the columns cover |
lo | std::vector< int8_t > | |
hi | std::vector< int8_t > | per column, -127..127 |
hop | uint32_t | frames per envelope value, from start |
envelope | std::vector< uint8_t > | level per hop, SliceMath::kEnvDbPerStep dB a step |
Declared in crosspad/sampletools/ISampleTools.hpp:46.
crosspad::CardFolder
Section titled “crosspad::CardFolder”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.
| Field | Type | Description |
|---|---|---|
kMaxEntries | constexpr size_t | |
path | std::string | the folder listed, full path |
names | std::string | every name, each ended by ‘\0’ |
offsets | std::vector< uint32_t > | where each name starts in names |
folders | uint32_t | the first folders names are folders |
truncated | bool | more than kMaxEntries: the rest is not listed |
Members
| Member | Description |
|---|---|
size | |
name | |
isFolder |
Methods
size_t size() constconst char * name(size_t i) constisFolder
Section titled “isFolder”bool isFolder(size_t i) constDeclared in crosspad/sampletools/ISampleTools.hpp:60.
crosspad::SliceKit
Section titled “crosspad::SliceKit”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.
| Field | Type | Description |
|---|---|---|
source | std::string | full path of the WAV |
name | std::string | the kit’s folder and name |
starts | std::vector< uint32_t > | sorted |
end | uint32_t | |
bpm | uint16_t | 0 = not known |
attackMs | uint16_t | every slice’s rise (SliceMath::attackFrames) |
semitones | int8_t | every slice transposed, varispeed (SliceMath::pitchRatio) |
Declared in crosspad/sampletools/ISampleTools.hpp:74.
crosspad::PreviewSound
Section titled “crosspad::PreviewSound”How a preview sounds: transposed, filtered, and/or as a kit’s slice.
| Field | Type | Description |
|---|---|---|
semitones | int8_t | varispeed, -12..+12 (SliceMath::pitchRatio) |
slice | bool | rising over attackMs, with the slice’s fades (SliceMath::sliceGain) |
attackMs | uint16_t | |
hpHz | uint16_t | high pass, 0 = off (SampleFilters) |
lpHz | uint16_t | low pass, 0 = off |
reverse | bool | from end to start; previewFrame() then runs backwards |
Declared in crosspad/sampletools/ISampleTools.hpp:85.
crosspad::ISampleTools
Section titled “crosspad::ISampleTools”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
| Member | Description |
|---|---|
selectInput | Listen to in: peaks() meters it and the next take records it. |
input | |
inputAvailable | Whether in has anything to record right now USB only while the board is in its USB audio profile. |
peaks | Peaks of the selected input since the last call, 0..1. |
startRecording | A new take in the recordings folder, stereo, at the engine’s rate. |
startRecordingWithSong | A take lined up with the song engine: armed, then the song played from fromBar. |
startRecordingWithSong | The 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 | |
releaseInput | The app is closing: stop metering and put the codec input back. |
requestRecordings | |
recordings | Full paths from the recordings folder, newest name first. |
requestOverview | Columns and envelope of [start, end) of file; end 0 = to its end. |
overview | |
requestFolder | List dir any folder on the card; "" for the recordings folder. |
folder | The last finished listing. |
cardRoot | The 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. |
requestExportKit | 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. |
requestRendered | 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. |
job | |
jobResult | |
jobProgress | percent |
preview | Play [start, end) of file (end 0 = to its end), once or looped. |
previewAs | preview() shaped as sound says what a kit made with the same settings plays. |
stopPreview | |
previewing | |
previewFrame | The frame of the file being heard now. |
setHandoff | A file and the loop marked in it, for the next screen that asks. |
takeHandoff | Takes it: true once per setHandoff(). |
Methods
selectInput
Section titled “selectInput”virtual bool selectInput(RecInput in) = 0Listen 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 =0inputAvailable
Section titled “inputAvailable”virtual bool inputAvailable(RecInput in) constWhether 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) = 0Peaks of the selected input since the last call, 0..1.
startRecording
Section titled “startRecording”virtual bool startRecording() = 0A new take in the recordings folder, stereo, at the engine’s rate.
startRecordingWithSong
Section titled “startRecordingWithSong”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.
startRecordingWithSong
Section titled “startRecordingWithSong”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.
stopRecording
Section titled “stopRecording”virtual void stopRecording() = 0recStatus
Section titled “recStatus”virtual RecStatus recStatus() = 0releaseInput
Section titled “releaseInput”virtual void releaseInput() = 0The app is closing: stop metering and put the codec input back.
requestRecordings
Section titled “requestRecordings”virtual bool requestRecordings() = 0recordings
Section titled “recordings”virtual std::vector< std::string > recordings() = 0Full paths from the recordings folder, newest name first.
requestOverview
Section titled “requestOverview”virtual bool requestOverview(const std::string &file, uint32_t start, uint32_t end, uint16_t columns) = 0Columns and envelope of [start, end) of file; end 0 = to its end.
overview
Section titled “overview”virtual WaveOverview overview() = 0requestFolder
Section titled “requestFolder”virtual bool requestFolder(const std::string &dir)List dir any folder on the card; "" for the recordings folder.
folder
Section titled “folder”virtual CardFolder folder()The last finished listing.
cardRoot
Section titled “cardRoot”virtual std::string cardRoot() constThe card’s top: a listing never goes above it.
requestSaveRegion
Section titled “requestSaveRegion”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.
requestExportKit
Section titled “requestExportKit”virtual bool requestExportKit(const SliceKit &kit) = 0The 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.
requestRendered
Section titled “requestRendered”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 =0jobResult
Section titled “jobResult”virtual std::string jobResult() = 0jobProgress
Section titled “jobProgress”virtual uint8_t jobProgress() const =0percent
preview
Section titled “preview”virtual bool preview(const std::string &file, uint32_t start, uint32_t end, bool loop) = 0Play [start, end) of file (end 0 = to its end), once or looped.
previewAs
Section titled “previewAs”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.
stopPreview
Section titled “stopPreview”virtual void stopPreview() = 0previewing
Section titled “previewing”virtual bool previewing() const =0previewFrame
Section titled “previewFrame”virtual uint32_t previewFrame() const =0The frame of the file being heard now.
setHandoff
Section titled “setHandoff”virtual void setHandoff(const std::string &file, uint32_t start, uint32_t end) = 0A file and the loop marked in it, for the next screen that asks.
takeHandoff
Section titled “takeHandoff”virtual bool takeHandoff(std::string &file, uint32_t &start, uint32_t &end) = 0Takes it: true once per setHandoff().
Declared in crosspad/sampletools/ISampleTools.hpp:101.