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 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
|
/******************************************************************************#
# guvcview http://guvcview.sourceforge.net #
# #
# Paulo Assis <pj.assis@gmail.com> #
# Nobuhiro Iwamatsu <iwamatsu@nigauri.org> #
# Add UYVY color support(Macbook iSight) #
# Flemming Frandsen <dren.dk@gmail.com> #
# Add VU meter OSD #
# #
# This program 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 2 of the License, or #
# (at your option) any later version. #
# #
# This program 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 #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
*******************************************************************************/
/******************************************************************************
# # # Audio library # # #
*******************************************************************************/
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
/* support for internationalization - i18n */
#include <libintl.h>
#include <locale.h>
#include "audio.h"
#include "audio_portaudio.h"
#include "gview.h"
#include "gviewaudio.h"
#if HAS_PULSEAUDIO
#include "audio_pulseaudio.h"
#endif
#define AUDBUFF_NUM 80 /*number of audio buffers*/
#define AUDBUFF_FRAMES 1152 /*number of audio frames per buffer*/
static audio_buff_t *audio_buffers = NULL; /*pointer to buffers list*/
static int buffer_read_index = 0; /*current read index of buffer list*/
static int buffer_write_index = 0; /*current write index of buffer list*/
int audio_verbosity = 0;
/*
* set audio_verbosity
* args:
* value - verbosity value
*
* asserts:
* none
*
* returns: none
*/
void audio_set_verbosity(int value) { audio_verbosity = value; }
/*
* Lock the mutex
* args:
* none
*
* asserts:
* none
*
* returns: none
*/
void audio_lock_mutex(audio_context_t *audio_ctx) {
__LOCK_MUTEX(&(audio_ctx->mutex));
}
/*
* Unlock the mutex
* args:
* none
*
* asserts:
* none
*
* returns: none
*/
void audio_unlock_mutex(audio_context_t *audio_ctx) {
__UNLOCK_MUTEX(&(audio_ctx->mutex));
}
/*
* free audio buffers
* args:
* none
*
* asserts:
* none
*
* returns: error code
*/
static void audio_free_buffers() {
buffer_read_index = 0;
buffer_write_index = 0;
/*return if no buffers set*/
if (!audio_buffers) {
if (audio_verbosity > 0)
fprintf(stderr, "AUDIO: can't free audio buffers (audio_free_buffers): "
"audio_buffers is null\n");
return;
}
int i = 0;
for (i = 0; i < AUDBUFF_NUM; ++i) {
free(audio_buffers[i].data);
}
free(audio_buffers);
audio_buffers = NULL;
}
/*
* alloc a single audio buffer
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* none
*
* returns: pointer to newly allocate audio buffer or NULL on error
* must be freed with audio_delete_buffer
* data is allocated for float(32 bit) samples but can also store
* int16 (16 bit) samples
*/
audio_buff_t *audio_get_buffer(audio_context_t *audio_ctx) {
if (audio_ctx->capture_buff_size <= 0) {
fprintf(stderr, "AUDIO: (get_buffer) invalid capture_buff_size(%i)\n",
audio_ctx->capture_buff_size);
return NULL;
}
audio_buff_t *audio_buff = calloc(1, sizeof(audio_buff_t));
if (audio_buff == NULL) {
fprintf(stderr,
"AUDIO: FATAL memory allocation failure (audio_get_buffer): %s\n",
strerror(errno));
exit(-1);
}
audio_buff->data = calloc(audio_ctx->capture_buff_size, sizeof(sample_t));
if (audio_buff->data == NULL) {
fprintf(stderr,
"AUDIO: FATAL memory allocation failure (audio_get_buffer): %s\n",
strerror(errno));
exit(-1);
}
return audio_buff;
}
/*
* deletes a single audio buffer
* args:
* audio_buff - pointer to audio_buff_t data
*
* asserts:
* none
*
* returns: none
*/
void audio_delete_buffer(audio_buff_t *audio_buff) {
if (!audio_buff)
return;
if (audio_buff->data)
free(audio_buff->data);
free(audio_buff);
}
/*
* alloc audio buffers
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* none
*
* returns: error code
*/
static int audio_init_buffers(audio_context_t *audio_ctx) {
if (!audio_ctx)
return -1;
/*don't allocate if no audio*/
if (audio_ctx->api == AUDIO_NONE) {
audio_buffers = NULL;
return 0;
}
int i = 0;
/*set the buffers size*/
if (!audio_ctx->capture_buff_size)
audio_ctx->capture_buff_size = audio_ctx->channels * AUDBUFF_FRAMES;
if (audio_ctx->capture_buff)
free(audio_ctx->capture_buff);
audio_ctx->capture_buff =
calloc(audio_ctx->capture_buff_size, sizeof(sample_t));
if (audio_ctx->capture_buff == NULL) {
fprintf(stderr,
"AUDIO: FATAL memory allocation failure (audio_init_buffers): %s\n",
strerror(errno));
exit(-1);
}
/*free audio_buffers (if any)*/
audio_free_buffers();
audio_buffers = calloc(AUDBUFF_NUM, sizeof(audio_buff_t));
if (audio_buffers == NULL) {
fprintf(stderr,
"AUDIO: FATAL memory allocation failure (audio_init_buffers): %s\n",
strerror(errno));
exit(-1);
}
for (i = 0; i < AUDBUFF_NUM; ++i) {
audio_buffers[i].data =
calloc(audio_ctx->capture_buff_size, sizeof(sample_t));
if (audio_buffers[i].data == NULL) {
fprintf(
stderr,
"AUDIO: FATAL memory allocation failure (audio_init_buffers): %s\n",
strerror(errno));
exit(-1);
}
audio_buffers[i].flag = AUDIO_BUFF_FREE;
}
return 0;
}
/*
* fill a audio buffer data and move write index to next one
* args:
* audio_ctx - pointer to audio context data
* ts - timestamp for end of data
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_fill_buffer(audio_context_t *audio_ctx, int64_t ts) {
/*assertions*/
assert(audio_ctx != NULL);
if (audio_verbosity > 3)
printf("AUDIO: filling buffer ts:%" PRId64 "\n", ts);
/*in nanosec*/
uint64_t frame_length = NSEC_PER_SEC / audio_ctx->samprate;
uint64_t buffer_length =
frame_length * (audio_ctx->capture_buff_size / audio_ctx->channels);
audio_ctx->current_ts += buffer_length; /*buffer end time*/
audio_ctx->ts_drift = audio_ctx->current_ts - ts;
/*get the current write indexed buffer flag*/
audio_lock_mutex(audio_ctx);
int flag = audio_buffers[buffer_write_index].flag;
audio_unlock_mutex(audio_ctx);
if (flag == AUDIO_BUFF_USED) {
fprintf(stderr, "AUDIO: write buffer(%i) is still in use - dropping data\n",
buffer_write_index);
return;
}
/*write max_frames and fill a buffer*/
memcpy(audio_buffers[buffer_write_index].data, audio_ctx->capture_buff,
audio_ctx->capture_buff_size * sizeof(sample_t));
/*buffer begin time*/
audio_buffers[buffer_write_index].timestamp =
audio_ctx->current_ts - buffer_length;
if (audio_buffers[buffer_write_index].timestamp < 0)
fprintf(stderr,
"AUDIO: write buffer(%i) - invalid timestamp (< 0): cur_ts:%" PRId64
" buf_length:%" PRId64 "\n",
buffer_write_index, audio_ctx->current_ts, buffer_length);
audio_buffers[buffer_write_index].level_meter[0] =
audio_ctx->capture_buff_level[0];
audio_buffers[buffer_write_index].level_meter[1] =
audio_ctx->capture_buff_level[1];
audio_lock_mutex(audio_ctx);
audio_buffers[buffer_write_index].flag = AUDIO_BUFF_USED;
NEXT_IND(buffer_write_index, AUDBUFF_NUM);
audio_unlock_mutex(audio_ctx);
}
/* saturate float samples to int16 limits*/
static int16_t clip_int16(float in) {
// int16_t out = (int16_t) (in < -32768) ? -32768 : (in > 32767) ? 32767 : in;
long lout = lroundf(in);
int16_t out = (lout < INT16_MIN) ? INT16_MIN
: (lout > INT16_MAX) ? INT16_MAX
: (int16_t)lout;
return (out);
}
/*
* get the next used buffer from the ring buffer
* args:
* audio_ctx - pointer to audio context
* buff - pointer to an allocated audio buffer
* type - type of data (SAMPLE_TYPE_[INT16|FLOAT])
* mask - audio fx mask
*
* asserts:
* none
*
* returns: error code
*/
int audio_get_next_buffer(audio_context_t *audio_ctx, audio_buff_t *buff,
int type, uint32_t mask) {
audio_lock_mutex(audio_ctx);
int flag = audio_buffers[buffer_read_index].flag;
audio_unlock_mutex(audio_ctx);
if (flag == AUDIO_BUFF_FREE)
return 1; /*all done*/
/*aplly fx*/
audio_fx_apply(audio_ctx, (sample_t *)audio_buffers[buffer_read_index].data,
mask);
/*copy data into requested format type*/
int i = 0;
switch (type) {
case GV_SAMPLE_TYPE_FLOAT: {
sample_t *my_data = (sample_t *)buff->data;
memcpy(my_data, audio_buffers[buffer_read_index].data,
audio_ctx->capture_buff_size * sizeof(sample_t));
break;
}
case GV_SAMPLE_TYPE_INT16: {
int16_t *my_data = (int16_t *)buff->data;
sample_t *buff_p = (sample_t *)audio_buffers[buffer_read_index].data;
for (i = 0; i < audio_ctx->capture_buff_size; ++i) {
my_data[i] = clip_int16((buff_p[i]) * INT16_MAX);
}
break;
}
case GV_SAMPLE_TYPE_FLOATP: {
int j = 0;
float *my_data[audio_ctx->channels];
sample_t *buff_p = (sample_t *)audio_buffers[buffer_read_index].data;
for (j = 0; j < audio_ctx->channels; ++j)
my_data[j] =
(float *)(((float *)buff->data) +
(j * audio_ctx->capture_buff_size / audio_ctx->channels));
for (i = 0; i < audio_ctx->capture_buff_size / audio_ctx->channels; ++i)
for (j = 0; j < audio_ctx->channels; ++j) {
my_data[j][i] = *buff_p++;
}
break;
}
case GV_SAMPLE_TYPE_INT16P: {
int j = 0;
int16_t *my_data[audio_ctx->channels];
sample_t *buff_p = (sample_t *)audio_buffers[buffer_read_index].data;
for (j = 0; j < audio_ctx->channels; ++j)
my_data[j] =
(int16_t *)(((int16_t *)buff->data) +
(j * audio_ctx->capture_buff_size / audio_ctx->channels));
for (i = 0; i < audio_ctx->capture_buff_size / audio_ctx->channels; ++i)
for (j = 0; j < audio_ctx->channels; ++j) {
my_data[j][i] = clip_int16((*buff_p++) * INT16_MAX);
}
break;
}
} // end switch
buff->timestamp = audio_buffers[buffer_read_index].timestamp;
buff->level_meter[0] = audio_buffers[buffer_read_index].level_meter[0];
buff->level_meter[1] = audio_buffers[buffer_read_index].level_meter[1];
audio_lock_mutex(audio_ctx);
audio_buffers[buffer_read_index].flag = AUDIO_BUFF_FREE;
NEXT_IND(buffer_read_index, AUDBUFF_NUM);
audio_unlock_mutex(audio_ctx);
return 0;
}
/*
* audio initialization
* args:
* api - audio API to use
* (AUDIO_NONE, AUDIO_PORTAUDIO, AUDIO_PULSE, ...)
* device - api device index to use (-1 - use api default)
*
* asserts:
* none
*
* returns: pointer to audio context data (or NULL on error)
*/
audio_context_t *audio_init(int api, int device) {
audio_context_t *audio_ctx = calloc(1, sizeof(audio_context_t));
if (audio_ctx == NULL) {
fprintf(stderr, "AUDIO: (audio_init) couldn't allocate audio context\n");
return NULL;
}
/*initialize the mutex*/
__INIT_MUTEX(&(audio_ctx->mutex));
int ret = 0;
switch (api) {
case AUDIO_NONE:
audio_ctx->api = AUDIO_NONE;
break;
#if HAS_PULSEAUDIO
case AUDIO_PULSE:
ret = audio_init_pulseaudio(audio_ctx);
break;
#endif
case AUDIO_PORTAUDIO:
default:
ret = audio_init_portaudio(audio_ctx);
break;
} // end switch
/*if api couldn't be initialized set audio to none*/
if (ret != 0)
audio_ctx->api = AUDIO_NONE;
/*set default api device*/
audio_set_device_index(audio_ctx, device);
/*force a valid number of channels*/
if (audio_ctx->channels > 2)
audio_ctx->channels = 2;
return audio_ctx;
}
/*
* get audio api
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: audio API
*/
int audio_get_api(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->api;
}
/*
* set the audio device index to use
* args:
* audio_ctx - pointer to audio context data
* index - device index (from device list) to set
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_set_device_index(audio_context_t *audio_ctx, int index) {
/*assertions*/
assert(audio_ctx != NULL);
switch (audio_ctx->api) {
case AUDIO_NONE:
break;
#if HAS_PULSEAUDIO
case AUDIO_PULSE:
audio_set_pulseaudio_device(audio_ctx, index);
break;
#endif
case AUDIO_PORTAUDIO:
default:
audio_set_portaudio_device(audio_ctx, index);
break;
} // end switch
}
/*
* get the current audio device index
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: current device index (from device list)
*/
int audio_get_device_index(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->device;
}
/*
* get the number of available input audio devices
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: number of listed audio devices
*/
int audio_get_num_inp_devices(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->num_input_dev;
}
/*
* get the audio device referenced by index
* args:
* audio_ctx - pointer to audio context data
* index - index of audio device
*
* asserts:
* audio_ctx is not null
*
* returns: audio device referenced by index
*/
audio_device_t *audio_get_device(audio_context_t *audio_ctx, int index) {
/*assertions*/
assert(audio_ctx != NULL);
if (index >= audio_ctx->num_input_dev) {
fprintf(stderr, "AUDIO: (audio_get_device) bad index %i using %i\n", index,
audio_ctx->num_input_dev - 1);
index = audio_ctx->num_input_dev - 1;
}
if (index < 0) {
fprintf(stderr, "AUDIO: (audio_get_device) bad index %i using 0\n", index);
index = 0;
}
return &audio_ctx->list_devices[index];
}
/*
* set the current latency
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_set_latency(audio_context_t *audio_ctx, double latency) {
/*assertions*/
assert(audio_ctx != NULL);
audio_ctx->latency = latency;
}
/*
* get the current latency
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: defined lantency
*/
double audio_get_latency(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->latency;
}
/*
* set the number of channels
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_set_channels(audio_context_t *audio_ctx, int channels) {
/*assertions*/
assert(audio_ctx != NULL);
audio_ctx->channels = channels;
}
/*
* get the number of channels
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: number of channels
*/
int audio_get_channels(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->channels;
}
/*
* set the sample rate
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_set_samprate(audio_context_t *audio_ctx, int samprate) {
/*assertions*/
assert(audio_ctx != NULL);
audio_ctx->samprate = samprate;
}
/*
* get the sample rate
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: sample rate
*/
int audio_get_samprate(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
return audio_ctx->samprate;
}
/*
* set the capture buffer size
* args:
* audio_ctx - pointer to audio context data
* size - capture buffer size in bytes
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_set_cap_buffer_size(audio_context_t *audio_ctx, int size) {
/*assertions*/
assert(audio_ctx != NULL);
if (audio_verbosity > 2)
printf("AUDIO: set capture buffer size to %i samples\n", size);
audio_ctx->capture_buff_size = size;
}
/*
* start audio stream capture
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: error code
*/
int audio_start(audio_context_t *audio_ctx) {
if (audio_verbosity > 1)
printf("AUDIO: starting audio capture\n");
/*assertions*/
assert(audio_ctx != NULL);
/*alloc the ring buffer*/
audio_init_buffers(audio_ctx);
/*reset timestamp values*/
audio_ctx->current_ts = 0;
audio_ctx->last_ts = 0;
audio_ctx->snd_begintime = 0;
audio_ctx->ts_drift = 0;
int err = 0;
switch (audio_ctx->api) {
case AUDIO_NONE:
break;
#if HAS_PULSEAUDIO
case AUDIO_PULSE:
err = audio_start_pulseaudio(audio_ctx);
break;
#endif
case AUDIO_PORTAUDIO:
default:
err = audio_start_portaudio(audio_ctx);
break;
} // end switch
return err;
}
/*
* stop audio stream capture
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: error code
*/
int audio_stop(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
int err = 0;
switch (audio_ctx->api) {
case AUDIO_NONE:
break;
#if HAS_PULSEAUDIO
case AUDIO_PULSE:
err = audio_stop_pulseaudio(audio_ctx);
break;
#endif
case AUDIO_PORTAUDIO:
default:
err = audio_stop_portaudio(audio_ctx);
break;
} // end switch
/*free the ring buffer (if any)*/
audio_free_buffers();
return err;
}
/*
* close and clean audio context
* args:
* audio_ctx - pointer to audio context data
*
* asserts:
* audio_ctx is not null
*
* returns: none
*/
void audio_close(audio_context_t *audio_ctx) {
/*assertions*/
assert(audio_ctx != NULL);
audio_fx_close();
/* thread must be joined before destroying the mutex
* so no need to unlock before destroying it
*/
/*destroy the mutex*/
__CLOSE_MUTEX(&(audio_ctx->mutex));
switch (audio_ctx->api) {
case AUDIO_NONE:
break;
#if HAS_PULSEAUDIO
case AUDIO_PULSE:
audio_close_pulseaudio(audio_ctx);
break;
#endif
case AUDIO_PORTAUDIO:
default:
audio_close_portaudio(audio_ctx);
break;
} // end switch
if (audio_buffers != NULL)
audio_free_buffers();
}
|