[xiph-cvs] cvs commit: postfish input.c input.h main.c mainpanel.c multibar.c multibar.h output.c output.h version.h
Monty
xiphmont at xiph.org
Thu Oct 16 16:10:17 PDT 2003
xiphmont 03/10/16 19:10:17
Modified: . input.c input.h main.c mainpanel.c multibar.c
multibar.h output.c output.h version.h
Log:
Implement pipeline reset
Abstract playback pause and halt
connect |<< control
Revision Changes Path
1.8 +15 -7 postfish/input.c
Index: input.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/input.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- input.c 16 Oct 2003 20:39:36 -0000 1.7
+++ input.c 16 Oct 2003 23:10:16 -0000 1.8
@@ -75,7 +75,7 @@
pthread_mutex_unlock(&master_mutex);
}
-off_t input_time_to_cursor(char *t){
+off_t input_time_to_cursor(const char *t){
char temp[14];
char *c;
@@ -392,10 +392,10 @@
pthread_mutex_unlock(&master_mutex);
}
-int pull_input_feedback(double *peak,double *rms,off_t *cursor,int *n){
+int pull_input_feedback(double *peak,double *rms,off_t *cursor,int *nn){
input_feedback *f;
- int i,j;
- *n=input_ch+2;
+ int i,j,n=input_ch+2;
+ if(nn)*nn=n;
pthread_mutex_lock(&master_mutex);
if(feedback_list_tail){
@@ -410,9 +410,12 @@
}
pthread_mutex_unlock(&master_mutex);
- memcpy(rms,f->rms,sizeof(*rms)* *n);
- memcpy(peak,f->peak,sizeof(*peak)* *n);
- *cursor=f->cursor;
+ if(rms)
+ memcpy(rms,f->rms,sizeof(*rms)*n);
+ if(peak)
+ memcpy(peak,f->peak,sizeof(*peak)*n);
+ if(cursor)
+ *cursor=f->cursor;
pthread_mutex_lock(&master_mutex);
f->next=feedback_pool;
@@ -553,5 +556,10 @@
return &out;
}
+void input_reset(void){
+ while(pull_input_feedback(NULL,NULL,NULL,NULL));
+ return;
+}
+
<p><p>1.4 +2 -1 postfish/input.h
Index: input.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/input.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- input.h 16 Oct 2003 19:28:47 -0000 1.3
+++ input.h 16 Oct 2003 23:10:16 -0000 1.4
@@ -1,9 +1,10 @@
extern void input_Acursor_set(off_t c);
extern void input_Bcursor_set(off_t c);
-extern off_t input_time_to_cursor(char *t);
+extern off_t input_time_to_cursor(const char *t);
extern void input_cursor_to_time(off_t cursor,char *t);
extern void time_fix(char *buffer);
extern int input_seek(off_t pos);
extern time_linkage *input_read(void);
extern int input_load(int n,char *list[]);
extern int pull_input_feedback(double *peak,double *rms,off_t *cursor,int *n);
+extern void input_reset(void);
<p><p>1.6 +2 -8 postfish/main.c
Index: main.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/main.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- main.c 13 Oct 2003 06:01:22 -0000 1.5
+++ main.c 16 Oct 2003 23:10:16 -0000 1.6
@@ -30,6 +30,7 @@
#include "postfish.h"
#include "mainpanel.h"
#include "input.h"
+#include "output.h"
pthread_mutex_t master_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
@@ -69,14 +70,7 @@
input_seek(0);
mainpanel_go(argc,argv,input_ch);
- playback_exit=1;
-
- while(1){
- if(playback_active){
- sched_yield();
- }else
- break;
- }
+ output_halt_playback();
//save_settings(configfd);
if(configfd>=0)close(configfd);
<p><p>1.15 +43 -29 postfish/mainpanel.c
Index: mainpanel.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/mainpanel.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mainpanel.c 16 Oct 2003 22:11:12 -0000 1.14
+++ mainpanel.c 16 Oct 2003 23:10:16 -0000 1.15
@@ -51,6 +51,8 @@
GtkWidget *channelshow[10]; /* support only up to 8 + mid/side */
GtkWidget *cue;
+ GtkWidget *entry_a;
+ GtkWidget *entry_b;
/* ui state */
int fishframe;
@@ -59,6 +61,18 @@
} postfish_mainpanel;
+static void action_zero(GtkWidget *widget,postfish_mainpanel *p){
+ const char *time=gtk_entry_get_text(GTK_ENTRY(p->entry_a));
+ off_t cursor=input_time_to_cursor(time);
+
+ output_halt_playback();
+
+ input_seek(cursor);
+ readout_set(READOUT(p->cue),(char *)time);
+ multibar_reset(MULTIBAR(p->inbar));
+ multibar_reset(MULTIBAR(p->outbar));
+}
+
static void action_play(GtkWidget *widget,postfish_mainpanel *p){
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))){
if(!playback_active){
@@ -68,16 +82,7 @@
pthread_create(&playback_thread_id,NULL,&playback_thread,NULL);
}
}else{
- if(playback_active){
- playback_exit=1;
- sched_yield();
- while(1){
- if(playback_active){
- sched_yield();
- }else
- break;
- }
- }
+ output_pause_playback();
}
}
@@ -603,6 +608,8 @@
0,0);
+ g_signal_connect (G_OBJECT (panel->deckactive[0]), "clicked",
+ G_CALLBACK (action_zero), panel);
g_signal_connect (G_OBJECT (panel->deckactive[3]), "clicked",
G_CALLBACK (action_play), panel);
@@ -613,14 +620,15 @@
{
GtkWidget *cuebox=gtk_hbox_new(0,0);
GtkWidget *cuelabel=gtk_label_new("cue:");
- GtkWidget *entry_a=gtk_entry_new();
- GtkWidget *entry_b=gtk_entry_new();
GtkWidget *framea=gtk_vseparator_new();
GtkWidget *frameb=gtk_vseparator_new();
GtkWidget *panelb=gtk_check_button_new_with_mnemonic("c_ue list");
+ panel->entry_a=gtk_entry_new();
+ panel->entry_b=gtk_entry_new();
+
panel->cue=readout_new(" : :00.00");
@@ -630,19 +638,19 @@
panel->cue_reset[1]=gtk_button_new_with_label("[B]");
- gtk_entry_set_width_chars(GTK_ENTRY(entry_a),13);
- gtk_entry_set_width_chars(GTK_ENTRY(entry_b),13);
- gtk_entry_set_text(GTK_ENTRY(entry_a)," : :00.00");
- gtk_entry_set_text(GTK_ENTRY(entry_b)," : :00.00");
+ gtk_entry_set_width_chars(GTK_ENTRY(panel->entry_a),13);
+ gtk_entry_set_width_chars(GTK_ENTRY(panel->entry_b),13);
+ gtk_entry_set_text(GTK_ENTRY(panel->entry_a)," : :00.00");
+ gtk_entry_set_text(GTK_ENTRY(panel->entry_b)," : :00.00");
- g_signal_connect (G_OBJECT (entry_a), "key-press-event",
+ g_signal_connect (G_OBJECT (panel->entry_a), "key-press-event",
G_CALLBACK (timeevent_keybinding), panel->toplevel);
- g_signal_connect (G_OBJECT (entry_b), "key-press-event",
+ g_signal_connect (G_OBJECT (panel->entry_b), "key-press-event",
G_CALLBACK (timeevent_keybinding), panel->toplevel);
- g_signal_connect_after(G_OBJECT (entry_a), "grab_focus",
+ g_signal_connect_after(G_OBJECT (panel->entry_a), "grab_focus",
G_CALLBACK (timeevent_unselect), NULL);
- g_signal_connect_after(G_OBJECT (entry_b), "grab_focus",
+ g_signal_connect_after(G_OBJECT (panel->entry_b), "grab_focus",
G_CALLBACK (timeevent_unselect), NULL);
g_signal_connect (G_OBJECT (panel->cue_set[1]), "clicked",
@@ -663,13 +671,13 @@
gtk_box_pack_start(GTK_BOX(cuebox),framea,1,1,3);
gtk_box_pack_start(GTK_BOX(cuebox),panel->cue_set[0],0,0,0);
- gtk_box_pack_start(GTK_BOX(cuebox),entry_a,0,0,0);
+ gtk_box_pack_start(GTK_BOX(cuebox),panel->entry_a,0,0,0);
gtk_box_pack_start(GTK_BOX(cuebox),panel->cue_reset[0],0,0,0);
gtk_box_pack_start(GTK_BOX(cuebox),frameb,1,1,3);
gtk_box_pack_start(GTK_BOX(cuebox),panel->cue_set[1],0,0,0);
- gtk_box_pack_start(GTK_BOX(cuebox),entry_b,0,0,0);
+ gtk_box_pack_start(GTK_BOX(cuebox),panel->entry_b,0,0,0);
gtk_box_pack_start(GTK_BOX(cuebox),panel->cue_reset[1],0,0,0);
}
@@ -700,13 +708,7 @@
}
-static gboolean async_event_handle(GIOChannel *channel,
- GIOCondition condition,
- gpointer data){
- postfish_mainpanel *panel=data;
- int i;
- char buf[1];
- read(eventpipe[0],buf,1);
+static gboolean feedback_process(postfish_mainpanel *panel){
/* first order of business: release the play button if playback is
no longer in progress */
@@ -723,6 +725,7 @@
double *peak=alloca(sizeof(*peak)*(input_ch+2));
if(pull_input_feedback(peak,rms,&time_cursor,&n)){
char buffer[14];
+ int i;
for(i=0;i<n;i++){
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel->channelshow[i]))){
peak[i]=todB(peak[i]);
@@ -755,6 +758,17 @@
}
}
+}
+
+static gboolean async_event_handle(GIOChannel *channel,
+ GIOCondition condition,
+ gpointer data){
+ postfish_mainpanel *panel=data;
+ int i;
+ char buf[1];
+ read(eventpipe[0],buf,1);
+
+ feedback_process(panel);
return TRUE;
}
<p><p>1.9 +8 -0 postfish/multibar.c
Index: multibar.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- multibar.c 15 Oct 2003 08:38:13 -0000 1.8
+++ multibar.c 16 Oct 2003 23:10:16 -0000 1.9
@@ -407,3 +407,11 @@
widget->allocation.height);
}
+
+void multibar_reset(Multibar *m){
+ m->peak=-400;
+ m->peakdelta=0;
+ m->peakdelay=0;
+ m->clipdelay=0;
+ multibar_set(m,NULL,NULL,0);
+}
<p><p>1.6 +1 -0 postfish/multibar.h
Index: multibar.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/multibar.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- multibar.h 15 Oct 2003 04:50:27 -0000 1.5
+++ multibar.h 16 Oct 2003 23:10:16 -0000 1.6
@@ -65,6 +65,7 @@
int flags);
void multibar_clear (Multibar *m);
void multibar_set (Multibar *m,double *lo,double *hi, int n);
+void multibar_reset (Multibar *m);
G_END_DECLS
<p><p>1.8 +35 -5 postfish/output.c
Index: output.c
===================================================================
RCS file: /usr/local/cvsroot/postfish/output.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- output.c 16 Oct 2003 22:03:36 -0000 1.7
+++ output.c 16 Oct 2003 23:10:16 -0000 1.8
@@ -78,10 +78,10 @@
pthread_mutex_unlock(&master_mutex);
}
-int pull_output_feedback(double *peak,double *rms,int *n){
+int pull_output_feedback(double *peak,double *rms,int *nn){
output_feedback *f;
- int i,j;
- *n=input_ch+2;
+ int i,j,n=input_ch+2;
+ if(nn)*nn=n;
pthread_mutex_lock(&master_mutex);
if(feedback_list_tail){
@@ -96,8 +96,10 @@
}
pthread_mutex_unlock(&master_mutex);
- memcpy(rms,f->rms,sizeof(*rms)* *n);
- memcpy(peak,f->peak,sizeof(*peak)* *n);
+ if(rms)
+ memcpy(rms,f->rms,sizeof(*rms)*n);
+ if(peak)
+ memcpy(peak,f->peak,sizeof(*peak)*n);
pthread_mutex_lock(&master_mutex);
f->next=feedback_pool;
@@ -325,3 +327,31 @@
return(NULL);
}
+void output_pause_playback(void){
+ if(playback_active){
+ playback_exit=1;
+
+ while(1){
+ if(playback_active){
+ sched_yield();
+ }else
+ break;
+ }
+ }
+}
+
+void output_reset(void){
+ /* empty feedback queues */
+ while(pull_output_feedback(NULL,NULL,NULL));
+ return;
+}
+
+/* safe to call from UI only because we wait for playback to halt and
+ it can't be restarted until we return */
+void output_halt_playback(void){
+ output_pause_playback();
+ input_reset(); /* clear any persistent lapping state */
+ output_reset(); /* clear any persistent lapping state */
+
+}
+
<p><p>1.2 +3 -0 postfish/output.h
Index: output.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/output.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- output.h 16 Oct 2003 22:03:36 -0000 1.1
+++ output.h 16 Oct 2003 23:10:16 -0000 1.2
@@ -1,2 +1,5 @@
extern int pull_output_feedback(double *peak,double *rms,int *n);
extern void *playback_thread(void *dummy);
+extern void output_pause_playback(void);
+extern void output_halt_playback(void);
+extern void output_reset(void);
<p><p>1.12 +2 -2 postfish/version.h
Index: version.h
===================================================================
RCS file: /usr/local/cvsroot/postfish/version.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- version.h 16 Oct 2003 22:11:12 -0000 1.11
+++ version.h 16 Oct 2003 23:10:16 -0000 1.12
@@ -1,2 +1,2 @@
-#define VERSION "$Id: version.h,v 1.11 2003/10/16 22:11:12 xiphmont Exp $ "
-/* DO NOT EDIT: Automated versioning hack [Thu Oct 16 18:10:11 EDT 2003] */
+#define VERSION "$Id: version.h,v 1.12 2003/10/16 23:10:16 xiphmont Exp $ "
+/* DO NOT EDIT: Automated versioning hack [Thu Oct 16 19:09:25 EDT 2003] */
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list