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:
authorMarcos Perez <pistolario>2022-05-19 21:58:55 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-05-19 22:05:23 +0300
commit89106a695afbba3d94b70645b4caaa22c2b58bc3 (patch)
treee9a57372a31e2a17c9b5ff2399d58b2c991b0909 /source/blender/blenkernel/intern/sound.c
parent9e9895b055d490b0793bc7c5662f50abafce9a24 (diff)
VSE: Display sound sample rate and channels
Display information about sound media in "Source" category in side panel similar to movie resolution and framerate. The specs are stored in the `Sequence` struct, and are extracted at the moment of struct creation. If the "source file" is changed, the specs change also. Reviewed By: ISS Differential Revision: https://developer.blender.org/D14565
Diffstat (limited to 'source/blender/blenkernel/intern/sound.c')
-rw-r--r--source/blender/blenkernel/intern/sound.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 864a4f3281b..de5589cf5dc 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -264,6 +264,14 @@ bSound *BKE_sound_new_file(Main *bmain, const char *filepath)
BLI_strncpy(sound->filepath, filepath, FILE_MAX);
/* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */
+ /* Extract sound specs for bSound */
+ SoundInfo info;
+ bool success = BKE_sound_info_get(bmain, sound, &info);
+ if (success) {
+ sound->samplerate = info.specs.samplerate;
+ sound->audio_channels = info.specs.channels;
+ }
+
sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
BLI_spin_init(sound->spinlock);
@@ -1202,6 +1210,7 @@ static bool sound_info_from_playback_handle(void *playback_handle, SoundInfo *so
AUD_SoundInfo info = AUD_getInfo(playback_handle);
sound_info->specs.channels = (eSoundChannels)info.specs.channels;
sound_info->length = info.length;
+ sound_info->specs.samplerate = info.specs.rate;
return true;
}