Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
sample_playback.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
12#ifndef __AUDIO_SAMPLE_PLAYBACK_H__
13#define __AUDIO_SAMPLE_PLAYBACK_H__
14
15#include "utils/types.h"
16
57
62#define sample_playback_init( \
63 self, _buf, _buf_size, _channels, _vol, _start_offset) \
64 if (_channels <= 0) \
65 { \
66 g_critical ("channels: %u", _channels); \
67 } \
68 (self)->buf = _buf; \
69 (self)->buf_size = _buf_size; \
70 (self)->volume = _vol; \
71 (self)->offset = 0; \
72 (self)->channels = _channels; \
73 (self)->start_offset = _start_offset; \
74 (self)->file = __FILE__; \
75 (self)->func = __func__; \
76 (self)->lineno = __LINE__
77
82#endif
uint_fast64_t unsigned_frame_t
Unsigned type for frame index.
Definition types.h:64
uint32_t nframes_t
Frame count.
Definition types.h:39
float sample_t
The sample type.
Definition types.h:51
unsigned int channels_t
Number of channels.
Definition types.h:48
A sample playback handle to be used by the engine.
float volume
The volume to play the sample at (ratio from 0.0 to 2.0, where 1.0 is the normal volume).
int lineno
Line no initialized from.
const char * file
Source file initialized from.
channels_t channels
The number of channels.
unsigned_frame_t buf_size
The number of frames in the buffer.
unsigned_frame_t offset
The current offset in the buffer.
const char * func
Function initialized from.
sample_t ** buf
A pointer to the original buffer.
nframes_t start_offset
Offset relative to the current processing cycle to start playing the sample.
Custom types.