mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 03:40:30 +00:00
Portaudio: print device host API used
This commit is contained in:
@@ -2345,8 +2345,8 @@ fi
|
||||
|
||||
if test $portaudio = yes
|
||||
then
|
||||
PORTAUDIO_CAP_OBJ="src/audio/capture/portaudio.o"
|
||||
PORTAUDIO_PLAY_OBJ="src/audio/playback/portaudio.o"
|
||||
PORTAUDIO_CAP_OBJ="src/audio/portaudio_common.o src/audio/capture/portaudio.o"
|
||||
PORTAUDIO_PLAY_OBJ="src/audio/portaudio_common.o src/audio/playback/portaudio.o"
|
||||
AC_DEFINE([HAVE_PORTAUDIO], [1], [Build with Portaudio support])
|
||||
ADD_MODULE("acap_portaudio", "$PORTAUDIO_CAP_OBJ", "$PORTAUDIO_LIB")
|
||||
ADD_MODULE("aplay_portaudio", "$PORTAUDIO_PLAY_OBJ", "$PORTAUDIO_LIB")
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
#include "audio/audio.h"
|
||||
#include "audio/audio_capture.h"
|
||||
#include "portaudio.h"
|
||||
#include "audio/portaudio_common.h"
|
||||
#include "debug.h"
|
||||
#include "host.h"
|
||||
#include "lib_common.h"
|
||||
@@ -128,7 +128,7 @@ static void print_device_info(PaDeviceIndex device)
|
||||
}
|
||||
|
||||
const PaDeviceInfo *device_info = Pa_GetDeviceInfo(device);
|
||||
printf(" %s (output channels: %d; input channels: %d)", device_info->name, device_info->maxOutputChannels, device_info->maxInputChannels);
|
||||
printf(" %s (output channels: %d; input channels: %d; %s)", device_info->name, device_info->maxOutputChannels, device_info->maxInputChannels, portaudio_get_api_name(device));
|
||||
}
|
||||
|
||||
static void audio_cap_portaudio_probe(struct device_info **available_devices, int *count)
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
|
||||
#include "audio/audio.h"
|
||||
#include "audio/audio_playback.h"
|
||||
#include "audio/portaudio_common.h"
|
||||
#include "debug.h"
|
||||
#include "lib_common.h"
|
||||
#include "utils/audio_buffer.h"
|
||||
@@ -128,7 +129,6 @@ static bool portaudio_start_stream(PaStream *stream)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void print_device_info(PaDeviceIndex device)
|
||||
{
|
||||
if( (device < 0) || (device >= Pa_GetDeviceCount()) )
|
||||
@@ -138,7 +138,7 @@ static void print_device_info(PaDeviceIndex device)
|
||||
}
|
||||
|
||||
const PaDeviceInfo *device_info = Pa_GetDeviceInfo(device);
|
||||
printf(" %s (output channels: %d; input channels: %d)", device_info->name, device_info->maxOutputChannels, device_info->maxInputChannels);
|
||||
printf(" %s (output channels: %d; input channels: %d; %s)", device_info->name, device_info->maxOutputChannels, device_info->maxInputChannels, portaudio_get_api_name(device));
|
||||
}
|
||||
|
||||
static void audio_play_portaudio_probe(struct device_info **available_devices, int *count)
|
||||
|
||||
60
src/audio/portaudio_common.c
Normal file
60
src/audio/portaudio_common.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @file audio/portaudio_common.c
|
||||
* @author Martin Pulec <pulec@cesnet.cz>
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2018 CESNET, z. s. p. o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, is permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of CESNET nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#include <portaudio.h>
|
||||
|
||||
#include "portaudio_common.h"
|
||||
|
||||
const char *portaudio_get_api_name(PaDeviceIndex device) {
|
||||
for (int i = 0; i < Pa_GetHostApiCount(); ++i) {
|
||||
const PaHostApiInfo *info = Pa_GetHostApiInfo(i);
|
||||
for (int j = 0; j < info->deviceCount; ++j) {
|
||||
if (device == Pa_HostApiDeviceIndexToDeviceIndex(i, j)) {
|
||||
return info->name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "(unknown API)";
|
||||
}
|
||||
|
||||
52
src/audio/portaudio_common.h
Normal file
52
src/audio/portaudio_common.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @file audio/portaudio_common.h
|
||||
* @author Martin Pulec <pulec@cesnet.cz>
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2018 CESNET, z. s. p. o.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, is permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of CESNET nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
|
||||
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef UTILS_PORTAUDIO_H_
|
||||
#define UTILS_PORTAUDIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const char *portaudio_get_api_name(PaDeviceIndex device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // defined UTILS_PORTAUDIO_H_
|
||||
|
||||
Reference in New Issue
Block a user