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

#include <KrotosSynthesiserSound.h>

Inheritance diagram for krotos::KrotosSampleOscillatorSound:
krotos::KrotosSynthesiserSound krotos::ResourceLock

Classes

struct  Listener
 

Public Member Functions

 KrotosSampleOscillatorSound ()
 
 KrotosSampleOscillatorSound (const String &soundName, AudioFormatReader &source, int midiNoteForNormalPitch, float dawSampleRate)
 
void Prepare (int midiNoteForNormalPitch, float dawSampleRate)
 
int loadSounds (juce::Array< File > audioSampleFiles, bool getNearest)
 
bool appliesToNote (int midiNoteNumber) override
 
bool appliesToChannel (int midiChannel) override
 
void setInterpolationType (KrotosAudioBuffer::InterpolationType interpType)
 
void newBlockStart () override
 
SampleEnginegetSampleEngine () override
 
void canReadSpecificFiles (bool canRead)
 
void addListener (Listener *l)
 
void removeListener (Listener *l)
 
void clearAndFreeBuffer ()
 
- Public Member Functions inherited from krotos::KrotosSynthesiserSound
 KrotosSynthesiserSound ()
 
- 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.
 

Private Member Functions

std::unique_ptr< MemoryBlock > loadSample (const juce::File &path, int sampleCount)
 

Private Attributes

String m_name
 
SampleEngine m_sampleEngine
 
double m_sourceSampleRate
 
int m_midiRootNote {0}
 
ListenerList< Listenerm_listeners
 
std::vector< std::array< unsigned char, BUF_SIZE > > m_sampleData
 
String m_specificExtension {""}
 
const float DECIBELS_MINUS_0_1 {0.998763561f}
 

Static Private Attributes

static constexpr int64 MAX_DATA_SIZE = 2147483648
 
static constexpr int MAX_NUMBER_SAMPLES = 250
 
static constexpr size_t BUF_SIZE = 32
 

Detailed Description

Synth sound with sample data

Constructor & Destructor Documentation

◆ KrotosSampleOscillatorSound() [1/2]

krotos::KrotosSampleOscillatorSound::KrotosSampleOscillatorSound ( )

◆ KrotosSampleOscillatorSound() [2/2]

krotos::KrotosSampleOscillatorSound::KrotosSampleOscillatorSound ( const String & soundName,
AudioFormatReader & source,
int midiNoteForNormalPitch,
float dawSampleRate )

Member Function Documentation

◆ addListener()

void krotos::KrotosSampleOscillatorSound::addListener ( Listener * l)
inline

◆ appliesToChannel()

bool krotos::KrotosSampleOscillatorSound::appliesToChannel ( int midiChannel)
override

◆ appliesToNote()

bool krotos::KrotosSampleOscillatorSound::appliesToNote ( int midiNoteNumber)
override

◆ canReadSpecificFiles()

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

◆ clearAndFreeBuffer()

void krotos::KrotosSampleOscillatorSound::clearAndFreeBuffer ( )

Used to reset sampleEngine to initial state. Clears buffer and frees allocated memory

◆ getSampleEngine()

SampleEngine * krotos::KrotosSampleOscillatorSound::getSampleEngine ( )
inlineoverridevirtual

Reimplemented from krotos::KrotosSynthesiserSound.

◆ loadSample()

std::unique_ptr< MemoryBlock > krotos::KrotosSampleOscillatorSound::loadSample ( const juce::File & path,
int sampleCount )
private

◆ loadSounds()

int krotos::KrotosSampleOscillatorSound::loadSounds ( juce::Array< File > audioSampleFiles,
bool getNearest )

Attempts to load a list of sounds from the paths in Array<File> audioSampleFiles Returns the number of files successfully loaded

◆ newBlockStart()

void krotos::KrotosSampleOscillatorSound::newBlockStart ( )
inlineoverridevirtual

Reimplemented from krotos::KrotosSynthesiserSound.

◆ Prepare()

void krotos::KrotosSampleOscillatorSound::Prepare ( int midiNoteForNormalPitch,
float dawSampleRate )

◆ removeListener()

void krotos::KrotosSampleOscillatorSound::removeListener ( Listener * l)
inline

◆ setInterpolationType()

void krotos::KrotosSampleOscillatorSound::setInterpolationType ( KrotosAudioBuffer::InterpolationType interpType)

Member Data Documentation

◆ BUF_SIZE

size_t krotos::KrotosSampleOscillatorSound::BUF_SIZE = 32
staticconstexprprivate

◆ DECIBELS_MINUS_0_1

const float krotos::KrotosSampleOscillatorSound::DECIBELS_MINUS_0_1 {0.998763561f}
private

◆ m_listeners

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

◆ m_midiRootNote

int krotos::KrotosSampleOscillatorSound::m_midiRootNote {0}
private

◆ m_name

String krotos::KrotosSampleOscillatorSound::m_name
private

◆ m_sampleData

std::vector<std::array<unsigned char, BUF_SIZE> > krotos::KrotosSampleOscillatorSound::m_sampleData
private

◆ m_sampleEngine

SampleEngine krotos::KrotosSampleOscillatorSound::m_sampleEngine
private

◆ m_sourceSampleRate

double krotos::KrotosSampleOscillatorSound::m_sourceSampleRate
private

◆ m_specificExtension

String krotos::KrotosSampleOscillatorSound::m_specificExtension {""}
private

◆ MAX_DATA_SIZE

int64 krotos::KrotosSampleOscillatorSound::MAX_DATA_SIZE = 2147483648
staticconstexprprivate

◆ MAX_NUMBER_SAMPLES

int krotos::KrotosSampleOscillatorSound::MAX_NUMBER_SAMPLES = 250
staticconstexprprivate

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