DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
SampleZone.h
1// DSPark - Professional Audio DSP Framework
2// Copyright (c) 2026 Cristian Moresi - MIT License
3
4#pragma once
5
21#include "AudioBuffer.h"
22#include "DspMath.h"
23
24#include <cstdint>
25
26namespace dspark {
27
30{
31 None,
33 Sustain
34};
35
37template <FloatType T>
39{
41 double sampleRate = 48000.0;
42 int rootKey = 60;
43 double tuneCents = 0.0;
44 int keyLow = 0;
45 int keyHigh = 127;
46 double velocityLow = 0.0;
47 double velocityHigh = 1.0;
48 double gainDb = 0.0;
49 double pan = 0.0;
50 int64_t startOffset = 0;
52 int64_t loopStart = 0;
53 int64_t loopEnd = 0;
54 int64_t loopCrossfade = 0;
55 bool equalPowerCrossfade = false;
57};
58
59} // namespace dspark
Non-owning view over audio channel data.
Definition AudioBuffer.h:53
Main namespace for the DSPark framework.
@ None
The curve as drawn: a brief move plays at part of its depth.
SampleLoopMode
How a zone loops.
Definition SampleZone.h:30
@ Continuous
Loop for as long as the voice sounds, release included.
@ None
Play once to the end of the recording.
@ Sustain
Loop while the key is held, then play on past the loop end.
One zone, as the caller describes it.
Definition SampleZone.h:39
int rootKey
MIDI key that plays it untransposed.
Definition SampleZone.h:42
double velocityHigh
Highest velocity it answers, 0..1 (inclusive).
Definition SampleZone.h:47
int64_t loopEnd
One past the last sample of the loop.
Definition SampleZone.h:53
AudioBufferView< const T > audio
The recording (1 or more channels).
Definition SampleZone.h:40
int64_t loopCrossfade
Crossfade length in samples (0 = hard loop).
Definition SampleZone.h:54
int64_t startOffset
First sample played.
Definition SampleZone.h:50
double gainDb
Zone gain.
Definition SampleZone.h:48
double pan
-1 left .. +1 right (balance for multichannel).
Definition SampleZone.h:49
int64_t loopStart
First sample of the loop.
Definition SampleZone.h:52
SampleLoopMode loopMode
Definition SampleZone.h:51
int keyLow
Lowest key it answers (inclusive).
Definition SampleZone.h:44
double tuneCents
Fine tuning added to every note.
Definition SampleZone.h:43
double sampleRate
Its sample rate.
Definition SampleZone.h:41
double velocityLow
Lowest velocity it answers, 0..1 (inclusive).
Definition SampleZone.h:46
int keyHigh
Highest key it answers (inclusive).
Definition SampleZone.h:45