IpatchSampleData

IpatchSampleData — A sample data object.

Synopsis




                    IpatchSampleData;
                    IpatchSampleDataClass;
#define             IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT
enum                IpatchSampleDataFindFlags;
IpatchSampleData*   ipatch_sample_data_new              (void);
IpatchSampleData*   ipatch_sample_data_first            (IpatchIter *iter);
IpatchSampleData*   ipatch_sample_data_next             (IpatchIter *iter);
#define             ipatch_sample_data_get_stores       (sampledata)
void                ipatch_sample_data_set_size         (IpatchSampleData *sampledata,
                                                         guint size);
guint               ipatch_sample_data_get_size         (IpatchSampleData *sampledata);
int                 ipatch_sample_data_get_primary_format
                                                        (IpatchSampleData *sampledata);
int                 ipatch_sample_data_get_primary_channels
                                                        (IpatchSampleData *sampledata);
int                 ipatch_sample_data_get_primary_frame_size
                                                        (IpatchSampleData *sampledata);
IpatchSampleStore*  ipatch_sample_data_find_store_ref   (IpatchSampleData *sampledata,
                                                         GType store_type,
                                                         int format,
                                                         int find_flags);
IpatchSampleData*   ipatch_sample_data_ref_blank        (void);
IpatchList*         ipatch_sample_data_get_list         (void);

Object Hierarchy


  GObject
   +----IpatchItem
         +----IpatchContainer
               +----IpatchSampleData

Implemented Interfaces

IpatchSampleData implements IpatchSample.

Properties


  "sample-rate"              gint                  : Read / Write
  "sample-size"              guint                 : Read / Write

Description

A container object that tracks audio sample data. It consists of one or more sample stores that contain the same audio but may be stored in different ways, differ in sample bit width or number of channels.

Details

IpatchSampleData

typedef struct _IpatchSampleData IpatchSampleData;


IpatchSampleDataClass

typedef struct {
  IpatchContainerClass parent_class;
} IpatchSampleDataClass;


IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT

#define             IPATCH_SAMPLE_DATA_UNUSED_FLAG_SHIFT


enum IpatchSampleDataFindFlags

typedef enum /*< flags >*/
{
  IPATCH_SAMPLE_DATA_FIND_READABLE     = 1 << 0,
  IPATCH_SAMPLE_DATA_FIND_WRITABLE     = 1 << 1,
  IPATCH_SAMPLE_DATA_FIND_FASTEST      = 1 << 2,
  IPATCH_SAMPLE_DATA_FIND_INACTIVE     = 1 << 3,
  IPATCH_SAMPLE_DATA_FIND_EXACT_FORMAT = 1 << 4
} IpatchSampleDataFindFlags;

Flags for locating IpatchSampleStore objects in IpatchSampleData objects.

IPATCH_SAMPLE_DATA_FIND_READABLE Find a readable sample store.
IPATCH_SAMPLE_DATA_FIND_WRITABLE Find a writable sample store.
IPATCH_SAMPLE_DATA_FIND_FASTEST Find the fastest sample store.
IPATCH_SAMPLE_DATA_FIND_INACTIVE Also search inactive sample stores.
IPATCH_SAMPLE_DATA_FIND_EXACT_FORMAT

ipatch_sample_data_new ()

IpatchSampleData*   ipatch_sample_data_new              (void);

Create a new sample data object.

Returns : New sample data with a reference count of 1. Caller owns the reference and removing it will destroy the item, unless another reference is added (if its parented for example).

ipatch_sample_data_first ()

IpatchSampleData*   ipatch_sample_data_first            (IpatchIter *iter);

Gets the first item in a sample data iterator. A convenience wrapper for ipatch_iter_first().

iter : Patch item iterator containing IpatchSampleData items
Returns : The first sample data in iter or NULL if empty.

ipatch_sample_data_next ()

IpatchSampleData*   ipatch_sample_data_next             (IpatchIter *iter);

Gets the next item in a sample data iterator. A convenience wrapper for ipatch_iter_next().

iter : Patch item iterator containing IpatchSampleData items
Returns : The next sample data in iter or NULL if at the end of the list.

