qubidl.h.html mathcode2html   
 Source file:   qubidl.h
 Converted:   Sat May 23 2015 at 15:07:21
 This documentation file will not reflect any later changes in the source file.

$$\phantom{******** If you see this on the webpage then the browser could not locate *********}$$
$$\phantom{******** jsMath/easy/load.js or the variable root is set wrong in this file *********}$$
$$\newcommand{\vector}[1]{\left[\begin{array}{c} #1 \end{array}\right]}$$ $$\newenvironment{matrix}{\left[\begin{array}{cccccccccc}} {\end{array}\right]}$$ $$\newcommand{\A}{{\cal A}}$$ $$\newcommand{\W}{{\cal W}}$$

/* Copyright 2002-2011 Research Foundation State University of New York   */

/* This file is part of QUB Express.                                      */

/* QUB Express is free software; you can redistribute it and/or modify    */
/* it under the terms of the GNU General Public License as published by   */
/* the Free Software Foundation, either version 3 of the License, or      */
/* (at your option) any later version.                                    */

/* QUB Express is distributed in the hope that it will be useful,         */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of         */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
/* GNU General Public License for more details.                           */

/* You should have received a copy of the GNU General Public License,     */
/* named LICENSE.txt, in the QUB Express program directory.  If not, see  */
/* <http://www.gnu.org/licenses/>.                                        */

#ifndef QUBIDL_H
#define QUBIDL_H

/*
Up: Index
*/

#ifdef __cplusplus
extern "C" {
#endif


QUBFAST_API void*  qubidl_create(double sampling);
// Returns a zero-length qubidl object.  sampling is usually in milliseconds.

QUBFAST_API void   qubidl_destroy(void *idl);
// Releases a qubidl object


QUBFAST_API double qubidl_get_sampling(void *idl);
// Returns sampling, usually in milliseconds

QUBFAST_API void   qubidl_set_sampling(void *idl, double sampling);
// Sets sampling


QUBFAST_API int    qubidl_get_seg_count(void *idl);
// Returns the number of segments.

QUBFAST_API int    qubidl_get_seg_first(void *idl, int i);
// Returns the first sample index in segment i

QUBFAST_API int    qubidl_get_seg_last(void *idl, int i);
// Returns the lsat sample index in segment i


QUBFAST_API int    qubidl_count_dwells(void *idl, int f, int l, int fragments);
// Returns the number of dwells between sample f and sample l, inclusive.
// If ( ! fragments ) it doesn't count dwells which extend beyond the bounds.

QUBFAST_API int    qubidl_count_dwells_and_gaps(void *idl, int f, int l);
// Returns the number of dwells between sample f and sample l, inclusive.
// Unlike count_dwells, counts each non-idealized region as a dwell (of class -1)

QUBFAST_API int    qubidl_get_dwells(void *idl, int f, int l, int fragments, int *firsts, int *lasts, int *classes, float *durations);
// Copies the dwells between samples f and l, inclusive, into the arrays firsts, lasts, classes, and durations.
// Durations are count*sampling.

QUBFAST_API int    qubidl_get_dwells_and_gaps(void *idl, int f, int l,
					      int *firsts, int *lasts, int *classes, float *durations);
// Copies the dwells between samples f and l, inclusive, into the arrays firsts, lasts, classes, and durations.
// Durations are count*sampling.
// Unlike get_dwells, outputs each non-idealized region as a dwell of class -1.

QUBFAST_API void   qubidl_set_dwells(void *idl, int count, int *firsts, int *lasts, int *classes);
// Overwrites the idealization with `count` dwells from first, lasts and classes.


QUBFAST_API void   qubidl_sample_dwells(void *idl, int f, int l, double *amp, int Nsample, float *lo, float *hi);
// Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display.
// Samples with no dwells (all class < 0) are not modified, so if you fill lo or hi with a sentry value, you can skip blank samples.

QUBFAST_API void   qubidl_sample_dwells_classes(void *idl, int f, int l, double *amp, int Nsample, float *lo, float *hi, unsigned int *class_bits);
  // class_bits[i] & (1 << c) if sample includes class c (using (c % 32) for passable display in case of too many classes)

QUBFAST_API void   qubidl_sample_dwells_std(void *idl, int f, int l, float *amp, float *std, int Nsample, float *lo, float *hi);
// Renders the dwells between samples f and l, inclusive, into resampled arrays lo and hi, suitable for display.
// Samples with no dwells (all class < 0) are not modified, so if you fill lo or hi with a sentry value, you can skip blank samples.

QUBFAST_API void   qubidl_clear(void *idl);
// Erases all dwells.  Clears all segments to class -1.

QUBFAST_API void   qubidl_add_seg(void *idl, int f, int l);
// Adds a segment, with inclusive sample bounds.
// For best results, use f = total sample count; l = f+seg_length-1.

QUBFAST_API void   qubidl_erase(void *idl, int f, int l);
// Clears all dwells (or fragments) between samples f and l inclusive, by setting them to class -1.

QUBFAST_API void   qubidl_join(void *idl, int f, int l);
// Extends the class at sample f through to sample l.


QUBFAST_API void*  qubidl_begin(void *idl);
// Returns an iterator pointing at the first (partial) dwell

QUBFAST_API void*  qubidl_end(void *idl);
// Returns an iterator pointing past the final (partial) dwell

QUBFAST_API void*  qubidl_find(void *idl, int f);
// Returns an iterator pointing at the (partial) dwell containing sample f

QUBFAST_API void*  qubidl_iter_clone(void *iter);
// Returns an iterator pointing at the same (partial) dwell as iter.

QUBFAST_API void   qubidl_iter_destroy(void *iter);
// Releases an iterator.

QUBFAST_API int    qubidl_iter_valid(void *iter);
// Returns nonzero if the iterator is pointing at a (partial) dwell (not past the end)

QUBFAST_API int    qubidl_iter_equals(void *iter, void *iter2);
// Returns nonzero if the iterators are pointing at the same (partial) dwell

QUBFAST_API int    qubidl_iter_segindex(void *iter);
// Returns the segment index of the current dwell

QUBFAST_API int    qubidl_iter_segfirst(void *iter);
// Returns the first sample index in the current dwell's segment

QUBFAST_API void   qubidl_iter_read(void *iter, int *f, int *l, int *c);
// Copies the first and last indices, and class of the current (partial) dwell into f,l,c

QUBFAST_API void   qubidl_iter_next(void *iter);
// Moves the iterator to the next (partial) dwell

QUBFAST_API void   qubidl_iter_prev(void *iter);
// Moves the iterator to the previous (partial) dwell


#ifdef __cplusplus
}
#endif




#endif