[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30434] branches/soc-2010-nexyon/source/ blender: Fixed sound wave display bug for sounds that are not full length.
Joerg Mueller
nexyon at gmail.com
Sat Jul 17 15:37:28 CEST 2010
Revision: 30434
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30434
Author: nexyon
Date: 2010-07-17 15:37:28 +0200 (Sat, 17 Jul 2010)
Log Message:
-----------
Fixed sound wave display bug for sounds that are not full length.
Modified Paths:
--------------
branches/soc-2010-nexyon/source/blender/blenkernel/BKE_sound.h
branches/soc-2010-nexyon/source/blender/blenkernel/intern/sound.c
branches/soc-2010-nexyon/source/blender/editors/space_sequencer/sequencer_draw.c
Modified: branches/soc-2010-nexyon/source/blender/blenkernel/BKE_sound.h
===================================================================
--- branches/soc-2010-nexyon/source/blender/blenkernel/BKE_sound.h 2010-07-17 13:31:33 UTC (rev 30433)
+++ branches/soc-2010-nexyon/source/blender/blenkernel/BKE_sound.h 2010-07-17 13:37:28 UTC (rev 30434)
@@ -94,6 +94,6 @@
int sound_scene_playing(struct Scene *scene);
-int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length);
+int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end);
#endif
Modified: branches/soc-2010-nexyon/source/blender/blenkernel/intern/sound.c
===================================================================
--- branches/soc-2010-nexyon/source/blender/blenkernel/intern/sound.c 2010-07-17 13:31:33 UTC (rev 30433)
+++ branches/soc-2010-nexyon/source/blender/blenkernel/intern/sound.c 2010-07-17 13:37:28 UTC (rev 30434)
@@ -468,7 +468,9 @@
return -1;
}
-int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length)
+int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end)
{
- return AUD_readSound(sound->cache, buffer, length);
+ AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end);
+ return AUD_readSound(limiter, buffer, length);
+ AUD_unload(limiter);
}
Modified: branches/soc-2010-nexyon/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- branches/soc-2010-nexyon/source/blender/editors/space_sequencer/sequencer_draw.c 2010-07-17 13:31:33 UTC (rev 30433)
+++ branches/soc-2010-nexyon/source/blender/editors/space_sequencer/sequencer_draw.c 2010-07-17 13:37:28 UTC (rev 30434)
@@ -168,7 +168,7 @@
}
}
-static void drawseqwave(Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
+static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
{
/*
x1 is the starting x value to draw the wave,
@@ -184,7 +184,9 @@
float* samples = MEM_mallocN(length * sizeof(float) * 2, "seqwave_samples");
if(!samples)
return;
- if(sound_read_sound_buffer(seq->sound, samples, length) != length)
+ if(sound_read_sound_buffer(seq->sound, samples, length,
+ (seq->startofs + seq->anim_startofs)/FPS,
+ (seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS) != length)
{
MEM_freeN(samples);
return;
@@ -636,7 +638,7 @@
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);
+ if(seq->type == SEQ_SOUND) drawseqwave(scene, 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)) {
More information about the Bf-blender-cvs
mailing list