ipatch_sample_data_get_stores()

#define             ipatch_sample_data_get_stores(sampledata)

sampledata :

ipatch_sample_data_set_size ()

void                ipatch_sample_data_set_size         (IpatchSampleData *sampledata,
                                                         guint size);

Set the size of a sample data object. Size of sample data object should not have been set before (i.e. only new sample data objects should have their size set).

sampledata : Sample data object to set size of
size : Size (in frames) to set sample data object to.

ipatch_sample_data_get_size ()

guint               ipatch_sample_data_get_size         (IpatchSampleData *sampledata);

Gets the sample size from a sample data object.

sampledata : Sample data to get size of
Returns : Size of sample data object in frames. Each store can contain different sample widths or channels, so to calculate actual memory sizes, use ipatch_sample_store_get_size().

ipatch_sample_data_get_primary_format ()

int                 ipatch_sample_data_get_primary_format
                                                        (IpatchSampleData *sampledata);

Get the sample format of the primary sample store (first sample store) in a sample data object. See ipatch_sample_store_get_format() for more info.

sampledata : Sample data object
Returns : Sample format or 0 if sampledata has no stores.

ipatch_sample_data_get_primary_channels ()

int                 ipatch_sample_data_get_primary_channels
                                                        (IpatchSampleData *sampledata);

Get the number of channels from the primary sample store (first sample store) in a sample data object.

sampledata : Sample data object
Returns : Number of channels in primary store or 0 if sampledata has no stores.

ipatch_sample_data_get_primary_frame_size ()

int                 ipatch_sample_data_get_primary_frame_size
                                                        (IpatchSampleData *sampledata);

Get the frame size (channels * sample_byte_width) from the primary sample store (first sample store) in a sample data object.

sampledata : Sample data object
Returns : Frame size of primary store or 0 if sampledata has no stores.

ipatch_sample_data_find_store_ref ()

IpatchSampleStore*  ipatch_sample_data_find_store_ref   (IpatchSampleData *sampledata,
                                                         GType store_type,
                                                         int format,
                                                         int find_flags);

Find a sample store in a sample data object by criteria. Only active sample stores are searched for unless IPATCH_SAMPLE_DATA_FIND_INACTIVE is specified, in which case active or inactive sample stores are searched. If format is set and the IPATCH_SAMPLE_DATA_FIND_FASTEST flag is specified then the fastest store of the given format is returned, if no stores of the given format are found then the fastest store is returned (unless the IPATCH_SAMPLE_DATA_FIND_EXACT_FORMAT flag is specified).

Returned sample store's reference count has been incremented and should be removed by the caller with g_object_unref() when finished with it.

sampledata : Sample data object
store_type : Sample store type to find (0 as a wildcard).
format : Sample format to find (0 as a wildcard).
find_flags : Criteria for finding a sample store (IpatchSampleDataFindFlags).
Returns : A sample store matching the criteria or NULL if no match or no stores in sampledata. Remember to unref the sample store with g_object_unref() when finished with it.

ipatch_sample_data_ref_blank ()

IpatchSampleData*   ipatch_sample_data_ref_blank        (void);

Get blank sample data object. Return's a sample data structure with the minimum amount of data which is blank. Only creates it on the first call, subsequent calls return the same sample data object. Therefore it should not be modified. The blank sample data's reference count has been incremented and should be removed by the caller with g_object_unref() when finished with it.

Returns : The blank sample data object. Remember to unref it when not using it anymore with g_object_unref().

ipatch_sample_data_get_list ()

IpatchList*         ipatch_sample_data_get_list         (void);

Creates an object list copy of the master sample data list (all existing sample data objects).

Returns : New object list populated with all IpatchSampleData objects with a reference count of 1 which the caller owns, removing the reference will free the list.

Property Details

The "sample-rate" property

  "sample-rate"              gint                  : Read / Write

Sampling rate in Hertz.

Allowed values: [8000,192000]

Default value: 44100


The "sample-size" property

  "sample-size"              guint                 : Read / Write

Size in frames.

Default value: 0

See Also

IpatchSampleStore