diff --git a/veejay-current/veejay-client/configure.ac b/veejay-current/veejay-client/configure.ac index bce1cdfd..d4033010 100644 --- a/veejay-current/veejay-client/configure.ac +++ b/veejay-current/veejay-client/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([gveejay],[1.4.8],[veejay-users@lists.sourceforge.net]) +AC_INIT([gveejay],[1.5.1],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/gveejay.c]) GVEEJAY_MAJOR_VERSION=1 -GVEEJAY_MINOR_VERSION=4 -GVEEJAY_MICRO_VERSION=8 +GVEEJAY_MINOR_VERSION=5 +GVEEJAY_MICRO_VERSION=1 GVEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION GVEEJAY_CODENAME="Reloaded - build $GVEEJAY_MAJOR_VERSION $GVEEJAY_MINOR_VERSION $GVEEJAY_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade b/veejay-current/veejay-client/share/gveejay.reloaded.glade index e6bf345d..7eddc7fd 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade @@ -373,7 +373,7 @@ GTK_WIN_POS_CENTER_ON_PARENT False 600 - 550 + 548 True False True @@ -3443,7 +3443,7 @@ True - + True button_loop.png 0.5 @@ -3464,7 +3464,7 @@ - + True icon_openlist.png 0.5 @@ -3484,7 +3484,7 @@ - + True icon_copy.png 0.5 @@ -3504,7 +3504,7 @@ - + True icon_clear.png 0.5 @@ -3527,7 +3527,7 @@ True - + True icon_stream.png 0.5 @@ -3548,7 +3548,7 @@ - + True icon_openlist.png 0.5 @@ -3568,7 +3568,7 @@ - + True icon_color.png 0.5 @@ -3588,7 +3588,7 @@ - + True icon_clear.png 0.5 @@ -3611,7 +3611,7 @@ True - + True icon_connect.png 0.5 @@ -3629,7 +3629,7 @@ True _learn MIDI True - False + True @@ -3639,7 +3639,7 @@ True _MIDI enable True - False + True midilearn @@ -3671,7 +3671,7 @@ True - + True icon_save.png 0.5 @@ -3692,7 +3692,7 @@ - + True icon_saveas.png 0.5 @@ -3712,7 +3712,7 @@ - + True icon_openlist.png 0.5 @@ -3732,7 +3732,7 @@ - + True icon_saveas.png 0.5 @@ -3755,7 +3755,7 @@ True - + True icon_open.png 0.5 @@ -3776,7 +3776,7 @@ - + True icon_open.png 0.5 @@ -3796,7 +3796,7 @@ - + True icon_openlist.png 0.5 @@ -3816,7 +3816,7 @@ - + True icon_open.png 0.5 @@ -3874,7 +3874,7 @@ - + True gtk-preferences 1 @@ -3894,14 +3894,14 @@ - + True VIMS _Bundles True - + True icon_bundle.png 0.5 @@ -3934,7 +3934,7 @@ - + True icon_question.png 0.5 @@ -3954,7 +3954,7 @@ - + True icon_bug.png 0.5 diff --git a/veejay-current/veejay-client/share/gveejay.reloaded.glade.bak b/veejay-current/veejay-client/share/gveejay.reloaded.glade.bak index e6bf345d..aa20c85d 100644 --- a/veejay-current/veejay-client/share/gveejay.reloaded.glade.bak +++ b/veejay-current/veejay-client/share/gveejay.reloaded.glade.bak @@ -373,13 +373,13 @@ GTK_WIN_POS_CENTER_ON_PARENT False 600 - 550 + 548 True False True False False - GDK_WINDOW_TYPE_HINT_DIALOG + GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True True @@ -3443,7 +3443,7 @@ True - + True button_loop.png 0.5 @@ -3464,7 +3464,7 @@ - + True icon_openlist.png 0.5 @@ -3484,7 +3484,7 @@ - + True icon_copy.png 0.5 @@ -3504,7 +3504,7 @@ - + True icon_clear.png 0.5 @@ -3527,7 +3527,7 @@ True - + True icon_stream.png 0.5 @@ -3548,7 +3548,7 @@ - + True icon_openlist.png 0.5 @@ -3568,7 +3568,7 @@ - + True icon_color.png 0.5 @@ -3588,7 +3588,7 @@ - + True icon_clear.png 0.5 @@ -3611,7 +3611,7 @@ True - + True icon_connect.png 0.5 @@ -3629,7 +3629,7 @@ True _learn MIDI True - False + True @@ -3639,7 +3639,7 @@ True _MIDI enable True - False + True midilearn @@ -3671,7 +3671,7 @@ True - + True icon_save.png 0.5 @@ -3692,7 +3692,7 @@ - + True icon_saveas.png 0.5 @@ -3712,7 +3712,7 @@ - + True icon_openlist.png 0.5 @@ -3732,7 +3732,7 @@ - + True icon_saveas.png 0.5 @@ -3755,7 +3755,7 @@ True - + True icon_open.png 0.5 @@ -3776,7 +3776,7 @@ - + True icon_open.png 0.5 @@ -3796,7 +3796,7 @@ - + True icon_openlist.png 0.5 @@ -3816,7 +3816,7 @@ - + True icon_open.png 0.5 @@ -3874,7 +3874,7 @@ - + True gtk-preferences 1 @@ -3901,7 +3901,7 @@ - + True icon_bundle.png 0.5 @@ -3934,7 +3934,7 @@ - + True icon_question.png 0.5 @@ -3954,7 +3954,7 @@ - + True icon_bug.png 0.5 diff --git a/veejay-current/veejay-client/src/callback.c b/veejay-current/veejay-client/src/callback.c index 217a8963..70685fcb 100644 --- a/veejay-current/veejay-client/src/callback.c +++ b/veejay-current/veejay-client/src/callback.c @@ -1757,11 +1757,8 @@ void on_video_options_apply_clicked (GtkButton *button, void on_vims_bundles_activate (GtkMenuItem *menuitem, gpointer user_data) { - if(!info->status_lock) - { - GtkWidget *vims_bundles_window = glade_xml_get_widget(info->main_window, "vims_bundles"); - gtk_widget_show(vims_bundles_window); - } + GtkWidget *vims_bundles_window = glade_xml_get_widget(info->main_window, "vims_bundles"); + gtk_widget_show(vims_bundles_window); } @@ -1771,11 +1768,8 @@ void on_vims_bundles_activate (GtkMenuItem *menuitem, void on_vims_bundles_close (GtkDialog *dialog, gpointer user_data) { - if(!info->status_lock) - { - GtkWidget *vims_bundles_window = glade_xml_get_widget(info->main_window, "vims_bundles"); - gtk_widget_hide(vims_bundles_window); - } + GtkWidget *vims_bundles_window = glade_xml_get_widget(info->main_window, "vims_bundles"); + gtk_widget_hide(vims_bundles_window); } /* Menu entries */ diff --git a/veejay-current/veejay-client/src/gveejay.c b/veejay-current/veejay-client/src/gveejay.c index 8eac2a33..2c7c27ee 100644 --- a/veejay-current/veejay-client/src/gveejay.c +++ b/veejay-current/veejay-client/src/gveejay.c @@ -234,7 +234,10 @@ int main(int argc, char *argv[]) { set_skin( selected_skin ); default_bank_values( &col, &row ); - gui_load_theme(); + gui_load_theme(); + + register_signals(); + vj_gui_init( skins[selected_skin].file, launcher, hostname, port_num, use_threads ); vj_gui_style_setup(); @@ -244,6 +247,8 @@ int main(int argc, char *argv[]) { veejay_msg(VEEJAY_MSG_INFO, "Starting with preview enabled"); gveejay_preview(preview); } + + if( launcher ) { reloaded_launcher( hostname, port_num ); diff --git a/veejay-current/veejay-client/src/multitrack.c b/veejay-current/veejay-client/src/multitrack.c index cefdf677..ed788bf3 100644 --- a/veejay-current/veejay-client/src/multitrack.c +++ b/veejay-current/veejay-client/src/multitrack.c @@ -935,7 +935,7 @@ int multrack_audoadd( void *data, char *hostname, int port_num ) } // mt->master_track = track; -// gvr_set_master( mt->preview, track ); + gvr_set_master( mt->preview, track ); gtk_widget_set_sensitive_(GTK_WIDGET(mt->view[track]->panel), TRUE ); diff --git a/veejay-current/veejay-client/src/sequence.c b/veejay-current/veejay-client/src/sequence.c index 0e782e7f..88825f51 100644 --- a/veejay-current/veejay-client/src/sequence.c +++ b/veejay-current/veejay-client/src/sequence.c @@ -40,7 +40,7 @@ extern void reloaded_schedule_restart(); typedef struct { uint8_t *image_data[16]; - uint8_t *status_tokens[16]; + int *status_tokens[16]; int widths[16]; int heights[16]; int active_list[16]; @@ -339,16 +339,23 @@ static int veejay_process_status( veejay_preview_t *vp, veejay_track_t *v ) } else { + int err = 0; + while( ( n = vj_client_poll( v->fd, V_STATUS ))) { char trashcan[100]; int k = vj_client_read( v->fd, V_STATUS, trashcan,sizeof(trashcan)); - if( k == -1 && v->is_master ) - reloaded_schedule_restart(); - if( k <= 0 ) - break; +#ifdef STRICT_CHECKING + veejay_msg(VEEJAY_MSG_DEBUG, "Flushing %d bytes '%s'",k,trashcan); +#endif + if( k <= 0 && v->is_master) + err = -1; } - if( n == -1 && v->is_master ) + + if( n <= 0 && v->is_master ) + err = -1; + + if( err == -1) reloaded_schedule_restart(); } return 1; @@ -979,10 +986,10 @@ static int gvr_veejay( veejay_preview_t *vp , veejay_track_t *v, int track_num if(v->status_buffer) free(v->status_buffer); if(v->data_buffer) free(v->data_buffer); if(v->tmp_buffer) free(v->tmp_buffer); - free(v); vp->tracks[track_num] = NULL; if( v->is_master ) reloaded_schedule_restart(); + free(v); } else { diff --git a/veejay-current/veejay-client/src/vj-api.c b/veejay-current/veejay-client/src/vj-api.c index 8515585f..5569db92 100644 --- a/veejay-current/veejay-client/src/vj-api.c +++ b/veejay-current/veejay-client/src/vj-api.c @@ -771,7 +771,7 @@ static struct {"scrolledwindow49"}, // srt stuff {"samplegrid_frame"}, {"markerframe"}, - {"NULL"} + {NULL} }; static struct @@ -785,7 +785,7 @@ static struct {"fxpanel"}, {"panels"}, {"scrolledwindow49"}, // srt stuff - {"NULL"}, + {NULL}, }; enum @@ -1957,7 +1957,11 @@ int gveejay_new_slot(int mode) int id = 0; int result_len = 0; gchar *result = recv_vims( 3, &result_len ); - +#ifdef STRICT_CHECKING + //@ err + assert( result_len >= 0 ); + assert( result != NULL ); +#endif if(result_len <= 0 ) { veejay_msg(0, "No reply from veejay-server, but expected new sample/slot identifier"); @@ -1970,35 +1974,10 @@ int gveejay_new_slot(int mode) if( id <= 0 ) { + veejay_msg(0, "Error creating new sample slot"); // gveejay_error_slot( mode ); return 0; } - else - { - vj_msg(VEEJAY_MSG_INFO, "Created new %s %d", (mode == MODE_SAMPLE ? "Sample" : "Stream"), id); - - int poke_slot = 0; - int bank_page = 0; - if(verify_bank_capacity( &bank_page, &poke_slot, id, mode )) - { - info->uc.reload_hint[HINT_SLIST] = 1; - - /* sample_slot_t *tmp_slot = vj_gui_get_sample_info(id, mode ); - if(tmp_slot) - { - tmp_slot->slot_number = poke_slot; - add_sample_to_sample_banks( bank_page, tmp_slot ); - free_slot( tmp_slot ); - info->uc.expected_slots ++; - return id; - }*/ - } - else - { - message_dialog( "Error", "Samplebank is full"); - return 0; - } - } return id; } @@ -3813,9 +3792,11 @@ int verify_bank_capacity(int *bank_page_, int *slot_, int sample_id, int sample_ { int poke_slot = 0; int bank_page = find_bank_by_sample( sample_id, sample_type, &poke_slot ); - - if(bank_page == -1) + + if(bank_page == -1) { + veejay_msg(0, "No slot found for (%d,%d)",sample_id,sample_type); return 0; + } if( !bank_exists(bank_page, poke_slot)) add_bank( bank_page ); @@ -3823,6 +3804,16 @@ int verify_bank_capacity(int *bank_page_, int *slot_, int sample_id, int sample_ *bank_page_ = bank_page; *slot_ = poke_slot; +#ifdef STRICT_CHECKING + veejay_msg(VEEJAY_MSG_DEBUG, "(type=%d,id=%d) needs new slot, suggesting page %d, slot %d", + sample_type, sample_id, bank_page, poke_slot ); + +// if( info->sample_banks[bank_page] ) +// assert( info->sample_banks[bank_page]->slot[poke_slot]->sample_id <= 0 ); + + +#endif + return 1; } @@ -3935,14 +3926,13 @@ static void select_slot__( int pm ) /* falsify activation */ if(info->status_tokens[CURRENT_ID] > 0) { - if(verify_bank_capacity( &b, &p, info->status_tokens[CURRENT_ID], - info->status_tokens[PLAY_MODE] )) + if(verify_bank_capacity( &b, &p, info->status_tokens[CURRENT_ID],pm )) { if( info->selected_slot ) { - if ( info->selected_slot->sample_type != pm || info->selected_slot->sample_id != - info->status_tokens[CURRENT_ID] ) { + if ( info->selected_slot->sample_type != pm || info->selected_slot->sample_id != + info->selected_slot->sample_id ) { set_activation_of_slot_in_samplebank(FALSE); - } + } } info->selected_slot = info->sample_banks[b]->slot[p]; info->selected_gui_slot = info->sample_banks[b]->gui_slot[p]; @@ -4018,8 +4008,9 @@ static void load_samplelist_info(gboolean with_reset_slotselection) int n_slots = 0; reset_tree( "tree_sources" ); - if( with_reset_slotselection ) + if( with_reset_slotselection ) { reset_samplebank(); + } multi_vims( VIMS_SAMPLE_LIST,"%d", 0 ); gint fxlen = 0; @@ -4061,6 +4052,7 @@ static void load_samplelist_info(gboolean with_reset_slotselection) gchar *timecode = format_selection_time( 0,(values[2]-values[1]) ); int int_id = values[0]; int poke_slot= 0; int bank_page = 0; + verify_bank_capacity( &bank_page , &poke_slot, int_id, 0); if(bank_page >= 0 ) { @@ -4137,13 +4129,17 @@ static void load_samplelist_info(gboolean with_reset_slotselection) gchar *gsource = _utf8str( descr ); gchar *gtype = _utf8str( source ); - int bank_page = 0; int poke_slot = 0; + int bank_page = 0; + int poke_slot = 0; + + verify_bank_capacity( &bank_page , &poke_slot, values[0], 1); + if(bank_page >= 0) { if( info->sample_banks[bank_page]->slot[poke_slot] <= 0 ) { sample_slot_t *tmp_slot = create_temporary_slot(poke_slot,values[0],1, gtype,gsource ); - add_sample_to_sample_banks(bank_page, tmp_slot ); n_slots ++; + add_sample_to_sample_banks(bank_page, tmp_slot ); n_slots ++; free_slot(tmp_slot); } else @@ -5315,7 +5311,9 @@ void find_user_themes(int theme) (*dst)++; } } - close( sloppy ); + + if( sloppy ) + close( sloppy ); if( strcmp( location, "Default" ) == 0 ) { @@ -6381,33 +6379,32 @@ static void theme_response( gchar *string ) static void reloaded_sighandler(int x) { veejay_msg(VEEJAY_MSG_WARNING, "Caught signal %x", x); - switch( x ) { - case SIGINT: - //@ quit dialog; - break; - case SIGQUIT: - case SIGTERM: - case SIGKILL: - case SIGSEGV: - break; - case SIGPIPE: - reloaded_schedule_restart(); - break; + + if( x == SIGPIPE ) { + reloaded_schedule_restart(); + } + else if ( x == SIGINT || x == SIGABRT ) { + veejay_msg(VEEJAY_MSG_WARNING, "Stopping reloaded"); + exit(0); + } else if ( x == SIGSEGV ) { + veejay_msg(VEEJAY_MSG_ERROR, "Bugs compromised the system."); + exit(0); } - veejay_msg(VEEJAY_MSG_WARNING, "Stopping reloaded"); - exit(0); } void register_signals() { - signal( SIGTERM, reloaded_sighandler ); signal( SIGINT, reloaded_sighandler ); - signal( SIGHUP , reloaded_sighandler ); signal( SIGPIPE, reloaded_sighandler ); signal( SIGQUIT, reloaded_sighandler ); signal( SIGSEGV, reloaded_sighandler ); + signal( SIGABRT, reloaded_sighandler ); + signal( SIGSEGV, reloaded_sighandler ); } + + + void vj_gui_wipe() { int i; @@ -7231,10 +7228,11 @@ void reset_samplebank(void) { if(info->sample_banks[i]) { - /* free memory in use */ + /* clear memory in use */ for(j = 0; j < NUM_SAMPLES_PER_PAGE ; j ++ ) { sample_slot_t *slot = info->sample_banks[i]->slot[j]; + if(slot->sample_id) { if(slot->title) free(slot->title); @@ -7366,45 +7364,50 @@ static sample_gui_slot_t *find_gui_slot_by_sample( int sample_id , int sample_ty static int find_bank_by_sample(int sample_id, int sample_type, int *slot ) { - int i; + int i,j; - /* See if ID is somewhere in the samplebank */ for( i = 0; i < NUM_BANKS; i ++ ) { - int j; - if(info->sample_banks[i]) + if(!info->sample_banks[i]) { + continue; + } + for( j = 0; j < NUM_SAMPLES_PER_PAGE; j ++ ) { if(info->sample_banks[i]->slot[j]->sample_id == sample_id && - info->sample_banks[i]->slot[j]->sample_type == sample_type ) + info->sample_banks[i]->slot[j]->sample_type == sample_type) { *slot = j; +#ifdef STRICT_CHECKING + veejay_msg(VEEJAY_MSG_DEBUG, "using existing slot (%d,%d)", + sample_id,sample_type ); +#endif return i; } } } - /* Fall back to suggest a bank number to add the new id */ for( i = 0; i < NUM_BANKS; i ++ ) { - if(!info->sample_banks[i]) /* First slot in bank */ - { + if(!info->sample_banks[i]) { *slot = 0; return i; } - else + + for( j = 0; j < NUM_SAMPLES_PER_PAGE; j ++ ) { - int j; /* Scan for available slots in this bank page */ - for( j = 0; j < NUM_SAMPLES_PER_PAGE; j ++ ) + if ( info->sample_banks[i]->slot[j]->sample_id <= 0) { - if( info->sample_banks[i]->slot[j]->sample_id <= 0 ) - { - *slot = j; - return i; - } + *slot = j; +#ifdef STRICT_CHECKING + veejay_msg(VEEJAY_MSG_DEBUG, "using new slot (%d,%d)", + sample_id,sample_type); +#endif + return i; } } } + *slot = -1; return -1; } @@ -7848,10 +7851,20 @@ static void set_selection_of_slot_in_samplebank(gboolean active) static int add_sample_to_sample_banks(int bank_page,sample_slot_t *slot) { int bp = 0; int s = 0; +#ifdef STRICT_CHECKING + + int result = verify_bank_capacity( &bp, &s, slot->sample_id, slot->sample_type ); + + veejay_msg(VEEJAY_MSG_DEBUG, "add slot on page %d: type=%d id=%d. result=%d", bank_page,slot->sample_type,slot->sample_id,result ); + + if( result ) + update_sample_slot_data( bp, s, slot->sample_id,slot->sample_type,slot->title,slot->timecode); + +#else if(verify_bank_capacity( &bp, &s, slot->sample_id, slot->sample_type )) update_sample_slot_data( bp, s, slot->sample_id,slot->sample_type,slot->title,slot->timecode); - +#endif return 1; } @@ -7936,6 +7949,16 @@ static void update_sample_slot_data(int page_num, int slot_num, int sample_id, g sample_slot_t *slot = info->sample_banks[page_num]->slot[slot_num]; sample_gui_slot_t *gui_slot = info->sample_banks[page_num]->gui_slot[slot_num]; +#ifdef STRICT_CHECKING + veejay_msg(VEEJAY_MSG_DEBUG, "update slot %d on page %d with (type=%d,id=%d)", + slot_num, page_num, sample_type, sample_id ); + veejay_msg(VEEJAY_MSG_DEBUG, "(#%d,type=%d,%s,%s) change to (#%d,type=%d,%s,%s)", + slot->sample_id,slot->sample_type,slot->timecode,slot->title, + sample_id,sample_type,timecode,title ); +#endif + + + if(slot->timecode) free(slot->timecode); if(slot->title) free(slot->title); diff --git a/veejay-current/veejay-client/src/vj-midi.c b/veejay-current/veejay-client/src/vj-midi.c index 4389a491..824a277e 100644 --- a/veejay-current/veejay-client/src/vj-midi.c +++ b/veejay-current/veejay-client/src/vj-midi.c @@ -482,7 +482,7 @@ int vj_midi_handle_events(void *vv) { vmidi_t *v = (vmidi_t*) vv; if(!v->active) return 0; - if( poll( v->pfd, v->npfd, 0 ) > 0 ) + if( poll( v->pfd, v->npfd, 5 ) > 0 ) { vj_midi_action( v ); return 1;