sceAudioSetFrequency -- what can i do to get it to work?
sceAudioSetFrequency -- what can i do to get it to work?
im trying to play a 48000hz file by calling a function which i have in a kernel mode prx. the problem is that it still plays at 44100hz which just makes the music go all slow and deep voice.
Cooleyes already did something like that for PPA. From the latest source code, his prx is:
main.c
makefile
cooleyesAudio.exp
main.c
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <string.h>
#include <pspaudio_kernel.h>
#define VERS 1
#define REVS 0
PSP_MODULE_INFO("cooleyesAudio", 0x1006, VERS, REVS);
PSP_MAIN_THREAD_ATTR(0);
int pspAudioSetFrequency(int frequency) {
return sceAudioSetFrequency(frequency);
}
int module_start(SceSize args, void *argp){
return 0;
}
int module_stop(){
return 0;
}
Code: Select all
TARGET = cooleyesAudio
OBJS = main.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = cooleyesAudio.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
LIBDIR =
LDFLAGS = -mno-crt0 -nostartfiles
LIBS = -lpspkernel -lpspaudio_driver
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(cooleyesAudio, 0, 0x4001)
PSP_EXPORT_FUNC(pspAudioSetFrequency)
PSP_EXPORT_END
PSP_END_EXPORTS
ive been trying that very similar all the time. has sony done something to change it since 3.5 http://silverspring.lan.st/3.5x/kd/audio.html cos this is what prxtool gives me. no 0xA2BEAA6C.
or do i just not no how to use prxtool
Code: Select all
Export 1, Name sceAudio_driver, Functions 27, Variables 0, flags 00010011
Functions:
0x035C14C6 [0x00000578] - sceAudio_driver_035C14C6
0x138A70F1 [0x00002074] - sceAudio_driver_138A70F1
0x1A223275 [0x00002684] - sceAudio_driver_1A223275
0x3D4B75F7 [0x000028F4] - sceAudio_driver_3D4B75F7
0x43645E69 [0x0000210C] - sceAudio_driver_43645E69
0x442588EB [0x00001434] - sceAudio_driver_442588EB
0x47D06FE6 [0x000007F8] - sceAudio_driver_47D06FE6
0x5140D94F [0x000008F4] - sceAudio_driver_5140D94F
0x63BBD850 [0x000027E4] - sceAudio_driver_63BBD850
0x669D93E4 [0x00001E08] - sceAudio_driver_669D93E4
0x7222BC76 [0x00002910] - sceAudio_driver_7222BC76
0x798FB2A3 [0x00000660] - sceAudio_driver_798FB2A3
0x8BCD60A5 [0x000028A8] - sceAudio_driver_8BCD60A5
0xA17F55D7 [0x00000F70] - sceAudio_driver_A17F55D7
0xB282F4B2 [0x00000F20] - sceAudio_driver_B282F4B2
0xBED111E5 [0x000015F4] - sceAudio_driver_BED111E5
0xC2031226 [0x00000E68] - sceAudio_driver_C2031226
0xCC966C3A [0x00002750] - sceAudio_driver_CC966C3A
0xD6620E8E [0x00000C4C] - sceAudio_driver_D6620E8E
0xD81BCF3F [0x00001314] - sceAudio_driver_D81BCF3F
0xDDB4EFE9 [0x00001960] - sceAudio_driver_DDB4EFE9
0xE4A9D621 [0x00000AD8] - sceAudio_driver_E4A9D621
0xE73CE6EE [0x00001110] - sceAudio_driver_E73CE6EE
0xF42AAEFB [0x00002938] - sceAudio_driver_F42AAEFB
0xF9504CA4 [0x0000105C] - sceAudio_driver_F9504CA4
0xFC67A110 [0x000018C4] - sceAudio_driver_FC67A110
0xFC7AA255 [0x0000151C] - sceAudio_driver_FC7AA255
Export 2, Name sceAudio, Functions 27, Variables 0, flags 40010011
Functions:
0x01562BA3 [0x00001354] - sceAudio_01562BA3
0x086E5895 [0x000028A8] - sceAudio_086E5895
0x136CAF51 [0x00000660] - sceAudio_136CAF51
0x13F592BC [0x000008F4] - sceAudio_13F592BC
0x2D53F36E [0x00001374] - sceAudio_2D53F36E
0x38553111 [0x00001E08] - sceAudio_38553111
0x41EFADE7 [0x00000C4C] - sceAudio_41EFADE7
0x43196845 [0x00001390] - sceAudio_43196845
0x5C37C0AE [0x00002074] - sceAudio_5C37C0AE
0x5EC81C55 [0x00000AD8] - sceAudio_5EC81C55
0x63F2889C [0x00001254] - sceAudio_63F2889C
0x647CEF33 [0x000012C4] - sceAudio_647CEF33
0x6D4BEC68 [0x000028F4] - sceAudio_6D4BEC68
0x6FC46853 [0x00000E68] - sceAudio_6FC46853
0x7DE61688 [0x00002750] - sceAudio_7DE61688
0x87B2E651 [0x00002684] - sceAudio_87B2E651
0x8C1009B2 [0x00000578] - sceAudio_8C1009B2
0x95FD0C2D [0x00001110] - sceAudio_95FD0C2D
0xA633048E [0x00002938] - sceAudio_A633048E
0xA708C6A6 [0x00002910] - sceAudio_A708C6A6
0xB011922F [0x00000F20] - sceAudio_B011922F
0xB7E1D8E7 [0x0000105C] - sceAudio_B7E1D8E7
0xCB2E439E [0x00000F70] - sceAudio_CB2E439E
0xE0727056 [0x0000210C] - sceAudio_E0727056
0xE2D56B2D [0x000007F8] - sceAudio_E2D56B2D
0xE926D3FB [0x000027E4] - sceAudio_E926D3FB
0xE9D97901 [0x00001314] - sceAudio_E9D97901
sceAudioSetFrequency is still in fw360, but change in fw371
so , the new code in ppa is this :
sceAudio_driver371.S
main.c
makefile
cooleyesAudio.exp
cooleyesAudio.h
so , the new code in ppa is this :
sceAudio_driver371.S
Code: Select all
.set noreorder
#include "pspimport.s"
IMPORT_START "sceAudio_driver",0x00010000
IMPORT_FUNC "sceAudio_driver",0x442588EB,sceAudioSetFrequency371
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <string.h>
#include <pspaudio_kernel.h>
#define VERS 1
#define REVS 0
PSP_MODULE_INFO("cooleyesAudio", 0x1006, VERS, REVS);
PSP_MAIN_THREAD_ATTR(0);
int sceAudioSetFrequency371(int frequency);
int pspAudioSetFrequency(int devkitVersion, int frequency) {
if (devkitVersion < 0x03070110)
return sceAudioSetFrequency(frequency);
else
return sceAudioSetFrequency371(frequency);
}
int module_start(SceSize args, void *argp){
return 0;
}
int module_stop(){
return 0;
}
Code: Select all
TARGET = cooleyesAudio
OBJS = main.o sceAudio_driver371.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = cooleyesAudio.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
PSP_FW_VERSION = 371
LIBDIR =
LDFLAGS = -mno-crt0 -nostartfiles
LIBS = -lpspkernel -lpspaudio_driver
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(cooleyesAudio, 0, 0x4001)
PSP_EXPORT_FUNC(pspAudioSetFrequency)
PSP_EXPORT_END
PSP_END_EXPORTS
Code: Select all
#ifdef __cplusplus
extern "C" {
#endif
/**
* Set audio sampling frequency
*
* @param frequency - Sampling frequency to set audio output to - either 44100 or 48000.
*
* @returns 0 on success, an error if less than 0.
*/
int pspAudioSetFrequency(int devkitVersion, int frequency);
/*@}*/
#ifdef __cplusplus
}
#endif
hehe, I don't know. :PJ.F. wrote:Good info, cooleyes. I wonder how many other things Sony changed like that as well.cooleyes wrote:sceAudioSetFrequency is still in fw360, but change in fw371
this is a README in SDK for 3.71 M33SDK for 3.71 M33
Some changes have been added in this sdk: sctrlHENSetOnApplyPspRelSectionEven has been replaced
by sctrlHENSetStartModuleHandler.
Sony has changed a lot of kernel nids: ctrl, power, syscon, sysreg, clockgen, umd modules, etc
If your prx doesn't load, dump your nids using prxtool, and compare them to the ones of 3.71.
Sony has also deleted the power speed functions from kernel usage. You can use the new function
sctrlHENSetSpeed to fix this issue.
Included is a sample that uses the 32 MB of extra ram of the psp slim.
I try to use old sceAudioSetFrequency nid to call , but do not work.
so I disasm audio.prx(3.71) by use svn prxtool.exe,
and compare with audio.prx(1.50) , and find out the new nid
have you tested this. im trying to use it in a kernel mode prx which im starting kukernelloadmodule but it is still treating the stream as 44100. i had a thorough look at all my code and couldn't see any errors but i will look more when i get some time. do you have an example that plays 48000 on 3.71?
you must call sceAudioSetFrequency before sceAudioChReserveViper8896 wrote:have you tested this. im trying to use it in a kernel mode prx which im starting kukernelloadmodule but it is still treating the stream as 44100. i had a thorough look at all my code and couldn't see any errors but i will look more when i get some time. do you have an example that plays 48000 on 3.71?
i forgot to actually start the module first time i was just loading it. now that ive done that it still doesn't work. i was originally calling it before the channel reserve anyway but i tried it after to see if that would make a difference.
edit:
ive just noticed that when i return to the xmb it is all slow and deep which stays in effect until i restart the psp.
edit:
ive just noticed that when i return to the xmb it is all slow and deep which stays in effect until i restart the psp.
ok , I got it
we must call "pspSdkSetK1(0)" first;
main.c
we must call "pspSdkSetK1(0)" first;
main.c
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <string.h>
#include <pspaudio_kernel.h>
#define VERS 1
#define REVS 0
PSP_MODULE_INFO("cooleyesAudio", 0x1006, VERS, REVS);
PSP_MAIN_THREAD_ATTR(0);
int sceAudioSetFrequency371(int frequency);
int pspAudioSetFrequency(int devkitVersion, int frequency) {
u32 k1;
k1 = pspSdkSetK1(0);
int ret;
if (devkitVersion < 0x03070110)
ret = sceAudioSetFrequency(frequency);
else
ret = sceAudioSetFrequency371(frequency);
pspSdkSetK1(k1);
return ret;
}
int module_start(SceSize args, void *argp){
return 0;
}
int module_stop(){
return 0;
}
-
- Posts: 31
- Joined: Wed May 16, 2007 11:08 am
Only the output frequency can be changed? I need to sample at 8000 Hz, and was thinking 48000 Hz would be great :)
How can I get it to work? I´m afraid i´m a noob programming for psp. Want some file .c to include in my main.c and then, at the beginning of the program change the frequency with sceAudioSetFrequency(48000). Is this possible?
Thanks ;)
How can I get it to work? I´m afraid i´m a noob programming for psp. Want some file .c to include in my main.c and then, at the beginning of the program change the frequency with sceAudioSetFrequency(48000). Is this possible?
Thanks ;)