A selection modifier is an operation which only affects the sels
member of a sample's sounddata. The undo and redo methods which are
registered for a selection modifier do not attempt to retain any
information about any other portion of the sample -- they are
optimised to only retain information about changes in the selection.
To create a selection modifier, you must provide a function of the
form SweepModify, as defined in :
typedef void (*SweepModify) (sw_sample * sample, sw_param_set pset,
gpointer custom_data);
This function is expected to modify only the selection data, ie.
sample->sounddata->sels. Note that this data may also be accessed by
the playback thread, so it is protected by a mutex. You must surround
any modifications to the sels member of a sounddata object with
calls to sounddata_lock_selection() and sounddata_unlock_selection(),
as defined in .
To perform the selection modification, call the following function
(also defined in ):
sw_op_instance *
perform_selection_op (sw_sample * s, char * desc, SweepModify func,
sw_param_set pset, gpointer custom_data);
The first argument is the sample to modify, the second is some
short descriptive text for the operation, 'func' is the SweepModify
function, and pset and custom_data are those provided by the proc.