Krotos Modules 3
Loading...
Searching...
No Matches
krotos::Kwidget_Reformer Class Reference

#include <Kwidget_Reformer.h>

Inheritance diagram for krotos::Kwidget_Reformer:
krotos::Kwidget krotos::ResourceLock

Classes

class  Listener
 
struct  Parameters
 

Public Types

enum  GuiTypes { Normal = 0 , Sampler , Granular , Vehicle }
 
- Public Types inherited from krotos::Kwidget
enum  DragID_Index { KwidgetID = 0 , ParameterID = 1 }
 

Public Member Functions

void addListener (Listener *listenerToAdd)
 
void removeListener (Listener *listenerToRemove)
 
 Kwidget_Reformer (const String &id)
 
void createNestedKwidgets (KwidgetAudioProcessor &) override
 
bool isDroneVoice (int voiceIdx)
 
void noteOn (int voiceIdx, int midiNote, float velocity) override
 
void noteOff (int voiceIdx, float velocity) override
 
void noteCleared (int voiceIdx) override
 
bool isActive (int voiceIdx) override
 
bool isUCSEnabled ()
 Returns true if the UCS-based search has initialised successfully and is ready for use.
 
KrotosSampleOscillatorSoundgetSound ()
 
void canReadSpecificFiles (bool canRead)
 
- Public Member Functions inherited from krotos::Kwidget
 Kwidget (const String &kwidgetType, const String &kwidgetID)
 
virtual ~Kwidget ()=default
 
void init ()
 
std::unique_ptr< KwidgetProcessorcreateVoice ()
 
std::unique_ptr< KwidgetGUIcreateControls ()
 
KwidgetProcessorgetVoice (int idx) const
 
int getNumVoices () const
 
KwidgetProcessorgetActiveVoice () const
 
void addModulator (const String &paramID, Kwidget *modulator, int modulatorIdx, float depth=0.99f, KAttachment::Polarity=KAttachment::Polarity::Bipolar)
 
void removeModulator (const String &paramID, Kwidget *modulator, int modulatorIdx)
 
void setModulatorDepth (const String &paramID, Kwidget *modulator, int modulatorIdx, float depth)
 
void setModulatorPolarity (const String &paramID, Kwidget *modulator, int modulatorIdx, KAttachment::Polarity polarity)
 
const std::vector< std::shared_ptr< KParameter > > & getParameters () const
 
KParametergetParameter (const String &parameterID) const noexcept
 Get a raw pointer to a KParameter belonging to this Kwidget's KwidgetProcessor. Useful for low overhead direct parameter access.
 
std::shared_ptr< KParametergetParameterToAttach (const String &parameterID) const noexcept
 Get a shared pointer to a KParameter, for use with KParameter::Listener objects and situations where the parameter lifetime goes beyond local scope.
 
CustomParametergetCustomParameter (const String &parameterID)
 
CustomParameterTreegetCustomParameterTree (const Identifier &type)
 Get a CustomParameterTree belonging to this Kwidget.
 
template<typename T >
T * getCustomParameter (const Identifier &type)
 Get the CustomParameterTree subclass object of the specified type.
 
void notifyAllParametersListeners ()
 Call every parameter's value changed listeners with their current values.
 
const ValueTree & getState ()
 
virtual void setState (const ValueTree &newState, KwidgetAudioProcessor &processor)
 
void flushState ()
 
bool isModulator () const
 
int getNumModulators () const
 
const String & getKwidgetType () const
 
const String & getKwidgetID () const
 
const String & getKwidgetVersionFromCurrentState () const
 
String getKwidgetVersion () const
 
virtual const String & getKwidgetLabel ()
 
StringArray getDragID (const String &parameterID)
 
bool isAChildKwidget ()
 
std::vector< Kwidget * > & getChildKwidgets ()
 
bool isStateChanging ()
 
void addChildKwidget (Kwidget *child)
 
void removeChildKwidgetFromTree (String kwidgetID)
 
KwidgetfindChildKwidget (String kiwdgetID)
 
void addParameterCallback (const String &paramID, std::function< void(float)> callback)
 
