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 02:41:17 +0300
committerJoerg Mueller <nexyon@gmail.com>2010-02-08 02:41:17 +0300
commit9827a3e9eac70f68db6dc16d03016c51b7ece3f0 (patch)
tree8825b454008d3b97a64018884c179ea94874af44 /source/blender/editors/space_sequencer/sequencer_draw.c
parent2f72b91a54faa7cfbdfd97eff608c8911df1d221 (diff)
2.5 Audio:
- recode of the whole sequencer audio handling - encode audio flag removed, instead you choose None as audio codec, added None for video codec too - ffmpeg formats/codecs: enabled: theora, ogg, vorbis; added: matroska, flac (not working, who can fix?), mp3, wav - sequencer wave drawing - volume animation (now also working when mixing down to a file!) - made sequencer strip position and length values unanimatable
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index b3682681fd7..5339acf74d9 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -49,7 +49,8 @@
#include "BKE_sequencer.h"
#include "BKE_scene.h"
#include "BKE_utildefines.h"
-
+#include "BKE_sound.h"
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -172,6 +173,38 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, char *col)
}
}
+static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
+{
+ /*
+ x1 is the starting x value to draw the wave,
+ x2 the end x value, same for y1 and y2
+ stepsize is width of a pixel.
+ */
+ if(seq->sound->cache)
+ {
+ int i;
+ int length = floor((x2-x1)/stepsize)+1;
+ float ymid = (y1+y2)/2;
+ float yscale = (y2-y1)/2;
+ float* samples = malloc(length * sizeof(float) * 2);
+ if(!samples)
+ return;
+ if(sound_read_sound_buffer(seq->sound, samples, length) != length)
+ {
+ free(samples);
+ return;
+ }
+ glBegin(GL_LINES);
+ for(i = 0; i < length; i++)
+ {
+ glVertex2f(x1+i*stepsize, ymid + samples[i * 2] * yscale);
+ glVertex2f(x1+i*stepsize, ymid + samples[i * 2 + 1] * yscale);
+ }
+ glEnd();
+ free(samples);
+ }
+}
+
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
@@ -557,6 +590,9 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence *
x1= seq->startdisp;
x2= seq->enddisp;
+ /* draw sound wave */
+ if(seq->type == SEQ_SOUND) drawseqwave(seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
+
get_seq_color3ubv(scene, seq, col);
if (G.moving && (seq->flag & SELECT)) {
if(seq->flag & SEQ_OVERLAP) {