Re: SoLoud Wrapper

new topic     » goto parent     » topic index » view thread      » older message » newer message

Yeah that looks good so far. I noticed this comment the "C" API page:

SoLoud said...

If the c++ API functions have default parameters, two functions are generated: one without the default parameters, and one with. The one where you can change the default parameters is post-fixed Ex, such as Soloud_init and Soloud_initEx.

So when you wrap functions that would have default parameters maybe just wrap the "Ex" version and provide the same defaults in the wrapper and then drop the "Ex" suffix, like this:

-- int Soloud_initEx( 
--   Soloud * aSoloud, 
--   unsigned int aFlags /* = Soloud::CLIP_ROUNDOFF */, 
--   unsigned int aBackend /* = Soloud::AUTO */, 
--   unsigned int aSamplerate /* = Soloud::AUTO */, 
--   unsigned int aBufferSize /* = Soloud::AUTO */, 
--   unsigned int aChannels /* = 2 */ 
-- ); 
 
constant _Soloud_initEx = define_c_func( Soloud,  "Soloud_initEx", {C_POINTER,C_UINT,C_UINT,C_UINT,C_UINT,C_UINT}, C_INT ) 
 
public constant 
    SOLOUD_AUTO = 0, 
    SOLOUD_CLIP_ROUNDOFF = 1 
 
public function Soloud_init( atom aSoloud, atom aFlags=SOLOUD_CLIP_ROUNDOFF, atom aBackend=SOLOUD_AUTO, atom aSampleRate=SOLOUD_AUTO, atom aBufferSize=SOLOUD_AUTO, atom aChannels=2 ) 
    return c_func( _Soloud_initEx, {aSoloud,aFlags,aBackend,aSampleRate,aBufferSize,aChannels} ) 
end function 

The documentation is here: "SoLoud 20200207" and the C header is here: include/soloud_c.h.

I don't see any declaration prefix in the header so there should be no need for a "+" in the function names that would force CDECL on Win32.

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu