tornavis/source/blender/blenkernel/BKE_sound.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

211 lines
6.7 KiB
C
Raw Normal View History

/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
2002-10-12 13:37:38 +02:00
/** \file
* \ingroup bke
*/
#ifdef __cplusplus
extern "C" {
#endif
#define SOUND_WAVE_SAMPLES_PER_SECOND 250
#if defined(WITH_AUDASPACE)
# include <AUD_Device.h>
#endif
2019-06-14 02:12:10 +02:00
struct Depsgraph;
struct Main;
struct Sequence;
struct bSound;
struct SoundInfo;
2012-05-10 17:22:29 +02:00
typedef struct SoundWaveform {
int length;
float *data;
} SoundWaveform;
void BKE_sound_init_once(void);
void BKE_sound_exit_once(void);
2015-07-29 02:43:32 +02:00
void *BKE_sound_get_device(void);
void BKE_sound_init(struct Main *main);
2002-10-12 13:37:38 +02:00
void BKE_sound_init_main(struct Main *bmain);
void BKE_sound_exit(void);
void BKE_sound_force_device(const char *device);
struct bSound *BKE_sound_new_file(struct Main *main, const char *filepath);
struct bSound *BKE_sound_new_file_exists_ex(struct Main *bmain,
const char *filepath,
bool *r_exists);
struct bSound *BKE_sound_new_file_exists(struct Main *bmain, const char *filepath);
2002-10-12 13:37:38 +02:00
#if 0 /* UNUSED */
2015-03-26 11:39:08 +01:00
struct bSound *BKE_sound_new_buffer(struct Main *bmain, struct bSound *source);
2002-10-12 13:37:38 +02:00
struct bSound *BKE_sound_new_limiter(struct Main *bmain,
struct bSound *source,
float start,
float end);
2002-10-12 13:37:38 +02:00
#endif
void BKE_sound_cache(struct bSound *sound);
void BKE_sound_delete_cache(struct bSound *sound);
2009-08-26 20:20:17 +02:00
void BKE_sound_reset_runtime(struct bSound *sound);
void BKE_sound_load(struct Main *main, struct bSound *sound);
void BKE_sound_ensure_loaded(struct Main *bmain, 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;
int samplerate;
} specs;
float length;
} SoundInfo;
typedef struct SoundStreamInfo {
double duration;
double start;
} SoundStreamInfo;
/* 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);
/* 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_stream_info_get(struct Main *main,
const char *filepath,
int stream,
SoundStreamInfo *sound_info);
#if defined(WITH_AUDASPACE)
AUD_Device *BKE_sound_mixdown(const struct Scene *scene,
AUD_DeviceSpecs specs,
int start,
float volume);
#endif
void BKE_sound_reset_scene_runtime(struct Scene *scene);
void BKE_sound_create_scene(struct Scene *scene);
void BKE_sound_ensure_scene(struct Scene *scene);
void BKE_sound_destroy_scene(struct Scene *scene);
2020-03-29 07:34:23 +02:00
void BKE_sound_lock(void);
void BKE_sound_unlock(void);
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 Main *bmain, struct Scene *scene);
void BKE_sound_update_scene_listener(struct Scene *scene);
void *BKE_sound_scene_add_scene_sound(
struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *BKE_sound_scene_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void *BKE_sound_add_scene_sound(
struct Scene *scene, struct Sequence *sequence, int startframe, int endframe, int frameskip);
void *BKE_sound_add_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
2022-08-26 07:57:43 +02:00
void BKE_sound_mute_scene_sound(void *handle, bool mute);
VSE: Make time operations self-contained This patch makes it possible to manipulate strips without need to use update functions to recalculate effect and meta strips. Prior to this change function `SEQ_time_update_sequence` had to be used to update mainly effects and meta strips. This was implemented in a way that relied on sorted list of strips, which can't always be done and in rare cases this approach failed. In case of meta strips, `seqbase` had to be passed and compared with "active" one to determine whether meta strip should be updated or not. This is especially weak system that is prone to bugs when functions are used by python API functions. Finally, other strip types had startdisp` and `enddisp` fields updated by this function and a lot of code relied on these fields even if strip start, length and offsets are available. This is completely unnecessary. Implemented changes: All effects and meta strips are updated when strip handles are moved or strip is translated, without need to call any update function. Function `SEQ_time_update_sequence` has been split to `SEQ_time_update_meta_strip_range` and `seq_time_update_effects_strip_range`. These functions should be only used within sequencer module code. Meta update is used for versioning, which is only reason for it not being declared internally. Sequence fields `startdisp` and `enddisp` are now only used for effects to store strip start and end points. These fields should be used only internally within sequencer module code. Use function `SEQ_time_*_handle_frame_get` to get strip start and end points. To update effects and meta strips with reasonable performance, cache for "parent" meta strip and attached effects is added to `SequenceLookup` cache, so it shares invalidation mechanisms. All caches are populated during single iteration. There should be no functional changes. Differential Revision: https://developer.blender.org/D14990
2022-06-02 01:39:40 +02:00
void BKE_sound_move_scene_sound(const struct Scene *scene,
void *handle,
int startframe,
int endframe,
int frameskip,
double audio_offset);
void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
/* Join the Sequence with the structure in Audaspace, the second parameter is a bSound */
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
/* Join the Sequence with the structure in Audaspace, the second parameter is the AUD_Sound created
* in Audaspace previously
*/
void BKE_sound_update_sequence_handle(void *handle, void *sound_handle);
void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
void BKE_sound_set_scene_sound_volume_at_frame(void *handle,
int frame,
float volume,
char animated);
void BKE_sound_set_scene_sound_pitch_at_frame(void *handle, int frame, float pitch, char animated);
void BKE_sound_set_scene_sound_pitch_constant_range(void *handle,
int frame_start,
int frame_end,
float pitch);
void BKE_sound_set_scene_sound_pan_at_frame(void *handle, int frame, float pan, char animated);
void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
void BKE_sound_play_scene(struct Scene *scene);
void BKE_sound_stop_scene(struct Scene *scene);
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
double BKE_sound_sync_scene(struct Scene *scene);
int BKE_sound_scene_playing(struct Scene *scene);
void BKE_sound_free_waveform(struct bSound *sound);
void BKE_sound_read_waveform(struct Main *bmain, struct bSound *sound, bool *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 Main *bmain, struct bSound *sound);
2015-07-29 02:43:32 +02:00
char **BKE_sound_get_device_names(void);
typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, double time);
void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback);
void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time);
/* Dependency graph evaluation. */
struct Depsgraph;
void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
#ifdef __cplusplus
}
#endif