Blender V4.3
BKE_sound.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#define SOUND_WAVE_SAMPLES_PER_SECOND 250
15
16#if defined(WITH_AUDASPACE)
17# include <AUD_Device.h>
18#endif
19
20struct Depsgraph;
21struct Main;
22struct Sequence;
23struct bSound;
24struct SoundInfo;
25
26typedef struct SoundWaveform {
27 int length;
28 float *data;
30
31void BKE_sound_init_once(void);
32void BKE_sound_exit_once(void);
33
35
36void BKE_sound_init(struct Main *bmain);
37
38void BKE_sound_init_main(struct Main *bmain);
39
40void BKE_sound_exit(void);
41
42void BKE_sound_force_device(const char *device);
43
44struct bSound *BKE_sound_new_file(struct Main *bmain, const char *filepath);
45struct bSound *BKE_sound_new_file_exists_ex(struct Main *bmain,
46 const char *filepath,
47 bool *r_exists);
48struct bSound *BKE_sound_new_file_exists(struct Main *bmain, const char *filepath);
49
50#if 0 /* UNUSED */
51struct bSound *BKE_sound_new_buffer(struct Main *bmain, struct bSound *source);
52
53struct bSound *BKE_sound_new_limiter(struct Main *bmain,
54 struct bSound *source,
55 float start,
56 float end);
57#endif
58
59void BKE_sound_cache(struct bSound *sound);
60
61void BKE_sound_delete_cache(struct bSound *sound);
62
63void BKE_sound_reset_runtime(struct bSound *sound);
64void BKE_sound_load(struct Main *bmain, struct bSound *sound);
65void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
66
67/* Matches AUD_Channels. */
79
80typedef struct SoundInfo {
81 struct {
85 float length;
87
88typedef struct SoundStreamInfo {
89 double duration;
90 double start;
92
93/* Get information about given sound. Returns truth on success., false if sound can not be loaded
94 * or if the codes is not supported. */
95bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info);
96
97/* Get information about given sound. Returns truth on success., false if sound can not be loaded
98 * or if the codes is not supported. */
100 const char *filepath,
101 int stream,
102 SoundStreamInfo *sound_info);
103
104#if defined(WITH_AUDASPACE)
105AUD_Device *BKE_sound_mixdown(const struct Scene *scene,
106 AUD_DeviceSpecs specs,
107 int start,
108 float volume);
109#endif
110
111void BKE_sound_reset_scene_runtime(struct Scene *scene);
112void BKE_sound_create_scene(struct Scene *scene);
113void BKE_sound_ensure_scene(struct Scene *scene);
114
115void BKE_sound_destroy_scene(struct Scene *scene);
116
117void BKE_sound_lock(void);
118void BKE_sound_unlock(void);
119
120void BKE_sound_reset_scene_specs(struct Scene *scene);
121
122void BKE_sound_mute_scene(struct Scene *scene, int muted);
123
124void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene);
125
126void BKE_sound_update_scene_listener(struct Scene *scene);
127
129 struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
130
131void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
132
134 struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
135void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
136
137void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
138
139void BKE_sound_mute_scene_sound(void *handle, bool mute);
140
141void BKE_sound_move_scene_sound(const struct Scene *scene,
142 void *handle,
143 int startframe,
144 int endframe,
145 int frameskip,
146 double audio_offset);
147void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
148
149/* Join the Sequence with the structure in Audaspace, the second parameter is a bSound */
150void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
151
152/* Join the Sequence with the structure in Audaspace, the second parameter is the AUD_Sound created
153 * in Audaspace previously
154 */
155void BKE_sound_update_sequence_handle(void *handle, void *sound_handle);
156
157void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
158
160 int frame,
161 float volume,
162 char animated);
163
164void BKE_sound_set_scene_sound_pitch_at_frame(void *handle, int frame, float pitch, char animated);
165
167 int frame_start,
168 int frame_end,
169 float pitch);
170
171void BKE_sound_set_scene_sound_pan_at_frame(void *handle, int frame, float pan, char animated);
172
173void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
174
175void BKE_sound_play_scene(struct Scene *scene);
176
177void BKE_sound_stop_scene(struct Scene *scene);
178
179void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
180
181double BKE_sound_sync_scene(struct Scene *scene);
182
183int BKE_sound_scene_playing(struct Scene *scene);
184
185void BKE_sound_free_waveform(struct bSound *sound);
186
187void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, bool *stop);
188
189void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene);
190
191void *BKE_sound_get_factory(void *sound);
192
193float BKE_sound_get_length(struct Main *bmain, struct bSound *sound);
194
195char **BKE_sound_get_device_names(void);
196
197typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, double time);
198
200void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time);
201
202/* Dependency graph evaluation. */
203
204struct Depsgraph;
205
206void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
207
208#ifdef __cplusplus
209}
210#endif
void BKE_sound_set_scene_sound_pan_at_frame(void *handle, int frame, float pan, char animated)
float BKE_sound_get_length(struct Main *bmain, struct bSound *sound)
void * BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback)
void BKE_sound_create_scene(struct Scene *scene)
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
void * BKE_sound_get_factory(void *sound)
void BKE_sound_init_once(void)
void BKE_sound_set_scene_volume(struct Scene *scene, float volume)
double BKE_sound_sync_scene(struct Scene *scene)
struct SoundWaveform SoundWaveform
bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info)
void BKE_sound_lock(void)
void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound)
void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, bool *stop)
void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound)
void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time)
struct bSound * BKE_sound_new_file(struct Main *bmain, const char *filepath)
void(* SoundJackSyncCallback)(struct Main *bmain, int mode, double time)
Definition BKE_sound.h:197
struct SoundInfo SoundInfo
void BKE_sound_reset_scene_specs(struct Scene *scene)
void BKE_sound_mute_scene(struct Scene *scene, int muted)
void BKE_sound_move_scene_sound(const struct Scene *scene, void *handle, int startframe, int endframe, int frameskip, double audio_offset)
void BKE_sound_init(struct Main *bmain)
void BKE_sound_ensure_scene(struct Scene *scene)
void * BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
int BKE_sound_scene_playing(struct Scene *scene)
void BKE_sound_init_main(struct Main *bmain)
void BKE_sound_reset_scene_runtime(struct Scene *scene)
char ** BKE_sound_get_device_names(void)
void BKE_sound_stop_scene(struct Scene *scene)
struct bSound * BKE_sound_new_file_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists)
void BKE_sound_cache(struct bSound *sound)
void * BKE_sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
bool BKE_sound_stream_info_get(struct Main *main, const char *filepath, int stream, SoundStreamInfo *sound_info)
void BKE_sound_set_scene_sound_volume_at_frame(void *handle, int frame, float volume, char animated)
void BKE_sound_update_scene_listener(struct Scene *scene)
void BKE_sound_load(struct Main *bmain, struct bSound *sound)
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound)
void BKE_sound_force_device(const char *device)
void * BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_unlock(void)
void BKE_sound_set_scene_sound_pitch_constant_range(void *handle, int frame_start, int frame_end, float pitch)
void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound)
void BKE_sound_mute_scene_sound(void *handle, bool mute)
struct bSound * BKE_sound_new_file_exists(struct Main *bmain, const char *filepath)
void * BKE_sound_get_device(void)
void BKE_sound_destroy_scene(struct Scene *scene)
void BKE_sound_free_waveform(struct bSound *sound)
void BKE_sound_update_sequence_handle(void *handle, void *sound_handle)
void BKE_sound_reset_runtime(struct bSound *sound)
void BKE_sound_exit_once(void)
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
void BKE_sound_set_scene_sound_pitch_at_frame(void *handle, int frame, float pitch, char animated)
void BKE_sound_play_scene(struct Scene *scene)
void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene)
void BKE_sound_delete_cache(struct bSound *sound)
void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene)
void BKE_sound_exit(void)
eSoundChannels
Definition BKE_sound.h:68
@ SOUND_CHANNELS_STEREO
Definition BKE_sound.h:71
@ SOUND_CHANNELS_SURROUND5
Definition BKE_sound.h:74
@ SOUND_CHANNELS_SURROUND61
Definition BKE_sound.h:76
@ SOUND_CHANNELS_STEREO_LFE
Definition BKE_sound.h:72
@ SOUND_CHANNELS_SURROUND71
Definition BKE_sound.h:77
@ SOUND_CHANNELS_INVALID
Definition BKE_sound.h:69
@ SOUND_CHANNELS_SURROUND51
Definition BKE_sound.h:75
@ SOUND_CHANNELS_MONO
Definition BKE_sound.h:70
@ SOUND_CHANNELS_SURROUND4
Definition BKE_sound.h:73
struct SoundStreamInfo SoundStreamInfo
double time
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
int main()
int samplerate
Definition BKE_sound.h:83
eSoundChannels channels
Definition BKE_sound.h:82
struct SoundInfo::@58 specs
float length
Definition BKE_sound.h:85
double duration
Definition BKE_sound.h:89
float * data
Definition BKE_sound.h:28
char filepath[1024]