Bindings: Provide helper method that auto-converts analog

This commit is contained in:
Soeren Apel 2017-05-27 22:37:09 +02:00
parent 0cee3a3ea5
commit c5d081f721
2 changed files with 10 additions and 0 deletions

View File

@ -1212,6 +1212,11 @@ void *Analog::data_pointer()
return _structure->data; return _structure->data;
} }
void Analog::get_data_as_float(float *dest)
{
check(sr_analog_to_float(_structure, dest));
}
unsigned int Analog::num_samples() const unsigned int Analog::num_samples() const
{ {
return _structure->num_samples; return _structure->num_samples;

View File

@ -768,6 +768,11 @@ class SR_API Analog :
public: public:
/** Pointer to data. */ /** Pointer to data. */
void *data_pointer(); void *data_pointer();
/**
* Fills dest pointer with the analog data converted to float.
* The pointer must have space for num_samples() floats.
*/
void get_data_as_float(float *dest);
/** Number of samples in this packet. */ /** Number of samples in this packet. */
unsigned int num_samples() const; unsigned int num_samples() const;
/** Channels for which this packet contains data. */ /** Channels for which this packet contains data. */