1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>IpatchSampleTransform</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="libinstpatch Reference Manual">
<link rel="up" href="ch03.html" title="Sample data objects and functions">
<link rel="prev" href="IpatchSampleStore.html" title="IpatchSampleStore">
<link rel="next" href="libinstpatch-sample.html" title="sample">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="Base objects and functions">
<link rel="chapter" href="ch02.html" title="Utility objects and functions">
<link rel="chapter" href="ch03.html" title="Sample data objects and functions">
<link rel="chapter" href="ch04.html" title="DLS patches">
<link rel="chapter" href="ch05.html" title="SoundFont patches">
<link rel="chapter" href="ch06.html" title="GigaSampler patches">
<link rel="chapter" href="ch07.html" title="Virtual banks">
<link rel="chapter" href="object-tree.html" title="Object Hierarchy">
<link rel="index" href="api-index-full.html" title="API Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="IpatchSampleStore.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libinstpatch Reference Manual</th>
<td><a accesskey="n" href="libinstpatch-sample.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libinstpatch-IpatchSampleTransform.synopsis" class="shortcut">Top</a>
|
<a href="#libinstpatch-IpatchSampleTransform.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="IpatchSampleTransform">
<a name="libinstpatch-IpatchSampleTransform"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libinstpatch-IpatchSampleTransform.top_of_page"></a>IpatchSampleTransform</span></h2>
<p>IpatchSampleTransform — Audio format conversion instance</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" title="Stability Level">
<a name="libinstpatch-IpatchSampleTransform.stability-level"></a><h2>Stability Level</h2>
Stable, unless otherwise indicated
</div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="libinstpatch-IpatchSampleTransform.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a>;
void (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransformFunc"
>*IpatchSampleTransformFunc</a>) (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> * <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-new"
>ipatch_sample_transform_new</a> (int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-free"
>ipatch_sample_transform_free</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-init"
>ipatch_sample_transform_init</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> * <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-pool-acquire"
>ipatch_sample_transform_pool_acquire</a>
(int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-pool-release"
>ipatch_sample_transform_pool_release</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-set-formats"
>ipatch_sample_transform_set_formats</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-alloc"
>ipatch_sample_transform_alloc</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);
int <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-alloc-size"
>ipatch_sample_transform_alloc_size</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> size);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-free-buffers"
>ipatch_sample_transform_free_buffers</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-set-buffers-size"
>ipatch_sample_transform_set_buffers_size</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> buf,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> size);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-get-buffers"
>ipatch_sample_transform_get_buffers</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> *buf1,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> *buf2);
void <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-get-frame-sizes"
>ipatch_sample_transform_get_frame_sizes</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> *buf1_size,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> *buf2_size);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-get-max-frames"
>ipatch_sample_transform_get_max_frames</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-convert"
>ipatch_sample_transform_convert</a> (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gconstpointer"
>gconstpointer</a> src,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> dest,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-convert-single"
>ipatch_sample_transform_convert_single</a>
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="libinstpatch-IpatchSampleTransform.description"></a><h2>Description</h2>
<p>
A structure for converting between audio formats (for example the bit width
or number of channels). This structure is initialized with the source and
destination audio formats, multi-channel mapping and conversion buffers.</p>
</div>
<div class="refsect1" title="Details">
<a name="libinstpatch-IpatchSampleTransform.details"></a><h2>Details</h2>
<div class="refsect2" title="IpatchSampleTransform">
<a name="IpatchSampleTransform"></a><h3>IpatchSampleTransform</h3>
<pre class="programlisting">typedef struct {
guint16 src_format; /* source sample format */
guint16 dest_format; /* destination sample format */
guint8 channel_map[8]; /* channel mapping for multi-channel audio */
guint8 buf1_max_frame; /* max bytes per frame for buf1 */
guint8 buf2_max_frame; /* max bytes per frame for buf2 */
guint8 func_count; /* number of functions in funcs array */
guint8 free_buffers; /* set to TRUE if buffers need to be freed */
guint max_frames; /* max frames that can be converted in batch */
guint frames; /* number of frames to transform */
guint samples; /* # of samples for current transform func (not frames!)*/
gpointer buf1; /* buffer 1 (first input) */
gpointer buf2; /* buffer 2 */
guint combined_size; /* size in bytes of both buffers (if combined) */
gpointer reserved1; /* Reserved field */
gpointer reserved2; /* Reserved field */
/* array of transform funcs */
IpatchSampleTransformFunc funcs[IPATCH_SAMPLE_MAX_TRANSFORM_FUNCS];
} IpatchSampleTransform;
</pre>
</div>
<hr>
<div class="refsect2" title="IpatchSampleTransformFunc ()">
<a name="IpatchSampleTransformFunc"></a><h3>IpatchSampleTransformFunc ()</h3>
<pre class="programlisting">void (*IpatchSampleTransformFunc) (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Audio conversion handler prototype. Handler will modify
<em class="structfield"><code>samples</code></em> of <em class="parameter"><code>transform</code></em> if number of samples
changes (a change in the number of channels occurs).</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_new ()">
<a name="ipatch-sample-transform-new"></a><h3>ipatch_sample_transform_new ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> * ipatch_sample_transform_new (int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);</pre>
<p>
Create a new sample transform object. If <em class="parameter"><code>src_format</code></em> and <em class="parameter"><code>dest_format</code></em> are
not 0 then the transform is initialized for the given source and destination
formats, otherwise they are expected to be set later with
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-set-formats"
><code class="function">ipatch_sample_transform_set_formats()</code></a>.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_format</code></em> :</span></p></td>
<td> Source sample format or 0 to set later
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_format</code></em> :</span></p></td>
<td> Destination sample format or 0 to set later
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel_map</code></em> :</span></p></td>
<td> Channel mapping (use <a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-UNITY-CHANNEL-MAP--CAPS"
><span class="type">IPATCH_SAMPLE_UNITY_CHANNEL_MAP</span></a>
to map all input channels to the same output channels, see
<a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-MAP-CHANNEL--CAPS"
><span class="type">IPATCH_SAMPLE_MAP_CHANNEL</span></a> macro for constructing channel map values)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> New allocated sample transform structure which should be freed with
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-free"
><code class="function">ipatch_sample_transform_free()</code></a> when done with it.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_free ()">
<a name="ipatch-sample-transform-free"></a><h3>ipatch_sample_transform_free ()</h3>
<pre class="programlisting">void ipatch_sample_transform_free (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Free a transform structure as allocated by <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-new"
><code class="function">ipatch_sample_transform_new()</code></a> and
its allocated resources.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Transform structure
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_init ()">
<a name="ipatch-sample-transform-init"></a><h3>ipatch_sample_transform_init ()</h3>
<pre class="programlisting">void ipatch_sample_transform_init (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Initialize a sample transform structure. Usually only used to initialize transform
structures allocated on the stack, which is done to avoid mallocs.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform to initialize
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_pool_acquire ()">
<a name="ipatch-sample-transform-pool-acquire"></a><h3>ipatch_sample_transform_pool_acquire ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> * ipatch_sample_transform_pool_acquire
(int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);</pre>
<p>
Get an unused sample transform object from the sample transform pool.
Used for quickly getting a transform object for temporary use without the
overhead of allocating one. Note though, that if no more transforms exist
in the pool an allocation will occur.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_format</code></em> :</span></p></td>
<td> Source sample format
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_format</code></em> :</span></p></td>
<td> Destination sample format
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel_map</code></em> :</span></p></td>
<td> Channel mapping (use <a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-UNITY-CHANNEL-MAP--CAPS"
><span class="type">IPATCH_SAMPLE_UNITY_CHANNEL_MAP</span></a>
to map all input channels to the same output channels, see
<a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-MAP-CHANNEL--CAPS"
><span class="type">IPATCH_SAMPLE_MAP_CHANNEL</span></a> macro for constructing channel map values)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Sample transform object. Should be released after use with
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-pool-release"
><code class="function">ipatch_sample_transform_pool_release()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_pool_release ()">
<a name="ipatch-sample-transform-pool-release"></a><h3>ipatch_sample_transform_pool_release ()</h3>
<pre class="programlisting">void ipatch_sample_transform_pool_release
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Release a sample transform object, returned by
<code class="function">ipatch_sample_transform_pool_grab()</code>, back to the transform pool.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_set_formats ()">
<a name="ipatch-sample-transform-set-formats"></a><h3>ipatch_sample_transform_set_formats ()</h3>
<pre class="programlisting">void ipatch_sample_transform_set_formats (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
int src_format,
int dest_format,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"
>guint32</a> channel_map);</pre>
<p>
Initialize a sample transform object for converting from
<em class="parameter"><code>src_format</code></em> to <em class="parameter"><code>dest_format</code></em>.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_format</code></em> :</span></p></td>
<td> Source audio format to convert from
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_format</code></em> :</span></p></td>
<td> Destination audio format to convert to
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel_map</code></em> :</span></p></td>
<td> Channel mapping (use <a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-UNITY-CHANNEL-MAP--CAPS"
><span class="type">IPATCH_SAMPLE_UNITY_CHANNEL_MAP</span></a>
to map all input channels to the same output channels, see
<a
href="../libinstpatch/libinstpatch-sample.html#IPATCH-SAMPLE-MAP-CHANNEL--CAPS"
><span class="type">IPATCH_SAMPLE_MAP_CHANNEL</span></a> macro for constructing channel map values)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_alloc ()">
<a name="ipatch-sample-transform-alloc"></a><h3>ipatch_sample_transform_alloc ()</h3>
<pre class="programlisting">void ipatch_sample_transform_alloc (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);</pre>
<p>
Allocate buffers for transforming between two audio formats, for
which <em class="parameter"><code>transform</code></em> has previously been initialized for with
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-new"
><code class="function">ipatch_sample_transform_new()</code></a> or <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-set-formats"
><code class="function">ipatch_sample_transform_set_formats()</code></a>.
</p>
<p>
Note: Assigning buffers with this function allows sample formats to be
changed without re-assigning the buffers.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>frames</code></em> :</span></p></td>
<td> Number of frames to allocate for (max frames processed in batch)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_alloc_size ()">
<a name="ipatch-sample-transform-alloc-size"></a><h3>ipatch_sample_transform_alloc_size ()</h3>
<pre class="programlisting">int ipatch_sample_transform_alloc_size (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> size);</pre>
<p>
Like <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-alloc"
><code class="function">ipatch_sample_transform_alloc()</code></a> but allocates buffers based on a
maximum size and returns the maximum number of sample frames which can be
converted at a time using this size. Another difference is that conversion
formats do not need to be set before calling this function.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> Maximum total size in bytes of allocation for both transform buffers.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The maximum number of frames that can be converted at a time for
the given <em class="parameter"><code>size</code></em> of transform buffers. If conversion formats have not yet
been set, then this function returns 0.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_free_buffers ()">
<a name="ipatch-sample-transform-free-buffers"></a><h3>ipatch_sample_transform_free_buffers ()</h3>
<pre class="programlisting">void ipatch_sample_transform_free_buffers
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Free sample transform buffers.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_set_buffers_size ()">
<a name="ipatch-sample-transform-set-buffers-size"></a><h3>ipatch_sample_transform_set_buffers_size ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> ipatch_sample_transform_set_buffers_size
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> buf,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> size);</pre>
<p>
Assign transform buffers using a single buffer of a
specific size in bytes and determine optimal division for source and
destination buffers. Conversion formats must not be set before calling this
function (can be set later).</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em> :</span></p></td>
<td> Buffer to assign for transforming sample formats
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> Size of <em class="parameter"><code>buf</code></em> in bytes
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The maximum number of frames that can be converted at a time for
the given <em class="parameter"><code>size</code></em> of transform buffers. If conversion formats have not yet
been set, then this function returns 0.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_get_buffers ()">
<a name="ipatch-sample-transform-get-buffers"></a><h3>ipatch_sample_transform_get_buffers ()</h3>
<pre class="programlisting">void ipatch_sample_transform_get_buffers (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> *buf1,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> *buf2);</pre>
<p>
Get the sample data buffers in a sample transform object.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf1</code></em> :</span></p></td>
<td> Output - first buffer or <code class="literal">NULL</code> to ignore
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf2</code></em> :</span></p></td>
<td> Output - second buffer or <code class="literal">NULL</code> to ignore
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_get_frame_sizes ()">
<a name="ipatch-sample-transform-get-frame-sizes"></a><h3>ipatch_sample_transform_get_frame_sizes ()</h3>
<pre class="programlisting">void ipatch_sample_transform_get_frame_sizes
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> *buf1_size,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> *buf2_size);</pre>
<p>
Get max frame sizes for transform buffers. When transforming audio the
first buffer must be at least frames * buf1_size bytes in size and the
second buffer must be at least frames * buf2_size, where frames is the
max number of frames to convert in batch.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Initialized transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf1_size</code></em> :</span></p></td>
<td> Out: Maximum frame size for buffer 1 or <code class="literal">NULL</code> to ignore
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf2_size</code></em> :</span></p></td>
<td> Out: Maximum frame size for buffer 2 or <code class="literal">NULL</code> to ignore
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_get_max_frames ()">
<a name="ipatch-sample-transform-get-max-frames"></a><h3>ipatch_sample_transform_get_max_frames ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> ipatch_sample_transform_get_max_frames
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform);</pre>
<p>
Get the maximum frames that the <em class="parameter"><code>transform</code></em> object can convert at a time.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> Sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Max number of frames that can be converted at a time, 0 if buffers
have not been allocated yet.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_convert ()">
<a name="ipatch-sample-transform-convert"></a><h3>ipatch_sample_transform_convert ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> ipatch_sample_transform_convert (<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gconstpointer"
>gconstpointer</a> src,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> dest,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);</pre>
<p>
Convert an arbitrary number of audio frames from user provided buffers,
contrary to <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-convert-single"
><code class="function">ipatch_sample_transform_convert_single()</code></a> which uses internal
buffers and converts a max of 1 buffer at a time. The sample formats
should already be assigned and internal buffers assigned or allocated.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> An initialized sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td> Audio source buffer (<em class="parameter"><code>frames</code></em> X the source frame size in bytes), can
be <code class="literal">NULL</code> to use internal buffer (provided <em class="parameter"><code>frames</code></em> is less than or equal to
the max frames that can be converted at a time), in which case buf1 of
<em class="parameter"><code>transform</code></em> should already be loaded with source data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td> Converted audio destination buffer (<em class="parameter"><code>frames</code></em> X the destination frame
size in bytes), can be <code class="literal">NULL</code> to use internal buffer (provided <em class="parameter"><code>frames</code></em> is
less than or equal to the max frames that can be converted at a time).
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>frames</code></em> :</span></p></td>
<td> Number of audio frames to convert
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Pointer to converted data. Will be <em class="parameter"><code>dest</code></em> if it was not <code class="literal">NULL</code> or
internal buffer containing the converted data otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_sample_transform_convert_single ()">
<a name="ipatch-sample-transform-convert-single"></a><h3>ipatch_sample_transform_convert_single ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"
>gpointer</a> ipatch_sample_transform_convert_single
(<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#IpatchSampleTransform"
>IpatchSampleTransform</a> *transform,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"
>guint</a> frames);</pre>
<p>
Convert the format of a single buffer of audio. The <em class="parameter"><code>transform</code></em> object must
have had its sample formats set and buffers assigned or allocated. Use
<a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-convert"
><code class="function">ipatch_sample_transform_convert()</code></a> to convert from one buffer to another
regardless of the number of frames.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>transform</code></em> :</span></p></td>
<td> An initialized sample transform object
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>frames</code></em> :</span></p></td>
<td> Number of frames to convert (should be less than or equal to the
maximum frames which can be converted at a time
(see <a
href="../libinstpatch/libinstpatch-IpatchSampleTransform.html#ipatch-sample-transform-get-max-frames"
><code class="function">ipatch_sample_transform_get_max_frames()</code></a>).
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Pointer to converted audio data (buffer is internal to <em class="parameter"><code>transform</code></em>
object).
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>
|