void addVersionedParameterCallback (StringRef kwidgetVersionTheParameterChangedIn, const String &paramID, std::function< void(float)> callback)
 Add an action to be performed when a specified parameter of a specific kwidget version changes value. This can be used to implement backwards compatibility when older versions of the kwidget state are loaded, and the parameters in newer versions may have been changed or removed.
 
int getTemplateID ()
 
- Public Member Functions inherited from krotos::ResourceLock
 ResourceLock ()
 
bool requestAccess (const StringRef id)
 Called by a client to request access to the resource.
 
bool hasAccess (const StringRef id) const
 Called by a client to enquire whether it has access to the resource.
 
void finishedAccessing (const StringRef id)
 Called by a client to inform the resource that it no longer needs access.
 
void setAccessible (bool isAccessible)
 Called by the resource to grant or deny access to clients.
 

Static Public Attributes

static const String Version = "1"
 
static const String embeddingsFilePath
 
static const String embeddingsFilePathFull
 
static const StringArray ModeNames = {"Sampler", "Granular", "Vehicle"}
 
static const StringArray MIDIModeNames = {"All Notes", "C3", "C#3", "D3", "D#3", "E3"}
 
static const int MaxSegmentationMethods = 129
 
static const std::map< int, String > SegmentationMethods
 
static const int MaxFeatureExtrMethods = 193
 
static const std::map< int, String > FeatureExtrMethods
 

Protected Member Functions

std::vector< ParameterInfocreateParameters () override
 
std::unique_ptr< KwidgetProcessorcreateProcessor () override
 
std::unique_ptr< KwidgetGUIcreateGUI () override
 
size_t numGUIImplementations () override
 
String getGuiName (int id) override
 
- Protected Member Functions inherited from krotos::Kwidget
void addChildGuis (std::unique_ptr< KwidgetGUI > &parentGui)
 
CustomParametercreateAndAddCustomParameter (const String &paramID, const var &value)
 
template<typename T >
T * createAndAddCustomParameter (const Identifier &type)
 Create a highly customizable piece of state for this Kwidget by appending a subclass of CustomParameterTree to this Kwidget's state.
 
void setKwidgetVersion (const String &kwidgetVersionString)
 

Protected Attributes

std::unique_ptr< NearestNeighbourSearchm_nearestNeighbourSearch
 
std::unique_ptr< CatIDSearchm_categorySearch
 
const std::vector< std::pair< String, GuiTypes > > m_reformerGuiTypes
 
- Protected Attributes inherited from krotos::Kwidget
std::vector< Kwidget * > m_childKwidgets
 

Private Member Functions

void noteOnInternal (int voiceIdx, int midiNote, float velocity)
 
void noteOffInternal (int voiceIdx, float velocity)
 
void noteClearedInternal (int voiceIdx)
 
void soloActivate ()
 Called When the state of our solo button is selected true [SOLO].
 
void soloDeActivate ()
 Called When the state of our solo button is selected false [SOLO].
 
void loadFiles (const StringArray &files)
 
void updateSamplesTree ()
 

Private Attributes

bool m_enableNOR {false}
 
MIDIMode m_activeMIDIMode {MIDIMode::All}
 
bool m_autoplayEnabled {false}
 
KrotosSampleOscillatorSound m_soSound
 
ListenerList< Listenerm_listeners
 
bool m_readSpecificFiles {false}
 
float m_soloValue {0.0f}
 
SamplesTreem_samplesTree
 

Additional Inherited Members

- Static Public Member Functions inherited from krotos::Kwidget
static String getParentID (String childKwidgetID)
 

Member Enumeration Documentation

◆ GuiTypes

Enumerator
Normal 
Sampler 
Granular 
Vehicle 

Constructor & Destructor Documentation

◆ Kwidget_Reformer()

krotos::Kwidget_Reformer::Kwidget_Reformer ( const String & id)

Member Function Documentation

◆ addListener()

void krotos::Kwidget_Reformer::addListener ( Listener * listenerToAdd)

◆ canReadSpecificFiles()

void krotos::Kwidget_Reformer::canReadSpecificFiles ( bool canRead)
inline

◆ createGUI()

std::unique_ptr< KwidgetGUI > krotos::Kwidget_Reformer::createGUI ( )
overrideprotectedvirtual

Override this method to define the type of KwidgetGUI used by this Kwidget.

