Gin
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
NoteDuration Class Reference

Musical note duration for tempo-synchronized timing. More...

#include <gin_noteduration.h>

Public Member Functions

 NoteDuration (const char *name="", float bars=0.0f, float note=0.0f)
 
const juce::String & getName () const
 
float toSeconds (juce::AudioPlayHead *playhead) const
 
float toSeconds (float bpm) const
 
float getBars ()
 
float getBeats ()
 

Static Public Member Functions

static const std::vector< NoteDuration > & getNoteDurations ()
 
static float toSeconds (juce::AudioPlayHead *playhead, float value)
 

Detailed Description

Musical note duration for tempo-synchronized timing.

NoteDuration represents musical time durations (whole notes, quarter notes, etc.) and provides conversion to seconds based on tempo from AudioPlayHead. This is useful for tempo-synced delays, LFOs, arpeggiators, and other time-based effects that need to follow the host DAW's tempo.

Key Features:

The class stores duration as bars and beats (quarter notes), then converts to seconds using the current tempo from the host's transport.

Usage:

// Get standard note durations
// Contains: 1/64, 1/32, 1/16, 1/8, 1/4, 1/2, 1 bar, etc.
// Use with tempo sync
auto quarterNote = NoteDuration("1/4", 0.0f, 1.0f);
float seconds = quarterNote.toSeconds(audioPlayhead);
// At 120 BPM: returns 0.5 seconds
// For delay time
Musical note duration for tempo-synchronized timing.
Definition gin_noteduration.h:43
static const std::vector< NoteDuration > & getNoteDurations()
static float toSeconds(juce::AudioPlayHead *playhead, float value)
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
See also
Parameter, StepLFO

Constructor & Destructor Documentation

◆ NoteDuration()

NoteDuration::NoteDuration ( const char name = "",
float  bars = 0.0f,
float  note = 0.0f 
)

Member Function Documentation

◆ getNoteDurations()

static const std::vector< NoteDuration > & NoteDuration::getNoteDurations ( )
static

◆ toSeconds() [1/3]

static float NoteDuration::toSeconds ( juce::AudioPlayHead *  playhead,
float  value 
)
static

◆ getName()

const juce::String & NoteDuration::getName ( ) const

◆ toSeconds() [2/3]

float NoteDuration::toSeconds ( juce::AudioPlayHead *  playhead) const

◆ toSeconds() [3/3]

float NoteDuration::toSeconds ( float  bpm) const

◆ getBars()

float NoteDuration::getBars ( )

◆ getBeats()

float NoteDuration::getBeats ( )

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