[xiph-commits] r17669 - trunk/squishyball
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Sat Nov 27 15:20:13 PST 2010
Author: xiphmont
Date: 2010-11-27 15:20:13 -0800 (Sat, 27 Nov 2010)
New Revision: 17669
Modified:
trunk/squishyball/main.c
trunk/squishyball/tty.c
Log:
Playback crosslap fix on loop
slider bad fix (or two)
a few segfault on loop fixes
Modified: trunk/squishyball/main.c
===================================================================
--- trunk/squishyball/main.c 2010-11-27 20:25:01 UTC (rev 17668)
+++ trunk/squishyball/main.c 2010-11-27 23:20:13 UTC (rev 17669)
@@ -1714,10 +1714,10 @@
int fragsize = fragsamples*bpf;
/* guard limits here */
- if(end<fragsize)end=fragsize;
+ if(end<fragsize*3)end=fragsize*3;
if(end>pcm->size)end=pcm->size;
if(start<0)start=0;
- if(start>pcm->size-fragsize)start=pcm->size-fragsize;
+ if(start>pcm->size-fragsize*3)start=pcm->size-fragsize*3;
/* we fill a fragment from the data buffer of the passed in pcm_t.
It's possible we'll need to crossloop from the end of the sample,
@@ -1735,7 +1735,7 @@
if(lp){
float w = fadewindow1[--lp];
for(j=0;j<cpf;j++){
- float val = get_val(A,bps)*(1.-w) + get_val(B,bps)*w;
+ float val = get_val(A,bps)*(1.f-w) + get_val(B,bps)*w;
put_val(out,val,bps);
A+=bps;
B+=bps;
@@ -1759,7 +1759,7 @@
/* Error condition; should not be possible */
fprintf(stderr,"Internal error; %ld>%ld, Monty fucked up.\n",(long)*pos,(long)pcm->size-fragsize);
exit(100);
- }else if(*pos+fragsize>=end-fragsize){
+ }else if(*pos+fragsize>end-fragsize){
int i,j;
unsigned char *A = pcm->data+*pos;
unsigned char *B = pcm->data+start;
@@ -1767,7 +1767,7 @@
if(lp<fragsamples)lp=fragsamples; /* If we're late, start immediately, but use full window */
for(i=0;i<fragsamples;i++){
- if(--lp>fragsamples){
+ if(--lp>=fragsamples){
/* still before crossloop begins */
memcpy(out,A,bpf);
A+=bpf;
@@ -1776,8 +1776,8 @@
/* crosslooping */
float w = fadewindow1[lp];
for(j=0;j<cpf;j++){
- float val = get_val(A,bps)*(1.-w) + get_val(B,bps)*w;
- put_val(out,val,bps);
+ float val = get_val(A,bps)*(1.f-w) + get_val(B,bps)*w;
+ put_val(out,bps,val);
A+=bps;
B+=bps;
out+=bps;
@@ -1791,7 +1791,7 @@
unsigned char *A = pcm->data+*pos;
memcpy(out,A,fragsize);
*loop=0;
- *pos=A-pcm->data+fragsize;
+ *pos+=fragsize;
}
}
}
@@ -1805,10 +1805,10 @@
int fragsize=fragsamples*bpf;
/* guard limits here */
- if(end<fragsize)end=fragsize;
+ if(end<fragsize*3)end=fragsize*3;
if(end>pcm->size)end=pcm->size;
if(start<0)start=0;
- if(start>pcm->size-fragsize)start=pcm->size-fragsize;
+ if(start>pcm->size-fragsize*3)start=pcm->size-fragsize*3;
/* loop is never in progress for a fill_fragment2; called only during a seek crosslap */
unsigned char *A = pcm->data+*pos;
@@ -2272,15 +2272,18 @@
if(restart_mode>2)restart_mode=0;
break;
case 's':
- if(current_pos<end_pos)
- start_pos=current_pos;
+ start_pos=current_pos;
+ if(start_pos<0)start_pos=0;
+ if(start_pos>pcm[0]->size-fragsize*3)
+ start_pos=pcm[0]->size-fragsize*3;
break;
case 'S':
start_pos=0;
break;
case 'e':
- if(current_pos>start_pos)
- end_pos=current_pos;
+ end_pos=current_pos;
+ if(end_pos<fragsize*3)end_pos=fragsize*3;
+ if(end_pos>pcm[0]->size)end_pos=pcm[0]->size;
break;
case 'E':
end_pos=pcm[0]->size;
Modified: trunk/squishyball/tty.c
===================================================================
--- trunk/squishyball/tty.c 2010-11-27 20:25:01 UTC (rev 17668)
+++ trunk/squishyball/tty.c 2010-11-27 23:20:13 UTC (rev 17669)
@@ -159,28 +159,17 @@
static void draw_playbar(int row){
int pre = rint(p_st/p_len*columns);
int post = rint((p_len-p_end)/p_len*columns);
- int cur = rint(p_cur/(p_len-1)*columns);
int i;
playrow=row;
i=0;
min_mvcur(0,row);
- min_gfx(1);
- min_color(COLOR_YELLOW,COLOR_CYAN);
- min_bold(1);
- if(pre>0){
- while(i<pre){
- min_putchar(' ');
- i++;
- }
- }
- min_bg(COLOR_BLACK);
- while(i<cur){
+ min_bg(COLOR_CYAN);
+ while(i<pre){
min_putchar(' ');
i++;
}
- min_putchar(ACS_VLINE);
- i++;
+ min_bg(COLOR_BLACK);
while(i<(columns-post)){
min_putchar(' ');
i++;
@@ -343,13 +332,18 @@
}
min_putchar(' ');
draw_playbar(playrow);
+ force=1;
+ panel_update_current(p_cur);
+ force=0;
}
}
+static int was=-1;
void panel_update_current(double time){
+ int now = floor(time/p_len*columns);
+ if(now>=columns)now=columns-1;
if(force || p_cur!=time){
- int was = rint(p_cur/(p_len-1)*columns);
- int now = rint(time/(p_len-1)*columns);
+
p_cur=time;
min_mvcur(columns/2-7,timerow);
min_putchar(' ');
@@ -359,20 +353,23 @@
}
min_putchar(' ');
- if(was!=now){
+ if(was!=now || force){
int pre = rint(p_st/p_len*columns);
int post = rint((p_len-p_end)/p_len*columns);
min_bold(1);
min_gfx(1);
- min_mvcur(was,playrow);
- if(was<pre || (columns-was)<post){
- min_color(COLOR_YELLOW,COLOR_CYAN);
- }else{
- min_color(COLOR_YELLOW,COLOR_BLACK);
+ if(was>=0){
+ min_mvcur(was,playrow);
+ if(was<pre || (columns-was)<post){
+ min_color(COLOR_YELLOW,COLOR_CYAN);
+ }else{
+ min_color(COLOR_YELLOW,COLOR_BLACK);
+ }
+ min_putchar(' ');
}
- min_putchar(' ');
+ was=now;
min_mvcur(now,playrow);
if(now<pre || (columns-now)<post){
@@ -383,6 +380,7 @@
min_putchar(ACS_VLINE);
}
min_unset();
+ min_flush();
}
}
@@ -401,6 +399,9 @@
}
min_putchar(' ');
draw_playbar(playrow);
+ force=1;
+ panel_update_current(p_cur);
+ force=0;
}
}
More information about the commits
mailing list