I think I got Callbacks now?

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

Hello all,

While I am still trying to work with callbacks. I think I am slowly starting to figure them out or how to wrap them. I just want to make sure that I am doing it right.

[https://github.com/SFML/CSFML/blob/master/include/SFML/Audio/SoundRecorder.h] - for reference

typedef sfBool (*sfSoundRecorderStartCallback)(void*);                           ///< Type of the callback used when starting a capture 
typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data 
typedef void   (*sfSoundRecorderStopCallback)(void*);                            ///< Type of the callback used when stopping a capture 

public function sfSoundRecorderStartCallback(atom cap) 
	atom id = cap 
	return id 
end function 
 
public constant sfSoundRecorderStartCallback_cb = call_back(routine_id("sfSoundRecorderStartCallback"),{C_POINTER},C_BOOL) 
 
public function sfSoundRecorderProcessCallback(atom in16,atom size,atom user) 
	atom id = in16 
	atom s = size 
	atom u = user 
	return id 
end function 
 
public constant sfSoundRecorderProcessCallback_cb = call_back(routine_id("sfSoundRecorderProcessCallback"),{C_POINTER,C_SIZE_T,C_POINTER},C_BOOL) 
 
public function sfSoundRecorderStopCallback(atom user) 
	atom id = user 
	return id 
end function 
 
public constant sfSoundRecorderStopCallback_cb = call_back(routine_id("sfSoundRecorderStopCallback"),{}) 
 
constant C_CALLBACK = C_POINTER 
 
export constant xsfSoundRecorder_create = define_c_func(aud,"+sfSoundRecorder_create",{C_CALLBACK,C_CALLBACK,C_CALLBACK,C_POINTER},C_POINTER) 
 
public function sfSoundRecorder_create(atom onStart,atom onProcess,atom onStop,atom ud) 
	return c_func(xsfSoundRecorder_create,{onStart,onProcess,onStop,ud}) 
end function 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu