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:
authorJoerg Mueller <nexyon@gmail.com>2010-02-08 17:43:44 +0300
committerJoerg Mueller <nexyon@gmail.com>2010-02-08 17:43:44 +0300
commit6c8e3e303d15b59df4c592244a7650021b4e8bbb (patch)
treedc4d0693751795b506b7c4b3fea39875628b8e76 /release
parent03bdfb6f312a0259a4bf3e560bff12fb50975a55 (diff)
2.5 Audio:
- Python script to crossfade two sound strips in the sequencer - Fix for the libsamplerate code producing awful audio when resampling sequencer strips - Changed default resampler to a linear one (as temporary workaround for a bug that seems to be in the samplerate code) - Fix for the OpenAL device to return a more accurate playback position
Diffstat (limited to 'release')
-rw-r--r--release/scripts/op/sequencer.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py
new file mode 100644
index 00000000000..e78084b3a7b
--- /dev/null
+++ b/release/scripts/op/sequencer.py
@@ -0,0 +1,76 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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
+# of the License, or (at your option) any later version.
+#
+# 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,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+class SequencerCrossfadeSounds(bpy.types.Operator):
+ '''Do crossfading volume animation of two selected sound strips.'''
+
+ bl_idname = "sequencer.crossfade_sounds"
+ bl_label = "Crossfade sounds"
+ bl_register = True
+ bl_undo = True
+
+ def poll(self, context):
+ if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
+ return context.scene.sequence_editor.active_strip.type == 'SOUND'
+ else:
+ return False
+
+ def execute(self, context):
+ seq1 = None
+ seq2 = None
+ for s in context.scene.sequence_editor.sequences:
+ if s.selected and s.type == 'SOUND':
+ if seq1 == None:
+ seq1 = s
+ elif seq2 == None:
+ seq2 = s
+ else:
+ seq2 = None
+ break
+ if seq2 == None:
+ self.report({'ERROR'}, "Select 2 sound strips.")
+ return {'CANCELLED'}
+ if seq1.start_frame_final > seq2.start_frame_final:
+ s = seq1
+ seq1 = seq2
+ seq2 = s
+ if seq1.end_frame_final > seq2.start_frame_final:
+ tempcfra = context.scene.current_frame
+ context.scene.current_frame = seq2.start_frame_final
+ seq1.keyframe_insert('volume')
+ context.scene.current_frame = seq1.end_frame_final
+ seq1.volume = 0
+ seq1.keyframe_insert('volume')
+ seq2.keyframe_insert('volume')
+ context.scene.current_frame = seq2.start_frame_final
+ seq2.volume = 0
+ seq2.keyframe_insert('volume')
+ context.scene.current_frame = tempcfra
+ return {'FINISHED'}
+ else:
+ self.report({'ERROR'}, "The selected strips don't overlap.")
+ return {'CANCELLED'}
+
+bpy.types.register(SequencerCrossfadeSounds)
+
+if __name__ == "__main__":
+ bpy.ops.sequencer.crossfade_sounds()