Blender  V3.3
BKE_sound.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 #pragma once
4 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define SOUND_WAVE_SAMPLES_PER_SECOND 250
14 
15 #if defined(WITH_AUDASPACE)
16 # include <AUD_Device.h>
17 #endif
18 
19 struct Depsgraph;
20 struct Main;
21 struct Sequence;
22 struct bSound;
23 struct SoundInfo;
24 
25 typedef struct SoundWaveform {
26  int length;
27  float *data;
29 
30 void BKE_sound_init_once(void);
31 void BKE_sound_exit_once(void);
32 
34 
35 void BKE_sound_init(struct Main *main);
36 
37 void BKE_sound_init_main(struct Main *bmain);
38 
39 void BKE_sound_exit(void);
40 
41 void BKE_sound_force_device(const char *device);
42 
43 struct bSound *BKE_sound_new_file(struct Main *main, const char *filepath);
44 struct bSound *BKE_sound_new_file_exists_ex(struct Main *bmain,
45  const char *filepath,
46  bool *r_exists);
47 struct bSound *BKE_sound_new_file_exists(struct Main *bmain, const char *filepath);
48 
49 #if 0 /* UNUSED */
50 struct bSound *BKE_sound_new_buffer(struct Main *bmain, struct bSound *source);
51 
52 struct bSound *BKE_sound_new_limiter(struct Main *bmain,
53  struct bSound *source,
54  float start,
55  float end);
56 #endif
57 
58 void BKE_sound_cache(struct bSound *sound);
59 
60 void BKE_sound_delete_cache(struct bSound *sound);
61 
62 void BKE_sound_reset_runtime(struct bSound *sound);
63 void BKE_sound_load(struct Main *main, struct bSound *sound);
64 void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
65 
66 /* Matches AUD_Channels. */
67 typedef enum eSoundChannels {
78 
79 typedef struct SoundInfo {
80  struct {
83  } specs;
84  float length;
86 
87 typedef struct SoundStreamInfo {
88  double duration;
89  double start;
91 
92 /* Get information about given sound. Returns truth on success., false if sound can not be loaded
93  * or if the codes is not supported. */
94 bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info);
95 
96 /* Get information about given sound. Returns truth on success., false if sound can not be loaded
97  * or if the codes is not supported. */
99  const char *filepath,
100  int stream,
101  SoundStreamInfo *sound_info);
102 
103 #if defined(WITH_AUDASPACE)
104 AUD_Device *BKE_sound_mixdown(const struct Scene *scene,
105  AUD_DeviceSpecs specs,
106  int start,
107  float volume);
108 #endif
109 
112 void BKE_sound_ensure_scene(struct Scene *scene);
113 
115 
116 void BKE_sound_lock(void);
117 void BKE_sound_unlock(void);
118 
120 
121 void BKE_sound_mute_scene(struct Scene *scene, int muted);
122 
123 void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene);
124 
126 
128  struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
130 
132  struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
133 void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
134 
135 void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
136 
137 void BKE_sound_mute_scene_sound(void *handle, char mute);
138 
140  void *handle,
141  int startframe,
142  int endframe,
143  int frameskip,
144  double audio_offset);
145 void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
146 
147 void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
148 
149 void BKE_sound_set_cfra(int cfra);
150 
151 void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
152 
153 void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated);
154 
155 void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
156 
157 void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated);
158 
159 void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
160 
162 
164 
165 void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
166 
168 
170 
171 void BKE_sound_free_waveform(struct bSound *sound);
172 
173 void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, short *stop);
174 
176 
177 void *BKE_sound_get_factory(void *sound);
178 
179 float BKE_sound_get_length(struct Main *bmain, struct bSound *sound);
180 
181 char **BKE_sound_get_device_names(void);
182 
183 typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, double time);
184 
186 void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time);
187 
188 /* Dependency graph evaluation. */
189 
190 struct Depsgraph;
191 
192 void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
193 
194 #ifdef __cplusplus
195 }
196 #endif
void * BKE_sound_scene_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
float BKE_sound_get_length(struct Main *bmain, struct bSound *sound)
void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback)
void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated)
void BKE_sound_load(struct Main *main, struct bSound *sound)
void BKE_sound_create_scene(struct Scene *scene)
void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated)
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene)
struct bSound * BKE_sound_new_file(struct Main *main, const char *filepath)
void BKE_sound_init_once(void)
void BKE_sound_set_scene_volume(struct Scene *scene, float volume)
struct bSound * BKE_sound_new_file_exists(struct Main *bmain, const char *filepath)
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_ensure_loaded(struct Main *bmain, struct bSound *sound)
void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time)
void(* SoundJackSyncCallback)(struct Main *bmain, int mode, double time)
Definition: BKE_sound.h:183
struct SoundInfo SoundInfo
void BKE_sound_reset_scene_specs(struct Scene *scene)
char ** BKE_sound_get_device_names(void)
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_read_waveform(struct Main *bmain, struct bSound *sound, short *stop)
void BKE_sound_ensure_scene(struct Scene *scene)
void * BKE_sound_add_scene_sound(struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip)
int BKE_sound_scene_playing(struct Scene *scene)
struct bSound * BKE_sound_new_file_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists)
void BKE_sound_mute_scene_sound(void *handle, char mute)
void BKE_sound_init_main(struct Main *bmain)
void BKE_sound_reset_scene_runtime(struct Scene *scene)
void BKE_sound_stop_scene(struct Scene *scene)
void BKE_sound_set_cfra(int cfra)
void BKE_sound_cache(struct bSound *sound)
bool BKE_sound_stream_info_get(struct Main *main, const char *filepath, int stream, SoundStreamInfo *sound_info)
void BKE_sound_update_scene_listener(struct Scene *scene)
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound)
void * BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
void BKE_sound_force_device(const char *device)
void BKE_sound_unlock(void)
void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound)
void * BKE_sound_get_factory(void *sound)
void * BKE_sound_get_device(void)
void BKE_sound_destroy_scene(struct Scene *scene)
void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated)
void BKE_sound_free_waveform(struct bSound *sound)
void BKE_sound_reset_runtime(struct bSound *sound)
void BKE_sound_init(struct Main *main)
void BKE_sound_exit_once(void)
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
void * BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence)
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:67
@ SOUND_CHANNELS_STEREO
Definition: BKE_sound.h:70
@ SOUND_CHANNELS_SURROUND5
Definition: BKE_sound.h:73
@ SOUND_CHANNELS_SURROUND61
Definition: BKE_sound.h:75
@ SOUND_CHANNELS_STEREO_LFE
Definition: BKE_sound.h:71
@ SOUND_CHANNELS_SURROUND71
Definition: BKE_sound.h:76
@ SOUND_CHANNELS_INVALID
Definition: BKE_sound.h:68
@ SOUND_CHANNELS_SURROUND51
Definition: BKE_sound.h:74
@ SOUND_CHANNELS_MONO
Definition: BKE_sound.h:69
@ SOUND_CHANNELS_SURROUND4
Definition: BKE_sound.h:72
struct SoundStreamInfo SoundStreamInfo
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
int main(int argc, char *argv[])
double time
Scene scene
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
SyclQueue void void size_t num_bytes void
Definition: BKE_main.h:121
struct SoundInfo::@63 specs
int samplerate
Definition: BKE_sound.h:82
eSoundChannels channels
Definition: BKE_sound.h:81
float length
Definition: BKE_sound.h:84
double start
Definition: BKE_sound.h:89
double duration
Definition: BKE_sound.h:88
float * data
Definition: BKE_sound.h:27
char filepath[1024]