diff options
author | Joerg Mueller <nexyon@gmail.com> | 2009-08-26 18:19:29 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2009-08-26 18:19:29 +0400 |
commit | 47ce314bc5be90f63799c43805ef509c22d7fcf2 (patch) | |
tree | 615764ca3f4816603fd957c59dd3b6153e59bb8a /source/blender/editors/space_sequencer/sequencer_draw.c | |
parent | c97d964064bfb9d64e3f866f62095ccdc32a80fd (diff) |
2.5 Sound:
- Cleaned up DNA_sound_types.h, especially the bSound structure.
- Fixed a caching bug.
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 367bfb68208..76bed3772b1 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -225,108 +225,6 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, } } -static void drawseqwave(Scene *scene, View2D *v2d, Sequence *seq, float x1, float y1, float x2, float y2, int winx) -{ - /* - x1 is the starting x value to draw the wave, - x2 the end x value, same for y1 and y2 - winx is the zoom level. - */ - - float - f, /* floating point value used to store the X draw location for the wave lines when openGL drawing*/ - midy, /* fast access to the middle location (y1+y2)/2 */ - clipxmin, /* the minimum X value, clip this with the window */ - clipxmax, /* the maximum X value, clip this with the window */ - sample_step, /* steps to move per sample, floating value must later translate into an int */ - fsofs, /* steps to move per sample, floating value must later translate into an int */ - feofs_sofs, /* */ - sound_width, /* convenience: x2-x1 */ - wavemulti; /* scale the samples by this value when GL_LINE drawing so it renders the right height */ - - int - offset, /* initial offset value for the wave drawing */ - offset_next, /* when in the wave drawing loop this value is the samples intil the next vert */ - sofs, /* Constrained offset value (~3) for the wave, start */ - eofs, /* ditto, end */ - wavesample, /* inner loop storage if the current wave sample value, used to make the 2 values below */ - wavesamplemin, /* used for finding the min and max wave peaks */ - wavesamplemax, /* ditto */ - subsample_step=4; /* when the sample step is 4 every sample of - the wave is evaluated for min and max values used to draw the wave, - however this is slow ehrn zoomed out so when the sample step is above - 1 (the larger the further out the zoom is) so not evaluate all samples, only some. */ - - signed short* s; - bSound *sound; - uint8_t *stream; - -// XXX audio_makestream(seq->sound); - if(seq->sound==NULL || seq->sound->stream==NULL) return; - - if (seq->flag & SEQ_MUTE) glColor3ub(0x70, 0x80, 0x80); else glColor3ub(0x70, 0xc0, 0xc0); - - sofs = ((int)( FRA2TIME(seq->startdisp-seq->start+seq->anim_startofs)*(float)scene->r.audio.mixrate*4.0 )) & (~3); - eofs = ((int)( FRA2TIME(seq->enddisp-seq->start+seq->anim_startofs)*(float)scene->r.audio.mixrate*4.0 )) & (~3); - - /* clip the drawing area to the screen bounds to save time */ - sample_step= (v2d->cur.xmax - v2d->cur.xmin)/winx; - clipxmin= MAX2(x1, v2d->cur.xmin); - clipxmax= MIN2(x2, v2d->cur.xmax); - - if (sample_step > 1) - subsample_step= ((int)(subsample_step*sample_step*8)) & (~3); - - /* for speedy access */ - midy = (y1+y2)/2; - fsofs= (float)sofs; - feofs_sofs= (float)(eofs-sofs); - sound_width= x2-x1; - sound = seq->sound; - stream = sound->stream; - wavemulti = (y2-y1)/196605; /*y2-y1 is the height*/ - wavesample=0; - - /* we need to get the starting offset value, excuse the duplicate code */ - f=clipxmin; - offset= (int) (fsofs + ((f-x1)/sound_width) * feofs_sofs) & (~3); - - /* start the loop, draw a line per sample_step -sample_step is about 1 line drawn per pixel */ - glBegin(GL_LINES); - for (f=x1+sample_step; f<=clipxmax; f+=sample_step) { - - offset_next = (int) (fsofs + ((f-x1)/sound_width) * feofs_sofs) & (~3); - if (f > v2d->cur.xmin) { - /* if this is close to the last sample just exit */ - if (offset_next >= sound->streamlen) break; - - wavesamplemin = 131070; - wavesamplemax = -131070; - - /*find with high and low of the waveform for this draw, - evaluate small samples to find this range */ - while (offset < offset_next) { - s = (signed short*)(stream+offset); - - wavesample = s[0]*2 + s[1]; - if (wavesamplemin>wavesample) - wavesamplemin=wavesample; - if (wavesamplemax<wavesample) - wavesamplemax=wavesample; - offset+=subsample_step; - } - /* draw the wave line, looks good up close and zoomed out */ - glVertex2f(f, midy-(wavemulti*wavesamplemin) ); - glVertex2f(f, midy-(wavemulti*wavesamplemax) ); - } else { - while (offset < offset_next) offset+=subsample_step; - } - - offset=offset_next; - } - glEnd(); -} - /* draw a handle, for each end of a sequence strip */ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction) { @@ -660,10 +558,6 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, SpaceSeq *sseq, Sequence * draw_shadedstrip(seq, background_col, x1, y1, x2, y2); /* draw additional info and controls */ - // XXX - if(0) // (seq->type == SEQ_SOUND) - drawseqwave(scene, v2d, seq, x1, y1, x2, y2, ar->winx); - if (!is_single_image) draw_seq_extensions(scene, sseq, seq); |