Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-06-11 11:55:13 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-06-11 16:11:07 +0300
commit0767f95a63959e156c302520db7fbf480159abe0 (patch)
treee4f416474ae320156e9e35b1d25d2b8300ad628e /source/blender/blenkernel/BKE_sound.h
parent3a6f6c87e051edd3e98c92428980a52bafd7abf0 (diff)
Sound: Fix queries of sound info
A lot of areas were querying sound information directly using audio handle which does not exist on an original sound IDs. This change basically makes it so it's possible to query information about given sound ID, without worrying about whether it's loaded or not: if it is needed to load it first it happens automatically (no automatically-opened handles are left behind though). While this seems a bit extreme to open files on such queries it is still better than the old situation when all sound handles were opened on file load, no matter if it's needed or not. Besides, none of the changed code paths are performance critical, just handful of tools. Fixes T65696: Sequencer fails to create a new sound sequence strip via Python Fixes T65656: Audio strip - SHIFT K crashes Blender Reviewers: brecht Reviewed By: brecht Subscribers: ISS Maniphest Tasks: T65696, T65656 Differential Revision: https://developer.blender.org/D5061
Diffstat (limited to 'source/blender/blenkernel/BKE_sound.h')
-rw-r--r--source/blender/blenkernel/BKE_sound.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index 07795e8438c..4694e86f4d6 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -78,10 +78,29 @@ void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
void BKE_sound_free(struct bSound *sound);
-/* Is used by sequencer to temporarily load audio to access information about channels and
- * duration. */
-void BKE_sound_load_audio(struct Main *main, struct bSound *sound);
-void BKE_sound_free_audio(struct bSound *sound);
+/* Matches AUD_Channels. */
+typedef enum eSoundChannels {
+ SOUND_CHANNELS_INVALID = 0,
+ SOUND_CHANNELS_MONO = 1,
+ SOUND_CHANNELS_STEREO = 2,
+ SOUND_CHANNELS_STEREO_LFE = 3,
+ SOUND_CHANNELS_SURROUND4 = 4,
+ SOUND_CHANNELS_SURROUND5 = 5,
+ SOUND_CHANNELS_SURROUND51 = 6,
+ SOUND_CHANNELS_SURROUND61 = 7,
+ SOUND_CHANNELS_SURROUND71 = 8,
+} eSoundChannels;
+
+typedef struct SoundInfo {
+ struct {
+ eSoundChannels channels;
+ } specs;
+ float length;
+} SoundInfo;
+
+/* Get information about given sound. Returns truth on success., false if sound can not be loaded
+ * or if the codes is not supported. */
+bool BKE_sound_info_get(struct Main *main, struct bSound *sound, SoundInfo *sound_info);
void BKE_sound_copy_data(struct Main *bmain,
struct bSound *sound_dst,
@@ -104,7 +123,7 @@ void BKE_sound_reset_scene_specs(struct Scene *scene);
void BKE_sound_mute_scene(struct Scene *scene, int muted);
-void BKE_sound_update_fps(struct Scene *scene);
+void BKE_sound_update_fps(struct Main *bmain, struct Scene *scene);
void BKE_sound_update_scene_listener(struct Scene *scene);
@@ -150,13 +169,13 @@ int BKE_sound_scene_playing(struct Scene *scene);
void BKE_sound_free_waveform(struct bSound *sound);
-void BKE_sound_read_waveform(struct bSound *sound, short *stop);
+void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, short *stop);
void BKE_sound_update_scene(struct Depsgraph *depsgraph, struct Scene *scene);
void *BKE_sound_get_factory(void *sound);
-float BKE_sound_get_length(struct bSound *sound);
+float BKE_sound_get_length(struct Main *bmain, struct bSound *sound);
char **BKE_sound_get_device_names(void);