Commit f920771e authored by zmoelnig's avatar zmoelnig
Browse files

simplified and fixed some more M$VC warnings

git-svn-id: https://pd-gem.svn.sourceforge.net/svnroot/pd-gem/trunk/Gem@4336 49b2a0ca-c541-4d49-a7ef-d785e4371512
parent a376fd59
......@@ -387,7 +387,6 @@ void TextBase :: textMess(int argc, t_atom *argv)
for (i = 0; i < argc; ++i)
{
string newtext;
unsigned int j;
if (A_FLOAT == argv[i].a_type) {
char str[MAXPDSTRING];
char*sp=str;
......@@ -403,6 +402,7 @@ void TextBase :: textMess(int argc, t_atom *argv)
std::wstring ws=toWstring(sp);
line+=ws;
} catch (int i) {
i=0;
while(*sp) {
unsigned char c=*sp++;
line+=c;
......
......@@ -258,12 +258,12 @@ struct GEM_EXTERN pixBlock
//////////
// is this a newimage since last time?
// ie, has it been refreshed
int newimage;
bool newimage;
//////////
// keeps track of when new films are loaded
// useful for rectangle_textures on OSX
int newfilm;
bool newfilm;
};
///////////////////////////////////////////////////////////////////////////////
......
......@@ -206,6 +206,7 @@ namespace gem { namespace image {
try {
s_instance=new PixImageThreadLoader();
} catch(int i) {
i=0;
static bool dunnit=false;
if(!dunnit) {
verbose(1, "threaded ImageLoading not supported!");
......
......@@ -73,7 +73,7 @@ void mesh_line :: setGrid( int valueX)
/////////////////////////////////////////////////////////
void mesh_line :: renderShape(GemState *state)
{
int i,j;
int i;
GLfloat sizeX = 2. / (gridX-1.);
if(m_drawType==GL_DEFAULT_GEM)m_drawType=GL_LINE_STRIP;
......
......@@ -60,7 +60,7 @@ scopeXYZ :: ~scopeXYZ()
if(m_vertices)delete[]m_vertices;
}
void scopeXYZ :: doLengthMess(int L) {
void scopeXYZ :: doLengthMess(unsigned int L) {
// this resizes to m_requestedLength if this is set, or to L otherwise
// actually, resizing is done to the double-size!
......@@ -95,7 +95,6 @@ void scopeXYZ :: doLengthMess(int L) {
void scopeXYZ :: lengthMess(int l)
{
int i;
if(l<=0){
m_requestedLength=0;
return;
......@@ -289,7 +288,7 @@ void scopeXYZ :: dspCallback(void *data,t_signal** sp)
dsp_add(perform, 5, data, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[1]->s_n);
}
void scopeXYZ :: perform(t_int count, t_sample*X, t_sample*Y, t_sample*Z)
void scopeXYZ :: perform(unsigned int count, t_sample*X, t_sample*Y, t_sample*Z)
{
int position=m_position;
......
......@@ -74,7 +74,7 @@ class GEM_EXTERN scopeXYZ : public GemShape
// the number of points
unsigned int m_requestedLength, m_realLength;
unsigned int m_length;
virtual void doLengthMess(int length=0);
virtual void doLengthMess(unsigned int length=0);
virtual void lengthMess(int length);
virtual void bangMess();
......@@ -88,7 +88,7 @@ class GEM_EXTERN scopeXYZ : public GemShape
t_inlet*m_inX, *m_inY, *m_inZ;
void perform(t_int count, t_sample*X, t_sample*Y, t_sample*Z);
void perform(unsigned int count, t_sample*X, t_sample*Y, t_sample*Z);
private:
......
......@@ -329,7 +329,7 @@ void pix_record :: enumPropertiesMess()
}
}
}
void pix_record :: setPropertiesMess(int argc, t_atom*argv)
void pix_record :: setPropertiesMess(t_symbol*s, int argc, t_atom*argv)
{
PIMPL::addProperties(m_props, argc, argv);
}
......@@ -436,7 +436,7 @@ void pix_record :: codecMess(t_atom *argv)
} else if(A_FLOAT==argv->a_type){
/* maintain a list of all codecs and resolve using that */
int id=atom_getint(argv);
if((id>=0) && (id<m_pimpl->m_codecs.size())) {
if((id>=0) && (static_cast<unsigned int>(id)<m_pimpl->m_codecs.size())) {
sid=m_pimpl->m_codecs[id];
}
}
......@@ -471,7 +471,7 @@ void pix_record :: codecMess(t_atom *argv)
enumPropertiesMess();
}
void pix_record :: fileMess(int argc, t_atom *argv)
void pix_record :: fileMess(t_symbol*s, int argc, t_atom *argv)
{
/* LATER let the record()-handles chose whether they accept an open request
* and then try other handles (if available)
......@@ -488,71 +488,33 @@ void pix_record :: fileMess(int argc, t_atom *argv)
/////////////////////////////////////////////////////////
void pix_record :: obj_setupCallback(t_class *classPtr)
{
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_record::fileMessCallback),
gensym("file"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_record::autoMessCallback),
gensym("auto"), A_FLOAT, A_NULL);
class_addbang(classPtr, reinterpret_cast<t_method>(&pix_record::bangMessCallback));
CPPEXTERN_MSG (classPtr, "file", fileMess);
CPPEXTERN_MSG1(classPtr, "auto", autoMess, bool);
CPPEXTERN_MSG0(classPtr, "bang", bangMess);
CPPEXTERN_MSG1(classPtr, "record", recordMess, bool);
CPPEXTERN_MSG0(classPtr, "dialog", dialogMess);
CPPEXTERN_MSG0(classPtr, "codeclist", getCodecList);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_record::codecMessCallback),
gensym("codec"), A_GIMME, A_NULL);
CPPEXTERN_MSG0(classPtr, "proplist", enumPropertiesMess);
class_addmethod(classPtr,
reinterpret_cast<t_method>(&pix_record::setPropertiesMessCallback),
gensym("set"), A_GIMME, A_NULL);
CPPEXTERN_MSG0(classPtr, "clearprops", clearPropertiesMess);
}
CPPEXTERN_MSG (classPtr, "set", fileMess);
void pix_record :: fileMessCallback(void *data, t_symbol *s, int argc, t_atom *argv)
{
GetMyClass(data)->fileMess(argc, argv);
}
void pix_record :: autoMessCallback(void *data, t_floatarg on)
{
bool onb=static_cast<bool>(on);
GetMyClass(data)->m_automatic=onb;
}
void pix_record :: bangMessCallback(void *data)
{
GetMyClass(data)->m_banged=true;
}
void pix_record :: recordMessCallback(void *data, t_floatarg on)
{
GetMyClass(data)->recordMess(!(!static_cast<int>(on)));
CPPEXTERN_MSG0(classPtr, "clearprops", clearPropertiesMess);
}
void pix_record :: dialogMessCallback(void *data)
void pix_record :: bangMess(void)
{
GetMyClass(data)->dialogMess();
m_banged=true;
}
void pix_record :: codeclistMessCallback(void *data)
void pix_record :: autoMess(bool on)
{
GetMyClass(data)->getCodecList();
m_automatic=on;
}
void pix_record :: codecMessCallback(void *data, t_symbol *s, int argc, t_atom *argv)
{
if(argc)
GetMyClass(data)->codecMess(argv);
}
void pix_record :: enumPropertiesMessCallback(void *data)
{
GetMyClass(data)->enumPropertiesMess();
}
void pix_record :: setPropertiesMessCallback(void *data, t_symbol *s, int argc, t_atom *argv)
{
GetMyClass(data)->setPropertiesMess(argc, argv);
}
void pix_record :: clearPropertiesMessCallback(void *data)
{
GetMyClass(data)->clearPropertiesMess();
}
}
\ No newline at end of file
......@@ -71,7 +71,7 @@ class GEM_EXTERN pix_record : public GemBase
//////////
// Set the filename and filetype
std::string m_filename;
virtual void fileMess(int argc, t_atom *argv);
virtual void fileMess(t_symbol*s,int argc, t_atom *argv);
//////////
// turn recording on/off
......@@ -107,7 +107,7 @@ class GEM_EXTERN pix_record : public GemBase
gem::Properties m_props;
virtual void enumPropertiesMess(void);
virtual void setPropertiesMess(int argc, t_atom*argv);
virtual void setPropertiesMess(t_symbol*,int argc, t_atom*argv);
virtual void clearPropertiesMess(void);
private:
......@@ -119,24 +119,13 @@ class GEM_EXTERN pix_record : public GemBase
virtual bool addHandle(std::vector<std::string>available_ids, std::string id=std::string(""));
//////////
// static member functions
static void fileMessCallback(void *data, t_symbol *s, int argc, t_atom *argv);
static void autoMessCallback(void *data, t_floatarg on);
static void bangMessCallback(void *data);
static void recordMessCallback(void *data, t_floatarg on);
static void dialogMessCallback(void *data);
static void codeclistMessCallback(void *data);
void autoMess(bool on);
void bangMess();
static void codecMessCallback(void *data, t_symbol *s, int argc, t_atom *argv);
static void minMessCallback(void *data, t_floatarg min);
static void maxMessCallback(void *data, t_floatarg max);
static void enumPropertiesMessCallback(void *data);
static void setPropertiesMessCallback(void *data, t_symbol*,int, t_atom*);
static void clearPropertiesMessCallback(void *data);
class PIMPL;
PIMPL*m_pimpl;
};
......
......@@ -192,10 +192,9 @@ static inline unsigned int getIndex(unsigned int current, int index, unsigned in
/////////////////////////////////////////////////////////
void pix_tIIRf :: processImage(imageStruct &image)
{
t_float f;
int i, j;
int j;
size_t imagesize = imgSize(&image);
unsigned char *dest, *source;
unsigned char *dest;
if(!imgCompare(image, m_image)) {
// LATER only reallocate if really needed
......
......@@ -22,6 +22,7 @@
#include "Gem/State.h"
#include "Gem/Exception.h"
#include "plugins/PluginFactory.h"
#include "RTE/MessageCallbacks.h"
CPPEXTERN_NEW(pix_video);
......@@ -232,21 +233,21 @@ bool pix_video::restart(void) {
// driverMess
//
/////////////////////////////////////////////////////////
void pix_video :: driverMess(t_symbol*s)
void pix_video :: driverMess(std::string s)
{
if(gensym("auto")==s) {
if("auto"==s) {
driverMess(-1);
return;
} else {
unsigned int dev;
for(dev=0; dev<m_videoHandles.size(); dev++) {
if(m_videoHandles[dev]->provides(s->s_name)) {
if(m_videoHandles[dev]->provides(s)) {
driverMess(dev);
return;
}
}
}
error("could not find a backend for driver '%s'", s->s_name);
error("could not find a backend for driver '%s'", s.c_str());
}
void pix_video :: driverMess(int dev)
{
......@@ -304,9 +305,9 @@ void pix_video :: deviceMess(int dev)
WITH_VIDEOHANDLES_DO(setDevice(dev));
restart();
}
void pix_video :: deviceMess(t_symbol*s)
void pix_video :: deviceMess(std::string s)
{
WITH_VIDEOHANDLES_DO(setDevice(s->s_name));
WITH_VIDEOHANDLES_DO(setDevice(s));
restart();
}
......@@ -354,9 +355,9 @@ void pix_video :: channelMess(int channel, t_float freq)
// normMess
//
/////////////////////////////////////////////////////////
void pix_video :: normMess(t_symbol *s)
void pix_video :: normMess(std::string s)
{
m_writeprops.set("norm", std::string(s->s_name));
m_writeprops.set("norm", std::string(s));
if(m_videoHandle)
m_videoHandle->setProperties(m_writeprops);
......@@ -734,20 +735,19 @@ void pix_video :: runningMess(bool state) {
/////////////////////////////////////////////////////////
void pix_video :: obj_setupCallback(t_class *classPtr)
{
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::enumerateMessCallback),
gensym("enumerate"), A_NULL);
CPPEXTERN_MSG0(classPtr, "enumerate", enumerateMess);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::driverMessCallback),
gensym("driver"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::deviceMessCallback),
gensym("device"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::closeMessCallback),
gensym("close"), A_NULL);
CPPEXTERN_MSG0(classPtr, "close", closeMess);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::openMessCallback),
gensym("open"), A_GIMME, A_NULL);
class_addfloat(classPtr, reinterpret_cast<t_method>(&pix_video::runningMessCallback));
CPPEXTERN_MSG1(classPtr, "float", runningMess, bool);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::dialogMessCallback),
gensym("dialog"), A_GIMME, A_NULL);
......@@ -757,23 +757,14 @@ void pix_video :: obj_setupCallback(t_class *classPtr)
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::getPropertyMessCallback),
gensym("get"), A_GIMME, A_NULL);
class_addmethod(classPtr,
reinterpret_cast<t_method>(&pix_video::enumPropertyMessCallback),
gensym("enumProps"), A_NULL);
CPPEXTERN_MSG0(classPtr, "enumProps", applyPropertiesMess);
class_addmethod(classPtr,
reinterpret_cast<t_method>(&pix_video:: setPropertiesMessCallback),
gensym("setProps"), A_GIMME, A_NULL);
class_addmethod(classPtr,
reinterpret_cast<t_method>(&pix_video::applyPropertiesMessCallback),
gensym("applyProps"), A_NULL);
class_addmethod(classPtr,
reinterpret_cast<t_method>(&pix_video::clearPropertiesMessCallback),
gensym("clearProps"), A_NULL);
CPPEXTERN_MSG0(classPtr, "applyProps", applyPropertiesMess);
CPPEXTERN_MSG0(classPtr, "clearProps", clearPropertiesMess);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::asynchronousMessCallback),
gensym("async"), A_FLOAT, A_NULL);
CPPEXTERN_MSG1(classPtr, "async", asynchronousMess, bool);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::colorMessCallback),
......@@ -781,16 +772,16 @@ void pix_video :: obj_setupCallback(t_class *classPtr)
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::dimenMessCallback),
gensym("dimen"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::normMessCallback),
gensym("norm"), A_SYMBOL, A_NULL);
CPPEXTERN_MSG1(classPtr, "norm", normMess, std::string);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::channelMessCallback),
gensym("channel"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::modeMessCallback),
gensym("mode"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::colorMessCallback),
gensym("color"), A_GIMME, A_NULL);
class_addmethod(classPtr, reinterpret_cast<t_method>(&pix_video::qualityMessCallback),
gensym("quality"), A_FLOAT, A_NULL);
CPPEXTERN_MSG1(classPtr, "quality", qualityMess, int);
}
void pix_video :: dimenMessCallback(void *data, t_symbol *s, int ac, t_atom *av)
{
......@@ -809,21 +800,17 @@ void pix_video :: channelMessCallback(void *data, t_symbol*s, int argc, t_atom*a
GetMyClass(data)->channelMess(static_cast<int>(chan), freq);
}
void pix_video :: normMessCallback(void *data, t_symbol*s)
{
GetMyClass(data)->normMess(s);
}
void pix_video :: modeMessCallback(void *data, t_symbol* nop, int argc, t_atom *argv)
{
switch (argc){
case 1:
if (A_FLOAT ==argv->a_type)GetMyClass(data)->channelMess(atom_getint(argv));
else if (A_SYMBOL==argv->a_type)GetMyClass(data)->normMess(atom_getsymbol(argv));
else if (A_SYMBOL==argv->a_type)GetMyClass(data)->normMess(atom_getsymbol(argv)->s_name);
else goto mode_error;
break;
case 2:
if (A_SYMBOL==argv->a_type && A_FLOAT==(argv+1)->a_type){
GetMyClass(data)->normMess(atom_getsymbol(argv));
GetMyClass(data)->normMess(atom_getsymbol(argv)->s_name);
GetMyClass(data)->channelMess(atom_getint(argv+1));
} else goto mode_error;
break;
......@@ -837,9 +824,6 @@ void pix_video :: colorMessCallback(void *data, t_symbol* nop, int argc, t_atom
else GetMyClass(data)->error("invalid number of arguments (must be 1)");
}
void pix_video :: asynchronousMessCallback(void *data, t_floatarg state){
GetMyClass(data)->asynchronousMess(state);
}
void pix_video :: deviceMessCallback(void *data, t_symbol*,int argc, t_atom*argv)
{
if(argc==1){
......@@ -848,7 +832,7 @@ void pix_video :: deviceMessCallback(void *data, t_symbol*,int argc, t_atom*argv
GetMyClass(data)->deviceMess(atom_getint(argv));
break;
case A_SYMBOL:
GetMyClass(data)->deviceMess(atom_getsymbol(argv));
GetMyClass(data)->deviceMess(atom_getsymbol(argv)->s_name);
break;
default:
GetMyClass(data)->error("device must be integer or symbol");
......@@ -868,15 +852,11 @@ void pix_video :: driverMessCallback(void *data, t_symbol*s, int argc, t_atom*ar
} else if (argv->a_type == A_FLOAT) {
GetMyClass(data)->driverMess(atom_getint(argv));
} else if (argv->a_type == A_SYMBOL) {
GetMyClass(data)->driverMess(atom_getsymbol(argv));
GetMyClass(data)->driverMess(atom_getsymbol(argv)->s_name);
} else {
GetMyClass(data)->error("'driver' takes a single numeric or symbolic driver ID");
}
}
void pix_video :: enumerateMessCallback(void *data)
{
GetMyClass(data)->enumerateMess();
}
void pix_video :: dialogMessCallback(void *data, t_symbol*s, int argc, t_atom*argv)
{
GetMyClass(data)->dialogMess(argc, argv);
......@@ -885,11 +865,6 @@ void pix_video :: getPropertyMessCallback(void *data, t_symbol*s, int argc, t_at
{
GetMyClass(data)->getPropertyMess(argc, argv);
}
void pix_video :: enumPropertyMessCallback(void *data)
{
GetMyClass(data)->enumPropertyMess();
}
void pix_video :: setPropertyMessCallback(void *data, t_symbol*s, int argc, t_atom*argv)
{
GetMyClass(data)->setPropertyMess(argc, argv);
......@@ -899,33 +874,11 @@ void pix_video :: setPropertiesMessCallback(void *data, t_symbol*s, int argc, t_
{
GetMyClass(data)->setPropertiesMess(argc, argv);
}
void pix_video :: applyPropertiesMessCallback(void *data)
{
GetMyClass(data)->applyPropertiesMess();
}
void pix_video :: clearPropertiesMessCallback(void *data)
{
GetMyClass(data)->clearPropertiesMess();
}
void pix_video :: qualityMessCallback(void *data, t_floatarg state)
{
GetMyClass(data)->qualityMess(static_cast<int>(state));
}
void pix_video :: closeMessCallback(void *data)
{
GetMyClass(data)->closeMess();
}
void pix_video :: openMessCallback(void *data, t_symbol*s, int argc, t_atom*argv)
{
if(argc)driverMessCallback(data, s, argc, argv);
else
GetMyClass(data)->startRendering();
}
void pix_video :: runningMessCallback(void *data, t_floatarg state)
{
GetMyClass(data)->runningMess((bool)state);
}
#endif /* no OS-specific GEM_VIDEOBACKEND */
......@@ -75,7 +75,7 @@ class GEM_EXTERN pix_video : public GemBase
// returns true, if a new backend could be found
virtual bool restart(void);
virtual void deviceMess(t_symbol*dev);
virtual void deviceMess(std::string);
virtual void deviceMess(int dev);
virtual void closeMess(void);
......@@ -83,7 +83,7 @@ class GEM_EXTERN pix_video : public GemBase
// Set the driver architecture; (probably this makes only sense under linux right now: you can choose between video4linux(0) and video1394(1))
virtual void driverMess(int dev);
virtual void driverMess(t_symbol*s);
virtual void driverMess(std::string);
virtual void driverMess(void);
// List the available devices
......@@ -105,7 +105,7 @@ class GEM_EXTERN pix_video : public GemBase
// Set the channel of the capturing device
virtual void channelMess(int channel, t_float freq=0);
// Set the channel of the capturing device
virtual void normMess(t_symbol *s);
virtual void normMess(std::string);
// Set the color-space
// Set the quality for DV decoding
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment