* Fixed mixdown volume being int instead of float
* Fixed audio muting for sequencer not working
* Added 3D listener settings with RNA (not working in GE yet)
This commit is contained in:
Joerg Mueller 2009-09-20 17:55:03 +00:00
parent 4f6ea2b683
commit 189263e1d9
5 changed files with 54 additions and 14 deletions

@ -421,6 +421,10 @@ Scene *add_scene(char *name)
sce->jumpframe = 10;
sce->r.ffcodecdata.audio_mixrate = 44100;
sce->audio.distance_model = 2.0;
sce->audio.doppler_factor = 1.0;
sce->audio.speed_of_sound = 343.3;
strcpy(sce->r.backbuf, "//backbuf");
strcpy(sce->r.pic, U.renderdir);

@ -340,7 +340,7 @@ void sound_update_playing(struct bContext *C)
for(handle = scene->sound_handles.first; handle; handle = handle->next)
{
if(cfra < handle->startframe || cfra >= handle->endframe || handle->mute)
if(cfra < handle->startframe || cfra >= handle->endframe || handle->mute || (scene->audio.flag & AUDIO_MUTE))
{
if(handle->state == AUD_STATUS_PLAYING)
{

@ -9352,13 +9352,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
*/
//do_versions_ipos_to_animato(main);
/* toolsettings */
for(scene= main->scene.first; scene; scene= scene->id.next)
{
scene->r.ffcodecdata.audio_mixrate = scene->audio.mixrate;
scene->r.ffcodecdata.audio_volume = scene->audio.main;
}
/* shader, composit and texture node trees have id.name empty, put something in
* to have them show in RNA viewer and accessible otherwise.
*/
@ -9714,6 +9707,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
for(sce= main->scene.first; sce; sce= sce->id.next)
{
if(sce->audio.main == 0.0)
sce->audio.main = 1.0;
sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
sce->r.ffcodecdata.audio_volume = sce->audio.main;
sce->audio.distance_model = 2.0;
sce->audio.doppler_factor = 1.0;
sce->audio.speed_of_sound = 343.3;
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

@ -94,7 +94,7 @@ typedef struct FFMpegCodecData {
int video_bitrate;
int audio_bitrate;
int audio_mixrate;
int audio_volume;
float audio_volume;
int gop_size;
int flags;
@ -110,8 +110,11 @@ typedef struct FFMpegCodecData {
typedef struct AudioData {
int mixrate; // 2.5: now in FFMpegCodecData: audio_mixrate
float main; // 2.5: now in FFMpegCodecData: audio_volume
float speed_of_sound;
float doppler_factor;
int distance_model;
short flag;
short pad[3];
short pad;
} AudioData;
typedef struct SceneRenderLayer {

@ -1516,7 +1516,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "ffmpeg_audio_mixrate", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ffcodecdata.audio_mixrate");
RNA_def_property_range(prop, 8000, 192000);
RNA_def_property_ui_text(prop, "Sample", "Audio samplerate(samples/s)");
RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
prop= RNA_def_property(srna, "ffmpeg_audio_volume", PROP_FLOAT, PROP_NONE);
@ -1915,6 +1915,16 @@ void RNA_def_scene(BlenderRNA *brna)
PropertyRNA *prop;
FunctionRNA *func;
static EnumPropertyItem audio_distance_model_items[] = {
{0, "NONE", 0, "None", "No distance attenuation."},
{1, "INVERSE", 0, "Inverse", "Inverse distance model."},
{2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping."},
{3, "LINEAR", 0, "Linear", "Linear distance model."},
{4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping."},
{5, "EXPONENT", 0, "Exponent", "Exponent distance model."},
{6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping."},
{0, NULL, 0, NULL, NULL}};
/* Struct definition */
srna= RNA_def_struct(brna, "Scene", "ID");
RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings.");
@ -2074,17 +2084,35 @@ void RNA_def_scene(BlenderRNA *brna)
/* Audio Settings */
prop= RNA_def_property(srna, "mute_audio", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_MUTE);
RNA_def_property_ui_text(prop, "Mute Audio", "Play back of audio from Sequence Editor will be muted.");
RNA_def_property_ui_text(prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted.");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "sync_audio", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
RNA_def_property_ui_text(prop, "Sync Audio", "Play back and sync with audio from Sequence Editor.");
RNA_def_property_ui_text(prop, "Audio Sync", "Play back and sync with audio from Sequence Editor.");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "scrub_audio", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
RNA_def_property_ui_text(prop, "Scrub Audio", "Play audio from Sequence Editor while scrubbing.");
RNA_def_property_ui_text(prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing.");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "speed_of_sound", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
RNA_def_property_range(prop, 1.0f, FLT_MAX);
RNA_def_property_ui_text(prop, "Speed of Sound", "Speed of sound for doppler effect calculation.");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "doppler_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for doppler effect calculation.");
RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "distance_model", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
RNA_def_property_enum_items(prop, audio_distance_model_items);
RNA_def_property_ui_text(prop, "Distance Model", "Distance model for distance attenuation calculation.");
RNA_def_property_update(prop, NC_SCENE, NULL);
/* Game Settings */