Skip to content

Commit

Permalink
late (un)breaking fix to getGlobalUGenSamples()
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Oct 15, 2024
1 parent ccef148 commit cf9d9a5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
30 changes: 27 additions & 3 deletions src/core/chuck_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,9 +1340,33 @@ Chuck_Event * * Chuck_Globals_Manager::get_ptr_to_global_event( const std::strin
// desc: get buffer samples
//-----------------------------------------------------------------------------
t_CKBOOL Chuck_Globals_Manager::getGlobalUGenSamples( const char * name,
SAMPLE * buffer,
int numFrames,
int numChannels )
SAMPLE * buffer, int numFrames )
{
// if hasn't been init, or it has been init and hasn't been constructed,
if( m_global_ugens.count( name ) == 0 ||
should_call_global_ctor( name, te_globalUGen ) )
{
// fail without doing anything
return FALSE;
}

// else, fill (if the ugen isn't buffered, then it will fill with zeroes)
m_global_ugens[name]->val->get_buffer( buffer, numFrames );

return TRUE;
}




//-----------------------------------------------------------------------------
// name: getGlobalUGenSamplesMulti()
// desc: get buffer samples, multichannel edition | 1.5.3.2 (eito, nick, ge)
//-----------------------------------------------------------------------------
t_CKBOOL Chuck_Globals_Manager::getGlobalUGenSamplesMulti( const char * name,
SAMPLE * buffer,
int numFrames,
int numChannels )
{
// if hasn't been init, or it has been init and hasn't been constructed,
if( m_global_ugens.count( name ) == 0 ||
Expand Down
3 changes: 2 additions & 1 deletion src/core/chuck_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ struct Chuck_Globals_Manager
t_CKBOOL stopListeningForGlobalEvent( const char * name, void (*callback)(const char*) );
t_CKBOOL stopListeningForGlobalEvent( const char * name, t_CKINT callbackID, void (*callback)(t_CKINT) );

t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE * buffer, int numFrames, int numChannels );
t_CKBOOL getGlobalUGenSamples( const char * name, SAMPLE * buffer, int numFrames );
t_CKBOOL getGlobalUGenSamplesMulti( const char * name, SAMPLE * buffer, int numFrames, int numChannels );

t_CKBOOL setGlobalIntArray( const char * name, t_CKINT arrayValues[], t_CKUINT numValues );
t_CKBOOL getGlobalIntArray( const char * name, void (*callback)(t_CKINT[], t_CKUINT) );
Expand Down

0 comments on commit cf9d9a5

Please sign in to comment.