Skip to content

Commit

Permalink
Merge pull request #386 from ccrma/eng/PR-eito-max-chunreal-mac-fixes
Browse files Browse the repository at this point in the history
Various cleanups to avoid compile errors and warnings building Chunreal for macOS
  • Loading branch information
gewang authored Oct 22, 2023
2 parents 8e0c185 + fc8b254 commit d8c37aa
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 80 deletions.
4 changes: 2 additions & 2 deletions src/core/chuck_dl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1952,11 +1952,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),
Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ) )
{
Expand Down
20 changes: 10 additions & 10 deletions src/core/chuck_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/core/chuck_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
Expand Down
68 changes: 34 additions & 34 deletions src/core/ugen_stk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7833,7 +7833,7 @@ void Clarinet :: controlChange(int number, MY_FLOAT value)


/***************************************************/
/*! \class Delay
/*! \class DelayBase
\brief STK non-interpolating delay line class.

This protected Filter subclass implements
Expand All @@ -7854,17 +7854,17 @@ void Clarinet :: controlChange(int number, MY_FLOAT value)

#include <iostream>

Delay :: Delay()
DelayBase :: DelayBase()
{
this->set( 0, 4096 );
}

Delay :: Delay(long theDelay, long maxDelay)
DelayBase :: DelayBase(long theDelay, long maxDelay)
{
this->set( theDelay, maxDelay );
}

void Delay :: set( long theDelay, long max )
void DelayBase :: set( long theDelay, long max )
{
// Writing before reading allows delays from 0 to length-1.
// If we want to allow a delay of maxDelay, we need a
Expand All @@ -7880,18 +7880,18 @@ void Delay :: set( long theDelay, long max )
this->setDelay(theDelay);
}

Delay :: ~Delay()
DelayBase :: ~DelayBase()
{
}

void Delay :: clear(void)
void DelayBase :: clear(void)
{
long i;
for (i=0;i<length;i++) inputs[i] = 0.0;
outputs[0] = 0.0;
}

void Delay :: setDelay(long theDelay)
void DelayBase :: setDelay(long theDelay)
{
if (theDelay > length-1) { // The value is too big.
CK_STDCERR << "[chuck](via STK): Delay: setDelay(" << theDelay << ") too big!" << CK_STDENDL;
Expand All @@ -7912,12 +7912,12 @@ void Delay :: setDelay(long theDelay)
while (outPoint < 0) outPoint += length; // modulo maximum length
}

MY_FLOAT Delay :: getDelay(void) const
MY_FLOAT DelayBase :: getDelay(void) const
{
return delay;
}

MY_FLOAT Delay :: energy(void) const
MY_FLOAT DelayBase :: energy(void) const
{
long i;
/* register */ MY_FLOAT e = 0;
Expand All @@ -7939,7 +7939,7 @@ MY_FLOAT Delay :: energy(void) const
return e;
}

MY_FLOAT Delay :: contentsAt(unsigned long tapDelay) const
MY_FLOAT DelayBase :: contentsAt(unsigned long tapDelay) const
{
long i = tapDelay;
if (i < 1) {
Expand All @@ -7958,17 +7958,17 @@ MY_FLOAT Delay :: contentsAt(unsigned long tapDelay) const
return inputs[tap];
}

MY_FLOAT Delay :: lastOut(void) const
MY_FLOAT DelayBase :: lastOut(void) const
{
return FilterStk::lastOut();
}

MY_FLOAT Delay :: nextOut(void) const
MY_FLOAT DelayBase :: nextOut(void)
{
return inputs[outPoint];
}

MY_FLOAT Delay :: tick(MY_FLOAT sample)
MY_FLOAT DelayBase :: tick(MY_FLOAT sample)
{
inputs[inPoint++] = sample;

Expand All @@ -7985,7 +7985,7 @@ MY_FLOAT Delay :: tick(MY_FLOAT sample)
return outputs[0];
}

MY_FLOAT *Delay :: tick(MY_FLOAT *vec, unsigned int vectorSize)
MY_FLOAT *DelayBase :: tick(MY_FLOAT *vec, unsigned int vectorSize)
{
for (unsigned int i=0; i<vectorSize; i++)
vec[i] = tick(vec[i]);
Expand Down Expand Up @@ -8067,7 +8067,7 @@ DelayA :: ~DelayA()

void DelayA :: clear()
{
Delay::clear();
DelayBase::clear();
apInput = 0.0;
}

Expand Down Expand Up @@ -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 DelayBase(length>>1, length);
this->clear();
this->setDelay(delay+.5);
}
Expand Down Expand Up @@ -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 DelayBase(lengths[i+4], lengths[i+4]);

for (i=0; i<4; i++) {
combDelays[i] = new Delay(lengths[i], lengths[i]);
combDelays[i] = new DelayBase(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 DelayBase(lengths[7], lengths[7]);
outRightDelay = new DelayBase(lengths[8], lengths[8]);
allpassCoefficient = 0.7;
effectMix = 0.3;
this->clear();
Expand Down Expand Up @@ -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 DelayBase( 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 DelayBase(lengths[i+6], lengths[i+6]);

allpassCoefficient = 0.7;
effectMix = 0.3;
Expand Down Expand Up @@ -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 DelayBase( lengths[i], lengths[i] );
combDelays[i] = new DelayBase( lengths[i+2], lengths[i+2] );
combCoefficient[i] = pow(10.0,(-3 * lengths[i+2] / (T60 * Stk::sampleRate())));
}

Expand Down Expand Up @@ -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 DelayBase;
}


Expand All @@ -23559,7 +23559,7 @@ CK_DLL_CTOR( Delay_ctor )
//-----------------------------------------------------------------------------
CK_DLL_DTOR( Delay_dtor )
{
delete (Delay *)OBJ_MEMBER_UINT(SELF, Delay_offset_data);
delete (DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data);
OBJ_MEMBER_UINT(SELF, Delay_offset_data) = 0;
}

Expand All @@ -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)((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->tick( in );
return TRUE;
}

Expand All @@ -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();
((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->setDelay( (long)(GET_NEXT_DUR(ARGS)+.5) );
RETURN->v_dur = (t_CKDUR)((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay();
}


Expand All @@ -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)((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->getDelay();
}


Expand All @@ -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);
DelayBase * delay = (DelayBase *)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)((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0;
}


Expand All @@ -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)((DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data))->length-1.0;
}


Expand All @@ -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);
DelayBase * delay = (DelayBase *)OBJ_MEMBER_UINT(SELF, Delay_offset_data);
delay->clear();
}

Expand Down
Loading

0 comments on commit d8c37aa

Please sign in to comment.