Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
audio_region.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_AUDIO_REGION_H__
11#define __AUDIO_AUDIO_REGION_H__
12
13#include "dsp/position.h"
14#include "dsp/region.h"
15#include "utils/audio.h"
16#include "utils/types.h"
17
18typedef struct _RegionWidget RegionWidget;
19typedef struct Channel Channel;
20typedef struct Track Track;
21typedef struct ZRegion AudioRegion;
22typedef struct AudioClip AudioClip;
23typedef struct StereoPorts StereoPorts;
24
31#if 0
33# define AUDIO_REGION_DEFAULT_FADE_MS 1
34#endif
35
40#define AUDIO_REGION_BUILTIN_FADE_FRAMES 10
41
62ZRegion *
64 const int pool_id,
65 const char * filename,
66 bool read_from_pool,
67 const float * frames,
68 const unsigned_frame_t nframes,
69 const char * clip_name,
70 const channels_t channels,
71 BitDepth bit_depth,
72 const Position * start_pos,
73 unsigned int track_name_hash,
74 int lane_pos,
75 int idx_inside_lane,
76 GError ** error);
77
78#if 0
83void
84audio_region_init_frame_caches (
85 AudioRegion * self,
86 AudioClip * clip);
87
92void
93audio_region_update_channel_caches (
94 ZRegion * self,
95 AudioClip * clip);
96#endif
97
102AudioClip *
104
109void
110audio_region_set_clip_id (ZRegion * self, int clip_id);
111
122WARN_UNUSED_RESULT bool
124 ZRegion * self,
125 float * frames,
126 unsigned_frame_t start_frame,
127 unsigned_frame_t num_frames,
128 bool duplicate_clip,
129 GError ** error);
130
140REALTIME
141HOT NONNULL void
143 ZRegion * self,
144 const EngineProcessTimeInfo * const time_nfo,
145 StereoPorts * stereo_ports);
146
147float
148audio_region_detect_bpm (ZRegion * self, GArray * candidates);
149
156bool
157audio_region_validate (ZRegion * self, double frames_per_tick);
158
168bool
169audio_region_fix_positions (ZRegion * self, double frames_per_tick);
170
176void
178
183#endif // __AUDIO_AUDIO_REGION_H__
Audio utils.
A region in the timeline.
void audio_region_free_members(ZRegion *self)
Frees members only but not the audio region itself.
AudioClip * audio_region_get_clip(const ZRegion *self)
Returns the audio clip associated with the Region.
bool audio_region_validate(ZRegion *self, double frames_per_tick)
Sanity checking.
WARN_UNUSED_RESULT bool audio_region_replace_frames(ZRegion *self, float *frames, unsigned_frame_t start_frame, unsigned_frame_t num_frames, bool duplicate_clip, GError **error)
Replaces the region's frames from start_frames with frames.
void audio_region_set_clip_id(ZRegion *self, int clip_id)
Sets the clip ID on the region and updates any references.
ZRegion * audio_region_new(const int pool_id, const char *filename, bool read_from_pool, const float *frames, const unsigned_frame_t nframes, const char *clip_name, const channels_t channels, BitDepth bit_depth, const Position *start_pos, unsigned int track_name_hash, int lane_pos, int idx_inside_lane, GError **error)
Creates a region for audio data.
bool audio_region_fix_positions(ZRegion *self, double frames_per_tick)
Fixes off-by-one rounding errors when changing BPM or sample rate which result in the looped part bei...
REALTIME HOT NONNULL void audio_region_fill_stereo_ports(ZRegion *self, const EngineProcessTimeInfo *const time_nfo, StereoPorts *stereo_ports)
Fills audio data from the region.
uint_fast64_t unsigned_frame_t
Unsigned type for frame index.
Definition types.h:60
BitDepth
Bit depth.
Definition audio.h:29
unsigned int channels_t
Number of channels.
Definition types.h:44
Position struct and API.
Audio clips for the pool.
Definition clip.h:33
A Channel is part of a Track (excluding Tracks that don't have Channels) and contains information rel...
Definition channel.h:61
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition types.h:138
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:129
L & R port, for convenience.
Definition port.h:562
Track to be inserted into the Project's Tracklist.
Definition track.h:186
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
Definition region.h:77
Custom types.