Generalized the data type of the callback

Also wrapped the callback in a struct to remember the number of channels