ATRAC3 Player Sample
Very interesting !!
Do you think, it can be easy to use in the future ? For example, simple functions in the pspsdk like at3_init(), at3_play(char * music), at3_stop() ?
I've tried your sample n°2, it works like a charm :)
Just a little bug, when i browse to the music it has detected, some music are shown in 2 lines, and the selection with up and down, doesn't work properly.
Do you have an idea whether this lib can be less CPU demanding than libmad, or perhaps, whether it uses the ME ?
Is at3 format legal ?
Do you think, it can be easy to use in the future ? For example, simple functions in the pspsdk like at3_init(), at3_play(char * music), at3_stop() ?
I've tried your sample n°2, it works like a charm :)
Just a little bug, when i browse to the music it has detected, some music are shown in 2 lines, and the selection with up and down, doesn't work properly.
Do you have an idea whether this lib can be less CPU demanding than libmad, or perhaps, whether it uses the ME ?
Is at3 format legal ?
it does indeed use 0% zero load on main cpu/allegrex
...why?..because libatrac3 uses the ME to handle the
load so this is by far the best remedy for those looking
for background music to add to their games ...and it
works a treat :)
as for creating your own library of at3_play() etc...
that shouldnt be a problem for you at all ...i mean
i wonder what this does
;)
...why?..because libatrac3 uses the ME to handle the
load so this is by far the best remedy for those looking
for background music to add to their games ...and it
works a treat :)
as for creating your own library of at3_play() etc...
that shouldnt be a problem for you at all ...i mean
i wonder what this does
Code: Select all
void playAT3File(char *file)
10011011 00101010 11010111 10001001 10111010
I'm not sure whether i understand your answer.
My question was about the the possibility to write a library like libmad, using the libatrac3 stuff, integrated to the pspsdk.
When i look at the moonlight's sample 2, I see that it generates a prx module, which is not easy to implement in another project.
From what i understood, this library would consist on :
(i simplify the functions, I just want to understand whether this could work or not)
My question was about the the possibility to write a library like libmad, using the libatrac3 stuff, integrated to the pspsdk.
When i look at the moonlight's sample 2, I see that it generates a prx module, which is not easy to implement in another project.
From what i understood, this library would consist on :
(i simplify the functions, I just want to understand whether this could work or not)
Code: Select all
- int Init_AT3() :
// load necessary modules
pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/libatrac3plus.prx", PSP_MEMORY_PARTITION_USER);
return 1;
- int playAT3File(char *file) :
// generate a thread, and return his id
int playth = sceKernelCreateThread("play_thread", play_thread, 0x12, 0x10000, PSP_THREAD_ATTR_USER, NULL);
if (playth >= 0) sceKernelStartThread(playth, strlen(file)+1, file);
return playth;
- int stopAT3File(int id) :
sceKernelDeleteThread(id);
read the source people!
you can easily integrate this into your
own homebrew! ...its all there and there is
already pspatrac3.h in pspsdk !
pspwill: umd videos do use this format for audio
but the video container still needs to be parsed
and so that is not a possibility right now ...but when
more about pmf is learned no problem ;)
you can easily integrate this into your
own homebrew! ...its all there and there is
already pspatrac3.h in pspsdk !
pspwill: umd videos do use this format for audio
but the video container still needs to be parsed
and so that is not a possibility right now ...but when
more about pmf is learned no problem ;)
10011011 00101010 11010111 10001001 10111010
i did some mods to this:
-Added support to write at3 decoded data
to uncompressed wav
-Added selection between play only and
saving decoded data to wav
-Added a playlist mode
-extended buffer to 12mb
http://weltall.consoleworld.org/PSP/AT3PLAYERMOD02.rar
-Added support to write at3 decoded data
to uncompressed wav
-Added selection between play only and
saving decoded data to wav
-Added a playlist mode
-extended buffer to 12mb
http://weltall.consoleworld.org/PSP/AT3PLAYERMOD02.rar
Some more functions:
I hope someone with access to the svn adds them to pspatrac3.h
Rewritten the sample with the use of sceAtracGetMaxSample to find the appropiated channel size.
This ugly code:
replaced with a simple line :)
http://www.megaupload.com/?d=87UL06DC
Next thing is try to find the way of at least playing the sound from pmf files.
Code: Select all
/**
* Gets the number of samples of the next frame to be decoded.
*
* @param atracID - the atrac ID
* @param outN - pointer to receives the number of samples of the next frame.
*
* @returns < 0 on error, otherwise 0
*
*/
int sceAtracGetNextSample(int atracID, int *outN);
/**
* Gets the maximum number of samples of the atrac3 stream.
*
* @param atracID - the atrac ID
* @param outMax - pointer to a integer that receives the maximum number of samples.
*
* @returns < 0 on error, otherwise 0
*
*/
int sceAtracGetMaxSample(int atracID, int *outMax);
Rewritten the sample with the use of sceAtracGetMaxSample to find the appropiated channel size.
This ugly code:
Code: Select all
// VERY UGLY way to find an appropiated channel size
t1024 = 0;
t2048 = 0;
for (i = 0; i < 20; i++)
{
int nsamples, end, rem;
sceAtracDecodeData(atracID, blocks[0], &nsamples, &end, &rem);
if (nsamples == 1024) t1024++;
else if (nsamples == 2048) t2048++;
}
sceAtracReleaseAtracID(atracID);
atracID = sceAtracSetDataAndGetID(file_buffer, fsize);
if (atracID < 0)
{
debugMessage("Unknown error.\n");
return -1;
}
if (t1024 > t2048)
chsize = 1024;
else
chsize = 2048;
Code: Select all
sceAtracGetMaxSample(atracID, &chsize);
Next thing is try to find the way of at least playing the sound from pmf files.
Last edited by moonlight on Mon May 01, 2006 8:08 pm, edited 1 time in total.
:)
buggy bug report:
when playing a atrac3 file from video umd
located at this location disc0:/UMD_VIDEO/SND0.AT3
it will playback once then again when user selects to
playback only once then it will stop after playback 2x
thought youd like to know
nice big improvement in source :)
buggy bug report:
when playing a atrac3 file from video umd
located at this location disc0:/UMD_VIDEO/SND0.AT3
it will playback once then again when user selects to
playback only once then it will stop after playback 2x
thought youd like to know
nice big improvement in source :)
Last edited by dot_blank on Mon May 01, 2006 6:51 pm, edited 2 times in total.
10011011 00101010 11010111 10001001 10111010
I've read the source, and my question shows it.dot_blank wrote:read the source people!
you can easily integrate this into your
own homebrew! ...its all there and there is
already pspatrac3.h in pspsdk !
This forum is about "Homebrew PS2 & PSP Development Discussions", so I suppose that I can ask questions, hoping that someone could answer and help. If it is easy for you, why not sharing your knowledge ? Isn't the aim of this forum ?
after this sceAtracGetMaxSample(atracID, &chsize);
you can find sceAtracSetLoopNum(atracID, 1);
replace with sceAtracSetLoopNum(atracID, 0);
and it replay only one time
thanks to dot_blank
you can find sceAtracSetLoopNum(atracID, 1);
replace with sceAtracSetLoopNum(atracID, 0);
and it replay only one time
thanks to dot_blank
Last edited by weltall on Tue May 02, 2006 5:45 am, edited 2 times in total.
thanks :) updated the link with that fix and using the new definitions in the pspatrac3.h header.weltall wrote:after this sceAtracGetMaxSample(atracID, &chsize);
you can find sceAtracSetLoopNum(atracID, 1);
replace with sceAtracSetLoopNum(atracID, 0);
and it replay only one time
thanks to dot_black
Thanks dot_blank to be more comprehensive. I really appreciate this.
My question was about the possibility to make a library like libmad, which handles all needed for reading atrac3.
The goal is to be able to link any homebrew to this library and use simple functions like libmad offers.
I proposed a prototype some posts ago, and just wanted to know whether it could work.
Thanks for your help.
My question was about the possibility to make a library like libmad, which handles all needed for reading atrac3.
The goal is to be able to link any homebrew to this library and use simple functions like libmad offers.
I proposed a prototype some posts ago, and just wanted to know whether it could work.
Code: Select all
- int Init_AT3() :
// load necessary modules
pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/libatrac3plus.prx", PSP_MEMORY_PARTITION_USER);
return 1;
- int playAT3File(char *file) :
// generate a thread, and return his id
int playth = sceKernelCreateThread("play_thread", play_thread, 0x12, 0x10000, PSP_THREAD_ATTR_USER, NULL);
if (playth >= 0) sceKernelStartThread(playth, strlen(file)+1, file);
return playth;
- int stopAT3File(int id) :
sceKernelDeleteThread(id);
main.c of PRX of atrac3 sample has all the
functions that you should need and creating
your own library is a real snap just create your
own lib with functions in source .c files and the
proper prototypes in a similar named header file
then of course include that header file in your source
.c file and then then include header file in your app
...all functions are there all you have to do is extract
them and alter to your liking ....do not extract the
obvious thread stuff like play_thread as that
should be user specific for whichever app you
are working on
...play around with it and youll see creating your own
library is a snap ...if you dont get it by a weeks end
then maybe someone will provide a easy ready made
library ;)
functions that you should need and creating
your own library is a real snap just create your
own lib with functions in source .c files and the
proper prototypes in a similar named header file
then of course include that header file in your source
.c file and then then include header file in your app
...all functions are there all you have to do is extract
them and alter to your liking ....do not extract the
obvious thread stuff like play_thread as that
should be user specific for whichever app you
are working on
...play around with it and youll see creating your own
library is a snap ...if you dont get it by a weeks end
then maybe someone will provide a easy ready made
library ;)
10011011 00101010 11010111 10001001 10111010
It has to be possible. The game that i reversed didn't load the whole file, but only a part, and then add more data to the buffer, i have to do some more reverse on that, there are a lot more of functions in libatrac3plus.__count wrote:That's awesome :)moonlight wrote:About the perfomance... I've set the processor to only 12/6 Mhz and it's playing fine :)) The search of files is slower, but the play is really good :)
Do you think it would be difficult to stream at3's (instead of loading the whole thing in a static buffer)?
Hi,
I had a question: Is atrac3 usable for sound effects? i mean doing mp3 for this is not usable due to the late play response, wav however almost executes directly so that would be good (if there were libraries existing...) so is atrac3 faster then mp3?
greets Ghoti
I had a question: Is atrac3 usable for sound effects? i mean doing mp3 for this is not usable due to the late play response, wav however almost executes directly so that would be good (if there were libraries existing...) so is atrac3 faster then mp3?
greets Ghoti
My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
moonlight: Any luck with figuring out atrac3 streaming? I'm adding music/sound support to my 3d world ( www.antimass.org/zilt ) based on your atrac3sample3.zip and the streaming would help free up memory. Thanks,
Zilt
Zilt
"We are dreamers, shapers, singers, and makers. We study the mysteries of laser and circuit, crystal and scanner, holographic demons and invocations of equations. These are the tools we employ and we know... many things." -- Elric, B5
Nevermind about the streaming - I've worked around it by adding a separate thread that keeps a double buffer filled ( reduced the internal buffer down to 512k for dual atrac3 streams). I've also found that I can blend 2 concurrent atrac3 samples ( on separate channels ) with almost no drop in 3d framerate.
When I try starting a third atrac stream, I get 0x80630003 from sceAtracSetDataAndGetID() which I'm assuming means no more atrac streams left or something.
I also changed the dual producer/consumer thread pattern into a single thread ( though each atrac stream is it's own thread ). Thanks very much again for the atrac3 sample. I'll be releasing all my client code ( and keeping it in a svn repos ) after the next release.
When I try starting a third atrac stream, I get 0x80630003 from sceAtracSetDataAndGetID() which I'm assuming means no more atrac streams left or something.
I also changed the dual producer/consumer thread pattern into a single thread ( though each atrac stream is it's own thread ). Thanks very much again for the atrac3 sample. I'll be releasing all my client code ( and keeping it in a svn repos ) after the next release.
"We are dreamers, shapers, singers, and makers. We study the mysteries of laser and circuit, crystal and scanner, holographic demons and invocations of equations. These are the tools we employ and we know... many things." -- Elric, B5
Sorry, I forgot totally to continue researching the atrac3 library since i was busy with other things.
The last thing i remember was looking to a couple of functions, sceAtracAddStreamData and other that i don't remember now.
I remember also that the addstreamdata was not what i expected. I expected a pointer in its parameters, but all of them were integer.
I hope this can help someone wanting to finish the job.
The last thing i remember was looking to a couple of functions, sceAtracAddStreamData and other that i don't remember now.
I remember also that the addstreamdata was not what i expected. I expected a pointer in its parameters, but all of them were integer.
I hope this can help someone wanting to finish the job.
I have a somewhat stupid question.
Can this...
pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/libatrac3plus.prx", PSP_MEMORY_PARTITION_USER);
be executed in an app that is in user mode or must I launch it the same way the demo does?
For some reason my code crashes around thies lines and my app is just in user mode.
Can this...
pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL);
pspSdkLoadStartModule("flash0:/kd/libatrac3plus.prx", PSP_MEMORY_PARTITION_USER);
be executed in an app that is in user mode or must I launch it the same way the demo does?
For some reason my code crashes around thies lines and my app is just in user mode.