diff --git a/src/core/chuck_dl.cpp b/src/core/chuck_dl.cpp index 06998d6bc..2eccb8afb 100644 --- a/src/core/chuck_dl.cpp +++ b/src/core/chuck_dl.cpp @@ -1949,11 +1949,11 @@ remove_all_shreds(ck_remove_all_shreds) //----------------------------------------------------------------------------- Chuck_DL_Api::ObjectApi::ObjectApi() : get_type(ck_get_type), -create(ck_create_with_shred), -create_without_shred(ck_create_without_shred), add_ref(ck_add_ref), release(ck_release), refcount(ck_refcount), +create(ck_create_with_shred), +create_without_shred(ck_create_without_shred), create_string(ck_create_string), get_origin_shred(ck_get_origin_shred), set_origin_shred(ck_set_origin_shred), diff --git a/src/core/chuck_emit.cpp b/src/core/chuck_emit.cpp index 92b4ad5d7..2171d3e38 100644 --- a/src/core/chuck_emit.cpp +++ b/src/core/chuck_emit.cpp @@ -3636,8 +3636,8 @@ t_CKBOOL emit_engine_emit_exp_primary( Chuck_Emitter * emit, a_Exp_Primary exp ) } else if( exp->var == insert_symbol( "pi" ) ) { - double pi = 3.14159265358979323846; - emit->append( new Chuck_Instr_Reg_Push_Imm2( pi ) ); + double ckPi = 3.14159265358979323846; + emit->append( new Chuck_Instr_Reg_Push_Imm2( ckPi ) ); } else if( exp->var == insert_symbol( "dac" ) ) { diff --git a/src/core/chuck_type.cpp b/src/core/chuck_type.cpp index 949334f9f..aee6a8b07 100644 --- a/src/core/chuck_type.cpp +++ b/src/core/chuck_type.cpp @@ -8205,16 +8205,16 @@ static t_CKBOOL g_escape_ready = FALSE; void escape_table( ) { // escape - g_escape['\''] = '\''; - g_escape['"'] = '"'; - g_escape['\\'] = '\\'; - g_escape['a'] = (char)7; // audible bell - g_escape['b'] = (char)8; // back space - g_escape['f'] = (char)12; // form feed - g_escape['n'] = (char)10; // new line - g_escape['r'] = (char)13; // carriage return - g_escape['t'] = (char)9; // horizontal tab - g_escape['v'] = (char)11; // vertical tab + g_escape[(t_CKUINT)'\''] = '\''; + g_escape[(t_CKUINT)'"'] = '"'; + g_escape[(t_CKUINT)'\\'] = '\\'; + g_escape[(t_CKUINT)'a'] = (char)7; // audible bell + g_escape[(t_CKUINT)'b'] = (char)8; // back space + g_escape[(t_CKUINT)'f'] = (char)12; // form feed + g_escape[(t_CKUINT)'n'] = (char)10; // new line + g_escape[(t_CKUINT)'r'] = (char)13; // carriage return + g_escape[(t_CKUINT)'t'] = (char)9; // horizontal tab + g_escape[(t_CKUINT)'v'] = (char)11; // vertical tab // done g_escape_ready = TRUE; diff --git a/src/core/chuck_type.h b/src/core/chuck_type.h index 83a5df3c0..c20b9b8d3 100644 --- a/src/core/chuck_type.h +++ b/src/core/chuck_type.h @@ -1018,11 +1018,11 @@ struct Chuck_Type : public Chuck_Object // struct to hold callback on instantiate struct CallbackOnInstantiate { + // the callback + f_callback_on_instantiate callback; // whether to auto-set shred origin at instantiation; // see t_CKBOOL initialize_object( ... ) t_CKBOOL shouldSetShredOrigin; - // the callback - f_callback_on_instantiate callback; // constructor CallbackOnInstantiate( f_callback_on_instantiate cb = NULL, t_CKBOOL setShredOrigin = FALSE ) : callback(cb), shouldSetShredOrigin(setShredOrigin) { } diff --git a/src/core/ugen_stk.cpp b/src/core/ugen_stk.cpp index 32afc19e4..a7027378f 100644 --- a/src/core/ugen_stk.cpp +++ b/src/core/ugen_stk.cpp @@ -7963,7 +7963,7 @@ MY_FLOAT Delay :: lastOut(void) const return FilterStk::lastOut(); } -MY_FLOAT Delay :: nextOut(void) const +MY_FLOAT Delay :: nextOut(void) { return inputs[outPoint]; } @@ -8486,7 +8486,7 @@ void Echo :: set( MY_FLOAT max ) MY_FLOAT delay = delayLine ? delayLine->getDelay() : length>>1; if( delayLine ) delete delayLine; if( delay >= max ) delay = max; - delayLine = new Delay(length>>1, length); + delayLine = new class Delay(length>>1, length); this->clear(); this->setDelay(delay+.5); } @@ -10428,15 +10428,15 @@ JCRev :: JCRev(MY_FLOAT T60) } for (i=0; i<3; i++) - allpassDelays[i] = new Delay(lengths[i+4], lengths[i+4]); + allpassDelays[i] = new class Delay(lengths[i+4], lengths[i+4]); for (i=0; i<4; i++) { - combDelays[i] = new Delay(lengths[i], lengths[i]); + combDelays[i] = new class Delay(lengths[i], lengths[i]); combCoefficient[i] = pow(10.0,(-3 * lengths[i] / (T60 * Stk::sampleRate()))); } - outLeftDelay = new Delay(lengths[7], lengths[7]); - outRightDelay = new Delay(lengths[8], lengths[8]); + outLeftDelay = new class Delay(lengths[7], lengths[7]); + outRightDelay = new class Delay(lengths[8], lengths[8]); allpassCoefficient = 0.7; effectMix = 0.3; this->clear(); @@ -11888,12 +11888,12 @@ NRev :: NRev(MY_FLOAT T60) } for (i=0; i<6; i++) { - combDelays[i] = new Delay( lengths[i], lengths[i]); + combDelays[i] = new class Delay( lengths[i], lengths[i]); combCoefficient[i] = pow(10.0, (-3 * lengths[i] / (T60 * Stk::sampleRate()))); } for (i=0; i<8; i++) - allpassDelays[i] = new Delay(lengths[i+6], lengths[i+6]); + allpassDelays[i] = new class Delay(lengths[i+6], lengths[i+6]); allpassCoefficient = 0.7; effectMix = 0.3; @@ -12275,8 +12275,8 @@ PRCRev :: PRCRev(MY_FLOAT T60) } for (i=0; i<2; i++) { - allpassDelays[i] = new Delay( lengths[i], lengths[i] ); - combDelays[i] = new Delay( lengths[i+2], lengths[i+2] ); + allpassDelays[i] = new class Delay( lengths[i], lengths[i] ); + combDelays[i] = new class Delay( lengths[i+2], lengths[i+2] ); combCoefficient[i] = pow(10.0,(-3 * lengths[i+2] / (T60 * Stk::sampleRate()))); } @@ -23549,7 +23549,7 @@ CK_DLL_CGET( StifKarp_cget_baseLoopGain ) //----------------------------------------------------------------------------- CK_DLL_CTOR( Delay_ctor ) { - OBJ_MEMBER_UINT(SELF, Delay_offset_data) = (t_CKUINT)new Delay; + OBJ_MEMBER_UINT(SELF, Delay_offset_data) = (t_CKUINT)new class Delay; } @@ -23559,7 +23559,7 @@ CK_DLL_CTOR( Delay_ctor ) //----------------------------------------------------------------------------- CK_DLL_DTOR( Delay_dtor ) { - delete (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); + delete (class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); OBJ_MEMBER_UINT(SELF, Delay_offset_data) = 0; } @@ -23570,7 +23570,7 @@ CK_DLL_DTOR( Delay_dtor ) //----------------------------------------------------------------------------- CK_DLL_TICK( Delay_tick ) { - *out = (SAMPLE)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->tick( in ); + *out = (SAMPLE)((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->tick( in ); return TRUE; } @@ -23591,8 +23591,8 @@ CK_DLL_PMSG( Delay_pmsg ) //----------------------------------------------------------------------------- CK_DLL_CTRL( Delay_ctrl_delay ) { - ((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->setDelay( (long)(GET_NEXT_DUR(ARGS)+.5) ); - RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); + ((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->setDelay( (long)(GET_NEXT_DUR(ARGS)+.5) ); + RETURN->v_dur = (t_CKDUR)((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); } @@ -23602,7 +23602,7 @@ CK_DLL_CTRL( Delay_ctrl_delay ) //----------------------------------------------------------------------------- CK_DLL_CGET( Delay_cget_delay ) { - RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); + RETURN->v_dur = (t_CKDUR)((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay(); } @@ -23612,11 +23612,11 @@ CK_DLL_CGET( Delay_cget_delay ) //----------------------------------------------------------------------------- CK_DLL_CTRL( Delay_ctrl_max ) { - Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); + class Delay * delay = (class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); t_CKFLOAT val = (t_CKFLOAT)delay->getDelay(); t_CKDUR max = GET_NEXT_DUR(ARGS); delay->set( (long)(val+.5), (long)(max+1.5) ); - RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; + RETURN->v_dur = (t_CKDUR)((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; } @@ -23626,7 +23626,7 @@ CK_DLL_CTRL( Delay_ctrl_max ) //----------------------------------------------------------------------------- CK_DLL_CGET( Delay_cget_max ) { - RETURN->v_dur = (t_CKDUR)((Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; + RETURN->v_dur = (t_CKDUR)((class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0; } @@ -23636,7 +23636,7 @@ CK_DLL_CGET( Delay_cget_max ) //----------------------------------------------------------------------------- CK_DLL_CGET( Delay_clear ) { - Delay * delay = (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); + class Delay * delay = (class Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data); delay->clear(); } diff --git a/src/core/ugen_stk.h b/src/core/ugen_stk.h index ba1a47f12..570364e32 100644 --- a/src/core/ugen_stk.h +++ b/src/core/ugen_stk.h @@ -747,8 +747,9 @@ class Delay : public FilterStk //! Return the value which will be output by the next call to tick(). /*! This method is valid only for delay settings greater than zero! + [VERSION #] Removed const qualification because derived class signatures are non-const: avoid virtual function shadowing warnings by agreeing signatures */ - virtual MY_FLOAT nextOut(void) const; + virtual MY_FLOAT nextOut(void); //! Input one sample to the delay-line and return one output. virtual MY_FLOAT tick(MY_FLOAT sample); @@ -821,10 +822,10 @@ class DelayL : public Delay /*! This method is valid only for delay settings greater than zero! */ - MY_FLOAT nextOut(void); + virtual MY_FLOAT nextOut(void); //! Input one sample to the delay-line and return one output. - MY_FLOAT tick(MY_FLOAT sample); + virtual MY_FLOAT tick(MY_FLOAT sample); public: // SWAP formerly protected MY_FLOAT alpha; @@ -1376,6 +1377,7 @@ class WaveLoop : public WvIn //! Class constructor. WaveLoop( const char *fileName, bool raw = FALSE, bool generate = true ); + using WvIn::openFile; // tell the compiler we're OK overloading/shadowing a virtual function virtual void openFile( const char * fileName, bool raw = FALSE, bool n = TRUE ); //! Class destructor. @@ -2485,10 +2487,10 @@ class DelayA : public Delay /*! This method is valid only for delay settings greater than zero! */ - MY_FLOAT nextOut(void); + virtual MY_FLOAT nextOut(void); //! Input one sample to the delay-line and return one output. - MY_FLOAT tick(MY_FLOAT sample); + virtual MY_FLOAT tick(MY_FLOAT sample); public: // SWAP formerly protected MY_FLOAT alpha; @@ -2869,7 +2871,7 @@ class Echo : public Stk MY_FLOAT *tick(MY_FLOAT *vector, unsigned int vectorSize); public: - Delay *delayLine; + class Delay *delayLine; long length; MY_FLOAT lastOutput; MY_FLOAT effectMix; @@ -3476,10 +3478,10 @@ class JCRev : public Reverb MY_FLOAT tick(MY_FLOAT input); public: // SWAP formerly protected - Delay *allpassDelays[3]; - Delay *combDelays[4]; - Delay *outLeftDelay; - Delay *outRightDelay; + class Delay *allpassDelays[3]; + class Delay *combDelays[4]; + class Delay *outLeftDelay; + class Delay *outRightDelay; MY_FLOAT allpassCoefficient; MY_FLOAT combCoefficient[4]; @@ -3725,6 +3727,7 @@ class Mesh2D : public Instrmnt MY_FLOAT tick(); //! Input a sample to the mesh and compute one output sample. + using Instrmnt::tick; // tell the compiler we're OK overloading/shadowing a virtual function MY_FLOAT tick(MY_FLOAT input); //! Perform the control change specified by \e number and \e value (0.0 - 128.0). @@ -4192,8 +4195,8 @@ class NRev : public Reverb MY_FLOAT tick(MY_FLOAT input); public: // SWAP formerly protected - Delay *allpassDelays[8]; - Delay *combDelays[6]; + class Delay *allpassDelays[8]; + class Delay *combDelays[6]; MY_FLOAT allpassCoefficient; MY_FLOAT combCoefficient[6]; MY_FLOAT lowpassState; @@ -4242,8 +4245,8 @@ class PRCRev : public Reverb MY_FLOAT tick(MY_FLOAT input); public: // SWAP formerly protected - Delay *allpassDelays[2]; - Delay *combDelays[2]; + class Delay *allpassDelays[2]; + class Delay *combDelays[2]; MY_FLOAT allpassCoefficient; MY_FLOAT combCoefficient[2]; diff --git a/src/core/ulib_ai.cpp b/src/core/ulib_ai.cpp index e3d88d39a..8aa5c3035 100644 --- a/src/core/ulib_ai.cpp +++ b/src/core/ulib_ai.cpp @@ -3437,7 +3437,7 @@ struct MLP_Object else if( activation_per_layer[i] == g_at_softmax ) v = exp( v ); else if( activation_per_layer[i] == g_at_linear ) - v = v; + { /* v = v; */ } activations[i + 1]->v( j ) = v; } if( activation_per_layer[i] == g_at_softmax ) diff --git a/src/core/ulib_ai.h b/src/core/ulib_ai.h index 6782dd384..7b8a8fc63 100644 --- a/src/core/ulib_ai.h +++ b/src/core/ulib_ai.h @@ -85,7 +85,11 @@ #include "chuck_errmsg.h" #include "util_math.h" - +#ifndef __CHUNREAL_ENGINE__ +#define CK_TYPEID_CSTR(t) ( typeid( t ).name() ) +#else +#define CK_TYPEID_CSTR(t) ( "[chunreal type info disabled]" ) +#endif // query @@ -136,7 +140,7 @@ class ChaiMatrixFast { // error CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast allocation failure: %s, %d x %d...\n", - typeid( T ).name(), xDim, yDim ); + CK_TYPEID_CSTR( T ), xDim, yDim ); // bail return FALSE; } @@ -156,7 +160,7 @@ class ChaiMatrixFast { // error CK_FPRINTF_STDERR( "[chuck]: ChaiMatrixFast out of bound: %s[%d][%d]...\n", - typeid( T ).name(), x, y ); + CK_TYPEID_CSTR( T ), x, y ); // halt // TODO: this should throw (a shred-level, probably) exception assert( FALSE ); @@ -236,7 +240,7 @@ class ChaiVectorFast { // error CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast allocation failure: %s[%d]...\n", - typeid( T ).name(), length ); + CK_TYPEID_CSTR( T ), length ); // bail return FALSE; } @@ -296,7 +300,7 @@ class ChaiVectorFast { // error CK_FPRINTF_STDERR( "[chuck]: ChaiVectorFast out of bound: %s[%d] (capacity=%d)...\n", - typeid( T ).name(), i, m_length ); + CK_TYPEID_CSTR( T ), i, m_length ); // TODO: this should throw (a shred-level, probably) exception assert( FALSE ); } diff --git a/src/core/util_sndfile.c b/src/core/util_sndfile.c index 391f99284..40f983588 100644 --- a/src/core/util_sndfile.c +++ b/src/core/util_sndfile.c @@ -1418,10 +1418,12 @@ aiff_write_strings (SF_PRIVATE *psf, int location) static int aiff_command (SF_PRIVATE *psf, int command, void *data, int datasize) { +#ifndef __CHUNREAL_ENGINE__ /* Avoid compiler warnings. */ psf = psf ; data = data ; datasize = datasize ; +#endif switch (command) { default : break ; @@ -4881,7 +4883,9 @@ psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) return ((sf_count_t) -1) ; } ; +#ifndef __CHUNREAL_ENGINE__ mode = mode ; +#endif return samples_from_start ; } /* psf_default_seek */ @@ -5295,15 +5299,21 @@ static void dither_double (const double *in, double *out, int frames, int channe static sf_count_t dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) -{ psf = psf ; +{ +#ifndef __CHUNREAL_ENGINE__ + psf = psf ; ptr = ptr ; +#endif return len ; } /* dither_read_short */ static sf_count_t dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) -{ psf = psf ; +{ +#ifndef __CHUNREAL_ENGINE__ + psf = psf ; ptr = ptr ; +#endif return len ; } /* dither_read_int */ @@ -6976,7 +6986,9 @@ static sf_count_t dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) { DWVW_PRIVATE *pdwvw ; +#ifndef __CHUNREAL_ENGINE__ mode = mode ; +#endif if (! psf->fdata) { psf->error = SFE_INTERNAL ; @@ -11292,7 +11304,9 @@ gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) { GSM610_PRIVATE *pgsm610 ; int newblock, newsample ; +#ifndef __CHUNREAL_ENGINE__ mode = mode ; +#endif if (! psf->fdata) return 0 ; @@ -14026,7 +14040,10 @@ interleave_read_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) static sf_count_t interleave_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) -{ psf = psf ; mode = mode ; +{ +#ifndef __CHUNREAL_ENGINE__ + psf = psf ; mode = mode ; +#endif /* ** Do nothing here. This is a place holder to prevent the default @@ -14288,7 +14305,9 @@ ircam_write_header (SF_PRIVATE *psf, int calc_length) current = psf_ftell (psf) ; +#ifndef __CHUNREAL_ENGINE__ calc_length = calc_length ; +#endif /* This also sets psf->endian. */ encoding = get_encoding (psf->sf.format & SF_FORMAT_SUBMASK) ; @@ -15743,7 +15762,9 @@ macos_guess_file_type (SF_PRIVATE *psf, const char *filename) struct stat statbuf ; int format ; +#ifndef __CHUNREAL_ENGINE__ psf = psf ; +#endif snprintf (rsrc_name, sizeof (rsrc_name), "%s/rsrc", filename); @@ -17759,8 +17780,10 @@ nist_write_header (SF_PRIVATE *psf, int calc_length) current = psf_ftell (psf) ; +#ifndef __CHUNREAL_ENGINE__ /* Prevent compiler warning. */ calc_length = calc_length ; +#endif if (psf->endian == SF_ENDIAN_BIG) end_str = "10" ; @@ -18237,8 +18260,10 @@ paf_write_header (SF_PRIVATE *psf, int calc_length) psf->dataoffset = PAF_HEADER_LENGTH ; +#ifndef __CHUNREAL_ENGINE__ /* Prevent compiler warning. */ calc_length = calc_length ; +#endif switch (psf->sf.format & SF_FORMAT_SUBMASK) { case SF_FORMAT_PCM_S8 : @@ -21984,7 +22009,9 @@ pvf_open (SF_PRIVATE *psf) static int pvf_close (SF_PRIVATE *psf) { +#ifndef __CHUNREAL_ENGINE__ psf = psf ; +#endif return 0 ; } /* pvf_close */ @@ -21996,7 +22023,9 @@ pvf_write_header (SF_PRIVATE *psf, int calc_length) if (psf->pipeoffset > 0) return 0 ; +#ifndef __CHUNREAL_ENGINE__ calc_length = calc_length ; /* Avoid a compiler warning. */ +#endif current = psf_ftell (psf) ; @@ -32369,10 +32398,12 @@ wav_close (SF_PRIVATE *psf) static int wav_command (SF_PRIVATE *psf, int command, void *data, int datasize) { +#ifndef __CHUNREAL_ENGINE__ /* Avoid compiler warnings. */ psf = psf ; data = data ; datasize = datasize ; +#endif switch (command) { default : break ; @@ -33289,7 +33320,9 @@ xi_open (SF_PRIVATE *psf) static int xi_close (SF_PRIVATE *psf) { +#ifndef __CHUNREAL_ENGINE__ psf = psf ; +#endif return 0 ; } /* xi_close */ @@ -33437,7 +33470,9 @@ xi_write_header (SF_PRIVATE *psf, int calc_length) if ((pxi = psf->fdata) == NULL) return SFE_INTERNAL ; +#ifndef __CHUNREAL_ENGINE__ calc_length = calc_length ; /* Avoid a compiler warning. */ +#endif current = psf_ftell (psf) ; diff --git a/src/core/util_sndfile.h b/src/core/util_sndfile.h index cb3a70180..a28b36ccd 100644 --- a/src/core/util_sndfile.h +++ b/src/core/util_sndfile.h @@ -49,6 +49,12 @@ // Ari Lazier (alazier@alumni.princeton.edu) // libsndfile: Erik de Castro Lopo (erikd@mega-nerd.com) //----------------------------------------------------------------------------- + +#pragma warning(disable : 4668) // -Wundef +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wundef" +#endif + #ifndef __UTIL_SNDFILE_H__ #define __UTIL_SNDFILE_H__