Implements krotos::Kwidget.

◆ createNestedKwidgets()

void krotos::krotos::Kwidget_Reformer::createNestedKwidgets ( KwidgetAudioProcessor & processor)
overridevirtual

kwidget may create its own nested kwidgets within this method If the pointers are pushed onto the m_childKwidgets vector the child kwidgets will be deleted by the system when the parent is deleted

Reimplemented from krotos::Kwidget.

◆ createParameters()

std::vector< Kwidget::ParameterInfo > krotos::krotos::Kwidget_Reformer::createParameters ( )
overrideprotectedvirtual

Define all the parameters that this processor will have here.

Parameters are defined with a ParameterInfo struct requiring the following parameters:

paramID A string used to identify the parameter.
paramName The parameter's display name.
range The range of the parameter as a NormalisableRange<float>.
defaultValue The default value of the parameter.

Implements krotos::Kwidget.

◆ createProcessor()

std::unique_ptr< KwidgetProcessor > krotos::Kwidget_Reformer::createProcessor ( )
overrideprotectedvirtual

Override this method to define the type of KwidgetProcessor used by this Kwidget.

Implements krotos::Kwidget.

◆ getGuiName()

String krotos::Kwidget_Reformer::getGuiName ( int )
overrideprotectedvirtual

override to return the names of the Gui representation

Reimplemented from krotos::Kwidget.

◆ getSound()

KrotosSampleOscillatorSound * krotos::Kwidget_Reformer::getSound ( )
inline

◆ isActive()

bool krotos::Kwidget_Reformer::isActive ( int voiceIdx)
overridevirtual

Reimplemented from krotos::Kwidget.

◆ isDroneVoice()

bool krotos::Kwidget_Reformer::isDroneVoice ( int voiceIdx)
inline

◆ isUCSEnabled()

bool krotos::Kwidget_Reformer::isUCSEnabled ( )

Returns true if the UCS-based search has initialised successfully and is ready for use.

◆ loadFiles()

void krotos::Kwidget_Reformer::loadFiles ( const StringArray & files)
private

◆ noteCleared()

void krotos::Kwidget_Reformer::noteCleared ( int voiceIdx)
overridevirtual

Send a message to a particular voice that it has been turned off and will receive no more calls to its process function.

Parameters
voiceIdxThe index of the voice that is being cleared.

Reimplemented from krotos::Kwidget.

◆ noteClearedInternal()

void krotos::Kwidget_Reformer::noteClearedInternal ( int voiceIdx)
private

◆ noteOff()

void krotos::Kwidget_Reformer::noteOff ( int voiceIdx,
float velocity )
overridevirtual

Send a 'note off' message to a particular voice. Note: Note on and off messages do not by default get sent to child Kwidgets parents of child kwidgets can override these methods and pass the messages to their childern if required If you do override, remember to call the base class first from your new overridden method

Parameters
voiceIdxThe index of the voice you would like to turn on.
velocityThe velocity of the note event.

Reimplemented from krotos::Kwidget.

◆ noteOffInternal()

void krotos::Kwidget_Reformer::noteOffInternal ( int voiceIdx,
float velocity )
private

◆ noteOn()

void krotos::Kwidget_Reformer::noteOn ( int voiceIdx,
int midiNote,
float velocity )
overridevirtual

Send a 'note on' message to a particular voice. Note: Note on and off messages do not by default get sent to child Kwidgets parents of child kwidgets can override these methods and pass the messages to their childern if required If you do override, remember to call the base class first from your new overridden method

Parameters
voiceIdxThe index of the voice you would like to turn on.
midiNoteThe integer value of the MIDI note to use.
velocityThe velocity of the note event.

Reimplemented from krotos::Kwidget.

◆ noteOnInternal()

void krotos::Kwidget_Reformer::noteOnInternal ( int voiceIdx,
int midiNote,
float velocity )
private

◆ numGUIImplementations()

size_t krotos::Kwidget_Reformer::numGUIImplementations ( )
inlineoverrideprotectedvirtual

Reimplemented from krotos::Kwidget.

◆ removeListener()

void krotos::Kwidget_Reformer::removeListener ( Listener * listenerToRemove)

◆ soloActivate()

