JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::SynthesiserSound Class Referenceabstract

Describes one of the sounds that a Synthesiser can play. More...

#include <juce_Synthesiser.h>

Inheritance diagram for juce::SynthesiserSound:
Collaboration diagram for juce::SynthesiserSound:

Public Types

using Ptr = ReferenceCountedObjectPtr< SynthesiserSound >
 The class is reference-counted, so this is a handy pointer class for it. More...
 

Public Member Functions

 ~SynthesiserSound () override
 Destructor. More...
 
virtual bool appliesToChannel (int midiChannel)=0
 Returns true if the sound should be triggered by midi events on a given channel. More...
 
virtual bool appliesToNote (int midiNoteNumber)=0
 Returns true if this sound should be played when a given midi note is pressed. More...
 
void decReferenceCount () noexcept
 Decreases the object's reference count. More...
 
bool decReferenceCountWithoutDeleting () noexcept
 Decreases the object's reference count. More...
 
int getReferenceCount () const noexcept
 Returns the object's current reference count. More...
 
void incReferenceCount () noexcept
 Increments the object's reference count. More...
 

Protected Member Functions

 SynthesiserSound ()
 
void resetReferenceCount () noexcept
 Resets the reference count to zero without deleting the object. More...
 

Private Attributes

Atomic< intrefCount { 0 }
 

Detailed Description

Describes one of the sounds that a Synthesiser can play.

A synthesiser can contain one or more sounds, and a sound can choose which midi notes and channels can trigger it.

The SynthesiserSound is a passive class that just describes what the sound is - the actual audio rendering for a sound is done by a SynthesiserVoice. This allows more than one SynthesiserVoice to play the same sound at the same time.

See also
Synthesiser, SynthesiserVoice

@tags{Audio}

Member Typedef Documentation

◆ Ptr

The class is reference-counted, so this is a handy pointer class for it.

Constructor & Destructor Documentation

◆ SynthesiserSound()

juce::SynthesiserSound::SynthesiserSound ( )
protected

◆ ~SynthesiserSound()

juce::SynthesiserSound::~SynthesiserSound ( )
override

Destructor.

Member Function Documentation

◆ appliesToChannel()

virtual bool juce::SynthesiserSound::appliesToChannel ( int  midiChannel)
pure virtual

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.

Implemented in juce::SamplerSound.

◆ appliesToNote()

virtual bool juce::SynthesiserSound::appliesToNote ( int  midiNoteNumber)
pure virtual

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.

Implemented in juce::SamplerSound.

◆ 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.

◆ 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.

Referenced by juce::ReferenceCountedObjectPtr< juce::ReferenceCountedObject >::operator=().

◆ resetReferenceCount()

void juce::ReferenceCountedObject::resetReferenceCount ( )
inlineprotectednoexceptinherited

Resets the reference count to zero without deleting the object.

You should probably never need to use this!

Member Data Documentation

◆ refCount

Atomic<int> juce::ReferenceCountedObject::refCount { 0 }
privateinherited

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