A subclass of SynthesiserSound that represents a sampled audio clip.
More...
#include <juce_Sampler.h>
A subclass of SynthesiserSound that represents a sampled audio clip.
This is a pretty basic sampler, and just attempts to load the whole audio stream into memory.
To use it, create a Synthesiser, add some SamplerVoice objects to it, then give it some SampledSound objects to play.
- See also
- SamplerVoice, Synthesiser, SynthesiserSound
{Audio}
◆ Ptr
The class is reference-counted, so this is a handy pointer class for it.
◆ SamplerSound()
juce::SamplerSound::SamplerSound |
( |
const String & |
name, |
|
|
AudioFormatReader & |
source, |
|
|
const BigInteger & |
midiNotes, |
|
|
int |
midiNoteForNormalPitch, |
|
|
double |
attackTimeSecs, |
|
|
double |
releaseTimeSecs, |
|
|
double |
maxSampleLengthSeconds |
|
) |
| |
Creates a sampled sound from an audio reader.
This will attempt to load the audio from the source into memory and store it in this object.
- Parameters
-
name | a name for the sample |
source | the audio to load. This object can be safely deleted by the caller after this constructor returns |
midiNotes | the set of midi keys that this sound should be played on. This is used by the SynthesiserSound::appliesToNote() method |
midiNoteForNormalPitch | the midi note at which the sample should be played with its natural rate. All other notes will be pitched up or down relative to this one |
attackTimeSecs | the attack (fade-in) time, in seconds |
releaseTimeSecs | the decay (fade-out) time, in seconds |
maxSampleLengthSeconds | a maximum length of audio to read from the audio source, in seconds |
◆ ~SamplerSound()
juce::SamplerSound::~SamplerSound |
( |
| ) |
|
|
override |
◆ appliesToChannel()
bool juce::SamplerSound::appliesToChannel |
( |
int |
midiChannel | ) |
|
|
overridevirtual |
Returns true if the sound should be triggered by midi events on a given channel.
The Synthesiser will use this information when deciding which sounds to trigger for a given note.
Implements juce::SynthesiserSound.
◆ appliesToNote()
bool juce::SamplerSound::appliesToNote |
( |
int |
midiNoteNumber | ) |
|
|
overridevirtual |
Returns true if this sound should be played when a given midi note is pressed.
The Synthesiser will use this information when deciding which sounds to trigger for a given note.
Implements juce::SynthesiserSound.
◆ decReferenceCount()
void juce::ReferenceCountedObject::decReferenceCount |
( |
| ) |
|
|
inlinenoexceptinherited |
Decreases the object's reference count.
If the count gets to zero, the object will be deleted.
References jassert.
◆ decReferenceCountWithoutDeleting()
bool juce::ReferenceCountedObject::decReferenceCountWithoutDeleting |
( |
| ) |
|
|
inlinenoexceptinherited |
Decreases the object's reference count.
If the count gets to zero, the object will not be deleted, but this method will return true, allowing the caller to take care of deletion.
References jassert.
◆ getAudioData()
Returns the audio sample data.
This could return nullptr if there was a problem loading the data.
◆ getName()
const String& juce::SamplerSound::getName |
( |
| ) |
const |
|
inlinenoexcept |
Returns the sample's name.
◆ getReferenceCount()
int juce::ReferenceCountedObject::getReferenceCount |
( |
| ) |
const |
|
inlinenoexceptinherited |
Returns the object's current reference count.
◆ incReferenceCount()
void juce::ReferenceCountedObject::incReferenceCount |
( |
| ) |
|
|
inlinenoexceptinherited |
Increments the object's reference count.
This is done automatically by the smart pointer, but is public just in case it's needed for nefarious purposes.
◆ resetReferenceCount()
void juce::ReferenceCountedObject::resetReferenceCount |
( |
| ) |
|
|
inlineprotectednoexceptinherited |
Resets the reference count to zero without deleting the object.
You should probably never need to use this!
◆ setEnvelopeParameters()
void juce::SamplerSound::setEnvelopeParameters |
( |
ADSR::Parameters |
parametersToUse | ) |
|
|
inline |
Changes the parameters of the ADSR envelope which will be applied to the sample.
◆ SamplerVoice
◆ data
◆ length
int juce::SamplerSound::length = 0 |
|
private |
◆ midiNotes
◆ midiRootNote
int juce::SamplerSound::midiRootNote = 0 |
|
private |
◆ name
String juce::SamplerSound::name |
|
private |
◆ params
◆ sourceSampleRate
double juce::SamplerSound::sourceSampleRate |
|
private |
The documentation for this class was generated from the following file: