Blender  V2.93
BKE_sound.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 #pragma once
20 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define SOUND_WAVE_SAMPLES_PER_SECOND 250
30 
31 #if defined(WITH_AUDASPACE)
32 # include <AUD_Device.h>
33 #endif
34 
35 struct Depsgraph;
36 struct Main;
37 struct Sequence;
38 struct bSound;
39 
40 typedef struct SoundWaveform {
41  int length;
42  float *data;
44 
45 void BKE_sound_init_once(void);
46 void BKE_sound_exit_once(void);
47 
49 
50 void BKE_sound_init(struct Main *main);
51 
52 void BKE_sound_init_main(struct Main *bmain);
53 
54 void BKE_sound_exit(void);
55 
56 void BKE_sound_force_device(const char *device);
57 
58 struct bSound *BKE_sound_new_file(struct Main *main, const char *filepath);
59 struct bSound *BKE_sound_new_file_exists_ex(struct Main *bmain,
60  const char *filepath,
61  bool *r_exists);
62 struct bSound *BKE_sound_new_file_exists(struct Main *bmain, const char *filepath);
63 
64 // XXX unused currently
65 #if 0
66 struct bSound *BKE_sound_new_buffer(struct Main *bmain, struct bSound *source);
67 
68 struct bSound *BKE_sound_new_limiter(struct Main *bmain,
69  struct bSound *source,
70  float start,
71  float end);
72 #endif
73 
74 void BKE_sound_cache(struct bSound *sound);
75 
76 void BKE_sound_delete_cache(struct bSound *sound);
77 
78 void BKE_sound_reset_runtime(struct bSound *sound);
79 void BKE_sound_load(struct Main *main, struct bSound *sound);
80 void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
81 
82 /* Matches AUD_Channels. */
83 typedef enum eSoundChannels {
94 
95 typedef struct SoundInfo {
96  struct {
98  } specs;
99  float length;
100  double start_offset;
102 
103 /* Get information about given sound. Returns truth on success., false if sound can not be loaded
104  * or if the codes is not supported. */
105 bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info);
106 
107 #if defined(WITH_AUDASPACE)
108 AUD_Device *BKE_sound_mixdown(const struct Scene *scene,
109  AUD_DeviceSpecs specs,
110  int start,
111  float volume);
112 #endif
113 
116 void BKE_sound_ensure_scene(struct Scene *scene);
117 
119 
120 void BKE_sound_lock(void);
121 void BKE_sound_unlock(void);
122 
124 
125 void BKE_sound_mute_scene(struct Scene *scene, int muted);
126 
127 void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene);
128 
130 
132  struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
134 
136  struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
137 void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
138 
139 void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
140 
141 void BKE_sound_mute_scene_sound(void *handle, char mute);
142 
144  void *handle,
145  int startframe,
146  int endframe,
147  int frameskip,
148  double audio_offset);
149 void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
150 
151 void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
152 
153 void BKE_sound_set_cfra(int cfra);
154 
155 void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
156 
157 void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated);
158 
159 void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
160 
161 void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated);
162 
163 void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
164 
166 
168 
169 void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
170 
172 
174 
175 void BKE_sound_free_waveform(struct bSound *sound);
176 
177 void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, short *stop);
178 
180 
181 void *BKE_sound_get_factory(void *sound);
182 
183 float BKE_sound_get_length(struct Main *bmain, struct bSound *sound);
184 
185 char **BKE_sound_get_device_names(void);
186 
187 typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, double time);
188 
190 void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time);
191 
192 /* Dependency graph evaluation. */
193 
194 struct Depsgraph;
195 
196 void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
197 
198 #ifdef __cplusplus
199 }
200 #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:187
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_read_waveform(struct Main *bmain, struct bSound *sound, short *stop)
void BKE_sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip, double audio_offset)
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)
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:83
@ SOUND_CHANNELS_STEREO
Definition: BKE_sound.h:86
@ SOUND_CHANNELS_SURROUND5
Definition: BKE_sound.h:89
@ SOUND_CHANNELS_SURROUND61
Definition: BKE_sound.h:91
@ SOUND_CHANNELS_STEREO_LFE
Definition: BKE_sound.h:87
@ SOUND_CHANNELS_SURROUND71
Definition: BKE_sound.h:92
@ SOUND_CHANNELS_INVALID
Definition: BKE_sound.h:84
@ SOUND_CHANNELS_SURROUND51
Definition: BKE_sound.h:90
@ SOUND_CHANNELS_MONO
Definition: BKE_sound.h:85
@ SOUND_CHANNELS_SURROUND4
Definition: BKE_sound.h:88
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
double time
Scene scene
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
int main(int argc, char **argv)
Definition: msgfmt.c:457
Definition: BKE_main.h:116
struct SoundInfo::@62 specs
eSoundChannels channels
Definition: BKE_sound.h:97
float length
Definition: BKE_sound.h:99
double start_offset
Definition: BKE_sound.h:100
float * data
Definition: BKE_sound.h:42
char filepath[1024]