xemu/hw/xbox/xblc.h
specialfred453@gmail.com e8b4e8463d Reduced the precision when drawing the Volume value on the UI
Changed naming of "average volume" to "peak volume" to more accurately describe what is being done/represented
Removed the divide by 2 in calc_peak_volume so that the second half of the samples would also be factored when calculating the peak volume in the most recent sample data
Changed references to 128 to use the SDL_MIX_MAXVOLUME preprocessor definition for clarity
Changed the line that caches the peak volume in input_callback to use sizeof(int16_t) instead of 2 for clarity
Changed input_callback to use a local buffer of size XBLC_FIFO_SIZE instead of allocating one at runtime
Changed the get/set volume functions in xblc.h and xblc.c to use floating point values on the interval [0, 1] instead of integers on the range [0, SDL_MIX_MAXVOLUME] because they're used that way everywhere else anyway
Changed the numOutputDevices variable in DrawAudioDeviceSelectComboBox function to num_devices to match the naming scheme and because this function doesn't only work with output devices.
Changed xemu_input_bind to use an if statement instead of a switch. The switch was left behind from before I added the xemu_input_unbind_peripheral function when I was calling xemu_input_unbind_xmu and xemu_input_unbind_xblc directly
2025-01-26 14:47:11 -05:00

42 lines
No EOL
1.4 KiB
C

/*
* QEMU USB Xbox Live Communicator (XBLC) Device
*
* Copyright (c) 2025 faha223
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HW_XBOX_XBLC_H
#define HW_XBOX_XBLC_H
#ifdef __cplusplus
extern "C" {
#endif
void xblc_audio_stream_reinit(void *dev);
/* Outputs a value on the interval [0, 1] where 0 is muted and 1 is full volume */
float xblc_audio_stream_get_output_volume(void *dev);
float xblc_audio_stream_get_input_volume(void *dev);
/* Accepts a value on the interval [0, 1] where 0 is muted and 1 is full volume */
void xblc_audio_stream_set_output_volume(void *dev, float volume);
void xblc_audio_stream_set_input_volume(void *dev, float volume);
float xblc_audio_stream_get_current_input_volume(void *dev);
#ifdef __cplusplus
}
#endif
#endif