void krotos::Kwidget_Reformer::soloActivate ( )
private

Called When the state of our solo button is selected true [SOLO].

◆ soloDeActivate()

void krotos::Kwidget_Reformer::soloDeActivate ( )
private

Called When the state of our solo button is selected false [SOLO].

◆ updateSamplesTree()

void krotos::Kwidget_Reformer::updateSamplesTree ( )
private

Member Data Documentation

◆ embeddingsFilePath

const String krotos::Kwidget_Reformer::embeddingsFilePath
static

◆ embeddingsFilePathFull

const String krotos::Kwidget_Reformer::embeddingsFilePathFull
static

◆ FeatureExtrMethods

const std::map< int, String > krotos::Kwidget_Reformer::FeatureExtrMethods
static
Initial value:
= {
{0, "No Analysis"},
{1, "HarmonicPitchEstimation"},
{32, "MFCC/PCA [Beta]"},
{64, "Centroid/Level"},
{96, "SpectralCentroid/RMS [Beta]"},
{128, "SpectralFlatness/RMS [Beta]"},
{160, "erbCentroid/RMS [Beta]"},
{192, "erbCentroid/erbFlatness [Beta]"}}

◆ m_activeMIDIMode

MIDIMode krotos::Kwidget_Reformer::m_activeMIDIMode {MIDIMode::All}
private

◆ m_autoplayEnabled

bool krotos::Kwidget_Reformer::m_autoplayEnabled {false}
private

◆ m_categorySearch

std::unique_ptr<CatIDSearch> krotos::Kwidget_Reformer::m_categorySearch
protected

◆ m_enableNOR

bool krotos::Kwidget_Reformer::m_enableNOR {false}
private

◆ m_listeners

ListenerList<Listener> krotos::Kwidget_Reformer::m_listeners
private

◆ m_nearestNeighbourSearch

std::unique_ptr<NearestNeighbourSearch> krotos::Kwidget_Reformer::m_nearestNeighbourSearch
protected

◆ m_readSpecificFiles

bool krotos::Kwidget_Reformer::m_readSpecificFiles {false}
private

◆ m_reformerGuiTypes

const std::vector<std::pair<String, GuiTypes> > krotos::Kwidget_Reformer::m_reformerGuiTypes
protected
Initial value:
{
{"Normal", GuiTypes::Normal},
{"Sampler", GuiTypes::Sampler},
{"Granular", GuiTypes::Granular},
{"Vehicle", GuiTypes::Vehicle},
}
@ Sampler
Definition Kwidget_Reformer.h:94
@ Granular
Definition Kwidget_Reformer.h:95
@ Normal
Definition Kwidget_Reformer.h:93
@ Vehicle
Definition Kwidget_Reformer.h:96

◆ m_samplesTree

SamplesTree* krotos::Kwidget_Reformer::m_samplesTree
private

◆ m_soloValue

float krotos::Kwidget_Reformer::m_soloValue {0.0f}
private

◆ m_soSound

KrotosSampleOscillatorSound krotos::Kwidget_Reformer::m_soSound
private

◆ MaxFeatureExtrMethods

const int krotos::Kwidget_Reformer::MaxFeatureExtrMethods = 193
static

◆ MaxSegmentationMethods

const int krotos::Kwidget_Reformer::MaxSegmentationMethods = 129
static

◆ MIDIModeNames

const StringArray krotos::Kwidget_Reformer::MIDIModeNames = {"All Notes", "C3", "C#3", "D3", "D#3", "E3"}
static

◆ ModeNames

const StringArray krotos::Kwidget_Reformer::ModeNames = {"Sampler", "Granular", "Vehicle"}
static

◆ SegmentationMethods

const std::map< int, String > krotos::Kwidget_Reformer::SegmentationMethods
static
Initial value:
= {
{0, "No Segmentation"},
{32, "Texture Mode | Complex Audio Textures [Beta]"},
{64, "Beats Mode | Percussive Sounds [Beta]"},
{96, "Texture Mode | Complex Audio Textures"},
{128, "Chords Mode | Delicate Nuanced Sounds [Beta]"}}

◆ Version

const String krotos::Kwidget_Reformer::Version = "1"
static

The documentation for this class was generated from the following files: