2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_SOUND_H__
|
|
|
|
#define __BKE_SOUND_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
2011-08-09 14:10:32 +00:00
|
|
|
#define SOUND_WAVE_SAMPLES_PER_SECOND 250
|
|
|
|
|
2017-08-18 08:24:12 +02:00
|
|
|
#if defined(WITH_AUDASPACE)
|
|
|
|
# include <AUD_Device.h>
|
2014-03-04 13:44:15 +01:00
|
|
|
#endif
|
|
|
|
|
2009-08-09 21:16:39 +00:00
|
|
|
struct Main;
|
2010-02-07 23:41:17 +00:00
|
|
|
struct Sequence;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct bSound;
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2012-05-10 15:22:29 +00:00
|
|
|
typedef struct SoundWaveform {
|
2011-08-09 14:10:32 +00:00
|
|
|
int length;
|
|
|
|
float *data;
|
|
|
|
} SoundWaveform;
|
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_init_once(void);
|
|
|
|
void BKE_sound_exit_once(void);
|
2010-04-24 16:35:16 +00:00
|
|
|
|
2015-07-29 10:43:32 +10:00
|
|
|
void *BKE_sound_get_device(void);
|
2014-11-13 00:33:28 +13:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_init(struct Main *main);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_init_main(struct Main *bmain);
|
2011-08-09 08:38:14 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_exit(void);
|
2006-11-25 13:07:28 +00:00
|
|
|
|
2015-07-24 15:44:17 +02:00
|
|
|
void BKE_sound_force_device(const char *device);
|
2009-12-07 20:39:57 +00:00
|
|
|
|
2015-10-06 19:40:15 +11:00
|
|
|
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 11:37:38 +00:00
|
|
|
|
2009-08-09 21:16:39 +00:00
|
|
|
// XXX unused currently
|
|
|
|
#if 0
|
2015-03-26 11:39:08 +01:00
|
|
|
struct bSound *BKE_sound_new_buffer(struct Main *bmain, struct bSound *source);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2015-03-26 11:39:08 +01:00
|
|
|
struct bSound *BKE_sound_new_limiter(struct Main *bmain, struct bSound *source, float start, float end);
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_cache(struct bSound *sound);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_delete_cache(struct bSound *sound);
|
2009-08-26 18:20:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_load(struct Main *main, struct bSound *sound);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2012-05-10 15:22:29 +00:00
|
|
|
void BKE_sound_free(struct bSound *sound);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_sound_copy_data(struct Main *bmain, struct bSound *sound_dst, const struct bSound *sound_src, const int flag);
|
|
|
|
|
2016-07-21 16:09:08 +02:00
|
|
|
void BKE_sound_make_local(struct Main *bmain, struct bSound *sound, const bool lib_local);
|
|
|
|
|
2017-08-18 08:24:12 +02:00
|
|
|
#if defined(WITH_AUDASPACE)
|
2015-03-26 11:39:08 +01:00
|
|
|
AUD_Device *BKE_sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
|
2010-02-07 23:41:17 +00:00
|
|
|
#endif
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_create_scene(struct Scene *scene);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_destroy_scene(struct Scene *scene);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2017-01-06 18:18:20 +01:00
|
|
|
void BKE_sound_reset_scene_specs(struct Scene *scene);
|
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_mute_scene(struct Scene *scene, int muted);
|
2011-04-10 22:40:37 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_update_fps(struct Scene *scene);
|
2011-07-26 13:56:31 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_update_scene_listener(struct Scene *scene);
|
2011-08-03 09:25:40 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
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);
|
2010-03-20 11:15:16 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
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);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_mute_scene_sound(void *handle, char mute);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_move_scene_sound(struct Scene *scene, void *handle, int startframe, int endframe, int frameskip);
|
|
|
|
void BKE_sound_move_scene_sound_defaults(struct Scene *scene, struct Sequence *sequence);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_update_scene_sound(void *handle, struct bSound *sound);
|
2011-07-26 13:56:31 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_set_cfra(int cfra);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_set_scene_volume(struct Scene *scene, float volume);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_set_scene_sound_volume(void *handle, float volume, char animated);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_set_scene_sound_pitch(void *handle, float pitch, char animated);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated);
|
3D Audio GSoC:
Implemented basic audio animation.
* AnimatableProperty: Propper cache writing and spline interpolation for reading (the solution for stair steps in audio animation)
* Animatable properties so far are: volume, pitch, panning
* Users note: Changing the pitch of a sound results in wrong seeking, due to the resulting playback length difference.
* Users note: Panning only works for mono sources, values are in the range [-2..2], this basically controls the angle of the sound, 0 is front, -1 left, 1 right and 2 and -2 are back. Typical stereo panning only supports [-1..1].
* Disabled animation of audio related ffmpeg output parameters.
* Scene Audio Panel: 3D Listener settings also for Renderer, new Volume property (animatable!), Update/Bake buttons for animation problems, moved sampling rate and channel count here
2011-07-28 13:58:59 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_update_sequencer(struct Main *main, struct bSound *sound);
|
2011-07-26 13:56:31 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_play_scene(struct Scene *scene);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_stop_scene(struct Scene *scene);
|
2010-02-07 23:41:17 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
float BKE_sound_sync_scene(struct Scene *scene);
|
2010-02-19 12:20:29 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
int BKE_sound_scene_playing(struct Scene *scene);
|
2010-02-21 18:01:41 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_free_waveform(struct bSound *sound);
|
2011-08-09 14:10:32 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_read_waveform(struct bSound *sound, short *stop);
|
2009-08-09 21:16:39 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void BKE_sound_update_scene(struct Main *bmain, struct Scene *scene);
|
2011-08-09 08:38:14 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
void *BKE_sound_get_factory(void *sound);
|
2012-05-10 15:10:51 +00:00
|
|
|
|
2015-03-26 11:35:41 +01:00
|
|
|
float BKE_sound_get_length(struct bSound *sound);
|
2011-06-05 22:06:29 +00:00
|
|
|
|
2015-07-29 10:43:32 +10:00
|
|
|
char **BKE_sound_get_device_names(void);
|
2015-07-24 15:44:17 +02:00
|
|
|
|
2014-04-15 10:59:42 +02:00
|
|
|
#endif /* __BKE_SOUND_H__ */
|