Docs

Sampler

This object can be used to access sampler-specific properties, like loading samplemaps, changing sample properties, setting the current RR index, etc.

If you have a generic reference obtained by calling Synth.getChildSynth() , you can turn it into a Sampler reference with ChildSynth.asSampler() :

const var genericReference = Synth.getChildSynth("MySampler");

genericReference.asSampler().loadSampleMap("My SampleMap");

Be aware that most of the functions that change samples will be executed asynchronously - if you want to keep your UI updated, take a look at ScriptPanel.setLoadingCallback()

Class methods

clearSampleMap

Clears the current samplemap.

Sampler.clearSampleMap()



createListFromGUISelection

Returns a list of the sounds selected in the samplemap.

Sampler.createListFromGUISelection()



createListFromScriptSelection

Returns a list of the sounds selected by the selectSounds() method.

Sampler.createListFromScriptSelection()



createSelection

Returns an array with all samples that match this regex.

Sampler.createSelection(String regex)



createSelectionFromIndexes

Returns an array with all samples from the index data (can be either int or array of int, -1 selects all.).

Sampler.createSelectionFromIndexes(var indexData)



enableRoundRobin

Enables / Disables the automatic round robin group start logic (works only on samplers).

Sampler.enableRoundRobin(bool shouldUseRoundRobin)



getAttribute

Gets the attribute with the given index (use the constants for clearer code).

Sampler.getAttribute(int index)



getCurrentSampleMapId

Returns the currently loaded sample map.

Sampler.getCurrentSampleMapId()



getMicPositionName

Returns the name of the channel with the given index (Multimic samples only.

Sampler.getMicPositionName(int channelIndex)



getNumMicPositions

Returns the number of mic positions.

Sampler.getNumMicPositions()



getNumSelectedSounds

Returns the amount of selected samples.

Sampler.getNumSelectedSounds()



getRRGroupsForMessage

Returns the amount of actual RR groups for the notenumber and velocity

Sampler.getRRGroupsForMessage(int noteNumber, int velocity)



getSampleMapList

Returns an array with all available sample maps.

Sampler.getSampleMapList()



getSoundProperty

Returns the property of the sound with the specified index.

Sampler.getSoundProperty(int propertyIndex, int soundIndex)



importSamples

Loads a few samples in the current samplemap and returns a list of references to these samples.

Sampler.importSamples(var fileNameList, bool skipExistingSamples)



isMicPositionPurged

Checks if the mic position is purged.

Sampler.isMicPositionPurged(int micIndex)



isNoteNumberMapped

Checks whether the note number is mapped to any samples.

Sampler.isNoteNumberMapped(int noteNumber)



loadSampleForAnalysis

Loads the content of the given sample into an array of VariantBuffers that can be used for analysis.

Sampler.loadSampleForAnalysis(int indexInSelection)



loadSampleMap

Loads a new samplemap into this sampler.

Sampler.loadSampleMap( String fileName)


This method will return immediately and load a new samplemap on a background thread.

If you want to be notified when the sample loading has finished, you will need to create a Panel and add a PreloadingCallback using setLoadingCallback()

purgeMicPosition

Purges all samples of the given mic (Multimic samples only).

Sampler.purgeMicPosition(String micName, bool shouldBePurged)



refreshInterface

Refreshes the interface. Call this after you changed the properties.

Sampler.refreshInterface()



refreshRRMap

Recalculates the RR Map. Call this at compile time if you want to use 'getRRGroupForMessage()'.

Sampler.refreshRRMap()



saveCurrentSampleMap

Saves (and loads) the current samplemap to the given path (which should be the same string as the ID).

Sampler.saveCurrentSampleMap(String relativePathWithoutXml)



selectSounds

Selects samples using the regex string as wildcard and the selectMode ("SELECT", "ADD", "SUBTRACT")

Sampler.selectSounds(String regex)



setActiveGroup

Enables the group with the given index (one-based). Works only with samplers and enableRoundRobin(false) .

Sampler.setActiveGroup(int activeGroupIndex)



setAttribute

Sets a attribute to the given value.

Sampler.setAttribute(int index, var newValue)



setSortByRRGroup

Enables a presorting of the sounds into RR groups. This might improve the performance at voice start if you have a lot of samples (> 20.000) in many RR groups.

Sampler.setSortByRRGroup(bool shouldSort)



setSoundProperty

Sets the property for the index within the selection.

Sampler.setSoundProperty(int soundIndex, int propertyIndex, var newValue)



setSoundPropertyForAllSamples

Sets the property for all samples of the sampler.

Sampler.setSoundPropertyForAllSamples(int propertyIndex, var newValue)



setSoundPropertyForSelection

Sets the property of the sampler sound for the selection.

Sampler.setSoundPropertyForSelection(int propertyIndex, var newValue)



setUseStaticMatrix

Disables dynamic resizing when a sample map is loaded.

Sampler.setUseStaticMatrix(bool shouldUseStaticMatrix)