mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-03 16:51:27 +00:00
vaudio: lib
This commit is contained in:
@@ -118,6 +118,7 @@ AC_CONFIG_FILES([Makefile
|
||||
src/usbstor/Makefile
|
||||
src/user/Makefile
|
||||
src/utility/Makefile
|
||||
src/vaudio/Makefile
|
||||
src/vfpu/Makefile
|
||||
src/video/Makefile
|
||||
src/vsh/Makefile
|
||||
|
@@ -31,6 +31,7 @@ SUBDIRS = \
|
||||
usb \
|
||||
usbstor \
|
||||
user \
|
||||
vaudio \
|
||||
utility \
|
||||
vfpu \
|
||||
video \
|
||||
|
24
src/vaudio/Makefile.am
Normal file
24
src/vaudio/Makefile.am
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
libdir = @PSPSDK_LIBDIR@
|
||||
|
||||
CC = @PSP_CC@
|
||||
CCAS = $(CC)
|
||||
AR = @PSP_AR@
|
||||
RANLIB = @PSP_RANLIB@
|
||||
|
||||
CPPFLAGS = -I$(top_srcdir)/src/base -I$(top_srcdir)/src/user -I$(top_srcdir)/src/debug
|
||||
CFLAGS = @PSPSDK_CFLAGS@
|
||||
CCASFLAGS = $(CFLAGS)
|
||||
|
||||
VAUDIO_OBJS = sceVaudio_0000.o sceVaudio_0001.o sceVaudio_0002.o sceVaudio_0003.o sceVaudio_0004.o sceVaudio_0005.o sceVaudio_0006.o sceVaudio_0007.o sceVaudio_0008.o
|
||||
|
||||
libpspvaudioincludedir = @PSPSDK_INCLUDEDIR@
|
||||
libpspvaudioinclude_HEADERS = pspvaudio.h
|
||||
|
||||
lib_LIBRARIES = libpspvaudio.a
|
||||
|
||||
libpspvaudio_a_SOURCES = sceVaudio.S
|
||||
libpspvaudio_a_LIBADD = $(VAUDIO_OBJS)
|
||||
|
||||
$(VAUDIO_OBJS): sceVaudio.S
|
||||
$(AM_V_CPPAS)$(CPPASCOMPILE) -DF_$* $< -c -o $@
|
101
src/vaudio/pspvaudio.h
Normal file
101
src/vaudio/pspvaudio.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* PSP Software Development Kit - https://github.com/pspdev
|
||||
* -----------------------------------------------------------------------
|
||||
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||
*
|
||||
* pspvaudio.h - Prototypes for the sceVaudio library.
|
||||
*
|
||||
* Copyright (c) 2024 Sergey Galushko
|
||||
*
|
||||
*/
|
||||
#ifndef PSPVAUDIO_H
|
||||
#define PSPVAUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** The maximum output volume. */
|
||||
#define PSP_VAUDIO_VOLUME_MAX 0x8000
|
||||
|
||||
/** The maximum number of samples that can be allocated to a channel. */
|
||||
|
||||
#define PSP_VAUDIO_SAMPLE_MAX 2048
|
||||
|
||||
/** The minimum number of samples that can be allocated to a channel. */
|
||||
#define PSP_VAUDIO_SAMPLE_MIN 256
|
||||
|
||||
|
||||
/** Channel is set to mono output. */
|
||||
#define PSP_VAUDIO_FORMAT_MONO 1
|
||||
|
||||
/** Channel is set to stereo output. */
|
||||
#define PSP_VAUDIO_FORMAT_STEREO 2
|
||||
|
||||
/** Effect type */
|
||||
#define PSP_VAUDIO_EFFECT_OFF 0
|
||||
#define PSP_VAUDIO_EFFECT_HEAVY 1
|
||||
#define PSP_VAUDIO_EFFECT_POPS 2
|
||||
#define PSP_VAUDIO_EFFECT_JAZZ 3
|
||||
#define PSP_VAUDIO_EFFECT_UNIQUE 4
|
||||
#define PSP_VAUDIO_EFFECT_MAX 5
|
||||
|
||||
/** Alc mode */
|
||||
#define PSP_VAUDIO_ALC_OFF 0
|
||||
#define PSP_VAUDIO_ALC_MODE1 1
|
||||
#define PSP_VAUDIO_ALC_MODE_MAX 2
|
||||
|
||||
/**
|
||||
* Output audio (blocking)
|
||||
*
|
||||
* @param volume - It must be a value between 0 and ::PSP_VAUDIO_VOLUME_MAX
|
||||
* @param buffer - Pointer to the PCM data to output.
|
||||
*
|
||||
* @return 0 on success, an error if less than 0.
|
||||
*/
|
||||
int sceVaudioOutputBlocking(int volume, void *buffer);
|
||||
|
||||
/**
|
||||
* Allocate and initialize a virtual output channel.
|
||||
*
|
||||
* @param samplecount - The number of samples that can be output on the channel per
|
||||
* output call. One of 256, 576, 1024, 1152, 2048.
|
||||
* It must be a value between ::PSP_VAUDIO_SAMPLE_MIN and ::PSP_VAUDIO_SAMPLE_MAX.
|
||||
* @param frequency - The frequency. One of 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11050, 8000.
|
||||
* @param format - The output format to use for the channel. One of ::PSP_VAUDIO_FORMAT_
|
||||
*
|
||||
* @return 0 if success, < 0 on error.
|
||||
*/
|
||||
int sceVaudioChReserve(int samplecount, int frequency, int format);
|
||||
|
||||
/**
|
||||
* Release a virtual output channel.
|
||||
*
|
||||
* @return 0 if success, < 0 on error.
|
||||
*/
|
||||
int sceVaudioChRelease(void);
|
||||
|
||||
/**
|
||||
* Set effect type
|
||||
*
|
||||
* @param effect - The effect type. One of ::PSP_VAUDIO_EFFECT_
|
||||
* @param volume - The volume. It must be a value between 0 and ::PSP_VAUDIO_VOLUME_MAX
|
||||
*
|
||||
* @return The volume value on success, < 0 on error.
|
||||
*/
|
||||
int sceVaudioSetEffectType(int effect, int volume);
|
||||
|
||||
/**
|
||||
* Set ALC(dynamic normalizer)
|
||||
*
|
||||
* @param mode - The mode. One of ::PSP_VAUDIO_ALC_
|
||||
*
|
||||
* @return 0 if success, < 0 on error.
|
||||
*/
|
||||
int sceVaudioSetAlcMode(int mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PSPVAUDIO_H */
|
31
src/vaudio/sceVaudio.S
Normal file
31
src/vaudio/sceVaudio.S
Normal file
@@ -0,0 +1,31 @@
|
||||
.set noreorder
|
||||
|
||||
#include "pspimport.s"
|
||||
|
||||
#ifdef F_sceVaudio_0000
|
||||
IMPORT_START "sceVaudio",0x40090000
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0001
|
||||
IMPORT_FUNC "sceVaudio",0x8986295E,sceVaudioOutputBlocking
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0002
|
||||
IMPORT_FUNC "sceVaudio",0x03B6807D,sceVaudioChReserve
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0003
|
||||
IMPORT_FUNC "sceVaudio",0x67585DFD,sceVaudioChRelease
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0004
|
||||
IMPORT_FUNC "sceVaudio",0x346fbe94,sceVaudioSetEffectType
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0005
|
||||
IMPORT_FUNC "sceVaudio",0xcbd4ac51,sceVaudioSetAlcMode
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0006
|
||||
IMPORT_FUNC "sceVaudio",0x504E4745,sceVaudio_504E4745
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0007
|
||||
IMPORT_FUNC "sceVaudio",0x27ACC20B,sceVaudioChReserveBuffering
|
||||
#endif
|
||||
#ifdef F_sceVaudio_0008
|
||||
IMPORT_FUNC "sceVaudio",0xE8E78DC8,sceVaudio_E8E78DC8
|
||||
#endif
|
Reference in New Issue
Block a user