Update of /cvsroot/robotflow/RobotFlow/Probes/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9945/src
Modified Files:
Makefile.am SoundSourceDisplay.cc
Log Message:
working display of audio sources
Index: Makefile.am
===================================================================
RCS file: /cvsroot/robotflow/RobotFlow/Probes/src/Makefile.am,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Makefile.am 18 Nov 2005 15:10:55 -0000 1.17
--- Makefile.am 18 Nov 2005 16:16:20 -0000 1.18
***************
*** 36,40 ****
INCLUDES = -I../include $(OVERFLOW_INCLUDE) $(GNOME_INCLUDE) \
-I../../Vision/include -I ../../OpenCV/include \
! $(SDL_INCLUDE) -I$(OVERFLOW_DATA)/HMM $(OPENCV_CFLAGS)
LDADD = $(SDL_LIB)
--- 36,40 ----
INCLUDES = -I../include $(OVERFLOW_INCLUDE) $(GNOME_INCLUDE) \
-I../../Vision/include -I ../../OpenCV/include \
! -I../../Audio/include $(SDL_INCLUDE) -I$(OVERFLOW_DATA)/HMM $(OPENCV_CFLAGS)
LDADD = $(SDL_LIB)
Index: SoundSourceDisplay.cc
===================================================================
RCS file: /cvsroot/robotflow/RobotFlow/Probes/src/SoundSourceDisplay.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SoundSourceDisplay.cc 18 Nov 2005 14:59:02 -0000 1.1
--- SoundSourceDisplay.cc 18 Nov 2005 16:16:20 -0000 1.2
***************
*** 2,5 ****
--- 2,6 ----
#include "SoundSourceDisplay.h"
+ #include "SourceInfo.h"
#include "net_types.h"
#include "Object.h"
***************
*** 23,26 ****
--- 24,31 ----
* @description Virtual joystick with 2 standard buttons and 2 toggle buttons
*
+ * @input_name SOURCES_INFO
+ * @input_type Vector<ObjectRef>
+ * @input_description The active sound sources list
+ *
* @parameter_name BUTTONS_VISIBLE
* @parameter_type bool
***************
*** 78,82 ****
m_outputID = addOutput("OUTPUT");
!
}
--- 83,87 ----
m_outputID = addOutput("OUTPUT");
! m_sourcesID = addInput("SOURCES_INFO");
}
***************
*** 243,247 ****
--- 248,254 ----
NULL);
+
//create joystick handle
+ /*
m_pHandle = gnome_canvas_item_new(gnome_canvas_root(m_pCanvas),
gnome_canvas_ellipse_get_type(),
***************
*** 259,263 ****
this);
!
//display window
--- 266,270 ----
this);
! */
//display window
***************
*** 370,402 ****
gdk_threads_enter();
- double x1,y1,x2,y2;
! gnome_canvas_item_get_bounds(m_pHandle,&x1,&y1,&x2,&y2);
! int size = 0;
! if (m_buttonsVisible) {
! size = 4;
! }
! else {
! size = 2;
}
! Vector<float> *data = Vector<float>::alloc(size);
! (*data)[0] = ((x2 + x1) / 2.0) - 160.0;
! (*data)[1] = 160.0 - ((y2 + y1) / 2.0);
! if (m_buttonsVisible) {
! (*data)[2] = (float) m_button1_on;
! (*data)[3] = (float) m_button2_on;
! //(*data)[4] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_pButton3));
! //(*data)[5] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_pButton4));
! }
! out[count] = ObjectRef(data);
gdk_threads_leave();
--- 377,424 ----
gdk_threads_enter();
! ObjectRef SourcesInfoValue = getInput(m_sourcesID,count);
+ //double x1,y1,x2,y2;
+ //gnome_canvas_item_get_bounds(m_pHandle,&x1,&y1,&x2,&y2);
! RCPtr<Vector<ObjectRef> > allSources = SourcesInfoValue;
! //cerr<<"SOUNDSOURCEDISPLAY : "<<"Got sources count :"<<allSources->size()<<endl;
!
! //destroy all actual canvas items
! for (int i = 0; i < m_sourceItems.size(); i++) {
! gtk_object_destroy(GTK_OBJECT(m_sourceItems[i]));
}
+ m_sourceItems.resize(0);
! //display all sources
! for (int i = 0; i < allSources->size(); i++) {
!
! RCPtr<SourceInfo> mySource = (*allSources)[i];
! unsigned int color = 0x000000FF; //opaque
! float strength = mySource->strength * 255.0;
! color |= ((((unsigned int) strength) & 0x000000FF) << 8);
+
+ //create source item
+ GnomeCanvasItem *item = gnome_canvas_item_new(gnome_canvas_root(m_pCanvas),
+ gnome_canvas_ellipse_get_type(),
+ "x1",(double)(-mySource->x[1] * 160.0 + 160.0 - 10.0),
+ "y1",(double)(mySource->x[0] * 160.0 + 160.0 - 10.0),
+ "x2",(double)(-mySource->x[1] * 160.0 + 160.0 + 10.0),
+ "y2",(double)(mySource->x[0] * 160.0 + 160.0 + 10.0),
+ "fill_color_rgba", color,
+ "outline_color", "black",
+ NULL);
+
+ m_sourceItems.push_back(item);
+ }
!
! out[count] = SourcesInfoValue;
gdk_threads_leave();
|