Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new atrac3plus decoder #1979

Merged
merged 1 commit into from
May 30, 2013
Merged

Conversation

oioitff
Copy link
Contributor

@oioitff oioitff commented May 30, 2013

Here is my way to support the new atrac3plus decoder.

If you want to support a platform, just build a lib with following export functions:

extern "C" void* Atrac3plusDecoder_openContext()
{
    return new MaiAT3PlusFrameDecoder;
}

extern "C" int Atrac3plusDecoder_closeContext(void* context)
{
    MaiAT3PlusFrameDecoder *frame_decoder =(MaiAT3PlusFrameDecoder*)context;
    if (frame_decoder)
        delete frame_decoder;
    return 0;
}

extern "C" int Atrac3plusDecoder_decodeFrame(void* context, void* inbuf, int inbytes, int* channels, void** outbuf)
{
    MaiAT3PlusFrameDecoder *frame_decoder = (MaiAT3PlusFrameDecoder*)context;
    return frame_decoder->decodeFrame((Mai_I8*)inbuf, inbytes, channels, (Mai_I16**)outbuf);
}

And then, implement the interface in Core\HW\atrac3plus.cpp.
For static link with the lib, it's really easy. Just import the lib and call those functions.
For dynamic link with the lib, you can follow my win32 example in Core\HW\atrac3plus.cpp.

Here is a dynamic lib I build for win32: https://docs.google.com/file/d/0B1ftGc2t9-dZQ2daRTkwM3NQREE/edit?usp=sharing
Just put it in PPSSPP folder, it will start to work :)

@hrydgard
Copy link
Owner

This is a good way to do it, that leaves it up to the user to decide whether the decoder is okay to use or not.

Feel free to also send a pull request that deletes all the DShow stuff as I don't think anyone will want to use that method anymore.

hrydgard added a commit that referenced this pull request May 30, 2013
Add support for new atrac3plus decoder
@hrydgard hrydgard merged commit c5976fb into hrydgard:master May 30, 2013
@Ritori
Copy link

Ritori commented May 30, 2013

After use this we don't need used filter right?? is this work well?

@oioitff
Copy link
Contributor Author

oioitff commented May 30, 2013

Yeah, we don't need the dshow filter anymore. This one should work much better than dshow filter :)

And it will also support other platforms such as Android and Mac once someone has build a lib and implement the interface for it :)

@raven02
Copy link
Contributor

raven02 commented May 30, 2013

Just tested it out using the dll one .All atrac3+ including mono and stereo working prefectly without lag/crash. ...

@raven02
Copy link
Contributor

raven02 commented May 30, 2013

Wondering how it can provide support for android/iOS platform

@oioitff
Copy link
Contributor Author

oioitff commented May 30, 2013

Great! Then we could prepare to build a lib for android and mac :)
Oh, I forgot it. There is a tiny bug in MAPCDSF_Func4b32b0 of MaiAT3PlusCoreDecoder_SubFunc.cpp.
We need to change:

Mai_Status rs;

to

Mai_Status rs = 0;

@raven02 Just build a lib as I said, and then implement the interface in Core\HW\atrac3plus.cpp :)

@raven02
Copy link
Contributor

raven02 commented May 30, 2013

Some interesting bug that shared between this Mai decoder and the previous dshow filter which is delay sound in some games like Last Ranker , Sol Trigger

@oioitff
Copy link
Contributor Author

oioitff commented May 30, 2013

Yeah, I think those should be some bugs caused by some HLE issues such as sync issue .

@raven02
Copy link
Contributor

raven02 commented May 30, 2013

However it didn't appear in your first version that is the one without dshow filter

@Squall-Leonhart
Copy link

its probably the threading

@oioitff
Copy link
Contributor Author

oioitff commented May 30, 2013

Yeah, in those version, they are just "playing on the top". They are not under controlled, because they even doesn't decode samples, they just try to play it with a external player directly :) So we can't feel any HLE issues about that.

@hrydgard
Copy link
Owner

I changed it now so it's loading "at3plusdecoder.dll" instead, so if you want to use this mai dll, you have to rename it to that.

@raven02
Copy link
Contributor

raven02 commented May 30, 2013

I see . Thanks for explanation @oioitff

@Ritori
Copy link

Ritori commented May 30, 2013

it dont work on god eater burst dont has bgm on this v0.7.6-915-g169ca97 maybe i will try latest one maybe it because i used window 64 bit?
or should i uninstall sonic stage?

@oioitff
Copy link
Contributor Author

oioitff commented May 30, 2013

@Ritori Have you renamed the dll to "at3plusdecoder.dll" and then put it in the PPSSPP folder?

@Squall-Leonhart
Copy link

the available DLL is 32bit only, I'm currently trying to set up a MSVS vcproj to create a 64bit version

@Ritori
Copy link

Ritori commented May 30, 2013

I see maybe that fix on latest one sorry then :)
Okay it work when i rename that to at3plusdecoder.dll

@hrydgard
Copy link
Owner

Somebody made a build setup for Visual Studio: https://github.com/emulibraries/maiatrac3plus

@Ritori
Copy link

Ritori commented May 30, 2013

Is that okay?
is this file download separate? liked i need to download this tool first then put it on v0.7.6-916-g820fd52 ? and rename it??

@majesticR3
Copy link

LCS crashing with this library when game trying to load radio (but cutscenes is okay). VCS works okay, but radio starts to play with delay.
Sorry for bad English

@daniel229
Copy link
Collaborator

tested several,bgm and voice works great.and a little bug exist in same game.
speech is a little fast super robot taisen wars Z 2 hakai hen,and cut off the last word sometime.
fate extra ccc crashes after battle with MaiAT3PlusDecoder.dll,without MaiAT3PlusDecoder.dll the game works fine.

@Ritori
Copy link

Ritori commented May 30, 2013

@daniel229 maybe u need rename MaiAT3PlusDecoder.dll to at3plusdecoder.dll try it maybe fix some game :)

@asbel123
Copy link

there is a one game stuff up sound effects is tales of the world radiat 1 it really wierd bug sound effect got no problem old version this version stuffed

@talesfan
Copy link

With the new library at3plusdecoder.dll added, Tales of The World Radiant Mythology 3 sometimes crash after winning random battles.. Besides that I think everything goes well (from main menu until game). Played using v0.7.6 - 917

Sorry for my bad English :)

@asbel123
Copy link

play part 1 first you see the bug sound effect load of the save on dugeon and fix tales of rebirth something worng sond effects i find the problem look into log consle you see the errors of red same thing with tales of phantasia narkira

@Ritori
Copy link

Ritori commented May 30, 2013

@talesfan that game dont playable yet..

@Ritori
Copy link

Ritori commented May 30, 2013

@rpgadvocate Black rock shooter is old problem no new one :) i dunno other game though...

Tales of the World: Radiant Mythology 1 Scratchy sound effect only

@solarmystic
Copy link
Contributor

@rpgadvocate

I've verified that the BRS audio issue has been there even before this at3+ dll implementation so it is not a new isuue. (in oioitff's previous media build)

As for Sol Trigger, well, the game still can't proceed past the first battle for now, which is imo a much bigger problem as compared to the audio issues.

http://forums.ppsspp.org/showthread.php?tid=1680&pid=22530#pid22530

http://forums.ppsspp.org/showthread.php?tid=1680&pid=25187#pid25187

@CPkmn
Copy link
Contributor

CPkmn commented May 30, 2013

Black Rock Shooter has scratchy audio on the official builds? I haven't noticed because I've only been using my custom build. I just checked the official PPSSPP build and it seems to occur as early as the titlescreen.
I got the game last month (but I didn't really have time to play much of it) so I tried booting it on my PPSSPP build and my audio's been fine (although the titlescreen music ends a bit early).
Actually, it sounds more than fine on my build; it sounds fantastic other than the titlescreen music ending early (but it still loops fine).
I implemented a method to dump my atrac3(+) audio a while ago so I'll upload what my decoding method gets for the titlescreen (I've tested the first battle as well and it seems fine).

http://depositfiles.com/files/5xqm8314b

@Ritori
Copy link

Ritori commented May 30, 2013

@CPkmn can u upload on mediafire or https://docs.google.com ? i cant access depositfiles website i dunno whyy :I

Edit: ohh is u build merge by this new tool too? :)
Edit again : ohh sorry i know what u mean now :)

@CPkmn
Copy link
Contributor

CPkmn commented May 30, 2013

@Ritori mediafire doesn't like my internet (I tried uploading there and it just doesn't work for me, but downloading does). Maybe filedropper will work better for you?

http://www.filedropper.com/blackrockshooter

@Ritori
Copy link

Ritori commented May 30, 2013

Ohh thank very much for that new link it work, that website is be block by my country :(
it hear nice maybe u can pull request this?
This same as oioitf first version :)

@cyclonmaster-zz
Copy link

Is there any PPSSPP build that have sceMpeg(video) and this new atrac3 decoder available yet?

@hrydgard
Copy link
Owner

@cyclonmaster , it's probably possible to make such a build, but @oioitff is rewriting the video emulation in a better way now that things are a little simpler with audio, so I'm waiting for that.

@mrcmunir
Copy link
Contributor

Great I try tested on android and working fine maybe nasty sound if not running 100% speed but running ok.
on the other hand some games is crashes at3.so when load background music in the battle dragon ball shin budokai

@CPkmn
Copy link
Contributor

CPkmn commented May 31, 2013

@Ritori does the Black Rock Shooter opening play on the official build (wait at the titlescreen for a while)? I noticed it was a PSMF, which the officially build is hit or miss with (and most of the time miss). The official build seemed to skip it, but I want to be sure. My build plays it fine.

@Ritori
Copy link

Ritori commented May 31, 2013

Yup, i need wait to see opening and u are right it liked official build skip it i dont press any start,slect,x etc.. to skip it :) i am sure i dont press any button maybe it skip automatic here some screen shot
dasdblsck

@CPkmn
Copy link
Contributor

CPkmn commented May 31, 2013

My build supports it perfectly (audio's synced, video ends at the right time, etc...)

blackrockshooter

@Ritori
Copy link

Ritori commented May 31, 2013

@CPkmn u should upload some so someone can test it :)
Edit: yea it there just test oioiftt build :) sorry then
it perfect :)

@CPkmn
Copy link
Contributor

CPkmn commented May 31, 2013

I may, but I didn't leave comments in my source (I was more worried about getting videos to play right than noting what I was doing) so I still need to go back and do that, which I haven't had time for, before releasing it. So far I've had 100% PSMF video (and PSMF audio of course) compatibility though.

@Ritori
Copy link

Ritori commented May 31, 2013

There alot of game maybe some of they dont work i dunno but i will look forward u build be release or merge :)

@ShradeTriviant
Copy link

Tested with the ppsspp-v0.7.6-977-g58c992d-windows-x86
Fate Extra CCC-BGM are soo low i hardly hear it. although voice seems to work fine.
Final Fantasy Type-0 - Voice and BGM tends to sound crap when transisting and it has the same delay as at3tool.exe.
As with 3rd birhtday, Im suprised that voice even works without any decoding tool. Exceppt for the randomly dissapear HUD. Anyway, it sounds weird that when using TURBO, the BGM also fast forward making it crappy. Im amazed with it ability to fade in and out at the right time.

@Squall-Leonhart
Copy link

@solarmystic
new build with sse2 and fast optimisations
see if cpu usage is lower

https://docs.google.com/file/d/0B65vMTKp-C0jYmhPTEhZMnNBcm8/edit?usp=sharing

@solarmystic
Copy link
Contributor

@Squall-Leonhart

Says I need permission to download the build. Can't access it other wise even with my Google account.

@Squall-Leonhart
Copy link

woops. try now (url changed)

@solarmystic
Copy link
Contributor

Thanks, the link works now. Will test it in a moment.

@solarmystic
Copy link
Contributor

@Squall-Leonhart

Did you compile this build yourself? There're some improvements in the CPU usage for me, and audio functionality seems to be the absolute same for the games I tested, no better, no worse. (Games that had perfect at3+ audio still have it and games that don't like Black Rock Shooter, with it's distorted BGM still have it too).

I think those with weaker hardware like mine (Core 2 @ 2.8 GHz) will notice it even more in the task/process explorer.

Tested with 0.7.6-1007-windows-x86.

@Squall-Leonhart
Copy link

The source on https://github.com/emulibraries/maiatrac3plus was updated to enable sse and a couple of other build optimisations, i flicked it over to SSE2 and set the same optimisations in the x64 build profile

SSE2 is more useful than SSE where media decoding is concerned.

Those games with issues aren't likely in the Decoder, of course @CPkmn will know better then me on that, but so far it seems like the issues reported are coming from what the emulator is sending to the decoder rather than the actual decoder itself.

@CPkmn
Copy link
Contributor

CPkmn commented Jun 1, 2013

@Squall-Leonhart I don't use the maiatrac3plus so I wouldn't know.

I recently got God Eater Burst to get to the next step of finishing its opening video (after "End of video reached") without skipping it with start/etc...it still won't end though >.>

@Squall-Leonhart
Copy link

@talesfan
Copy link

talesfan commented Jun 6, 2013

Tales of Twin Brave still has sound looping problem when "Press Start" on intro screen. You will hear infinite looping sound after that. Except that, the video, bgm, character sound effect, all in perfect condition. This problem is similar like what I previously mentioned on "Optical Field" sound effect on Tales of The World RM 3..

@unknownbrackets
Copy link
Collaborator

The sequence there is:

00000000 = sceSasGetPauseFlag()
ffffffff = sceSasGetEndFlag()
sceSasSetVoice(09814ac0, 0, 09ce1070, 7824, 1) // <-- loop = yes
sceSasSetPitch(09814ac0, 0, 2048)
sceSasSetVolume(09814ac0, 0, 2500, 1250, 1000, 1000) // <-- double left vol.
sasSetSimpleADSR(09814ac0, 0, 80fc, c8e3)
sceSasSetKeyOn(09814ac0, 0) // <-- on we go
00000000 = sceSasGetPauseFlag()
fffffffe = sceSasGetEndFlag() // <-- not ended...
sceSasSetVoice(09814ac0, 1, 09ce1070, 7824, 1) // <-- play it again in another voice?
sceSasSetPitch(09814ac0, 1, 2071)
sceSasSetVolume(09814ac0, 1, 1210, 2500, 1000, 1000) // <-- guess the sound moves rightward...
sasSetSimpleADSR(09814ac0, 1, 80fc, c8e3)
sceSasSetKeyOn(09814ac0, 1) <-- on we go

Looping VAG from block 488/489 to 243 (end=0)
Looping VAG from block 488/489 to 243 (end=0)
Looping VAG from block 488/489 to 243 (end=0)

Weird. I looked at JPCSP for this and it seems like they end a ADSR even if sustain hits 0. It fixes the Twin Brave demo to do this, but I have no clue if it's correct or not.

http://code.google.com/p/jpcsp/source/browse/trunk/src/jpcsp/sound/SampleSourceWithADSR.java

If I change it to switch to release or off when sustain hits 0, it at least ends, but it seems to end somewhat aburptly...

-[Unknown]

@talesfan
Copy link

talesfan commented Jun 6, 2013

@unknownbrackets : There's a build I tried which didn't have looping sound problem, the v.0.7.6-876-g40877cf. This build is really the latest with no looping sound. The next build after 876 until 1140, make that problem.. Could it related somehow with what you said earlier? But I didn't have any clue about this.. (Sorry for my bad english)

@unknownbrackets
Copy link
Collaborator

@talesfan right, but NOTHING looped in that version. It's correct that some sounds are supposed to loop, and regressing that is the wrong way to fix this specific case. If we disable looping for all the games that now have proper sound effects, a lot of people will be unhappy.

I think it's just the ADSR handling here that needs to be fixed.

-[Unknown]

@talesfan
Copy link

talesfan commented Jun 6, 2013

@unknownbrackets I see.. disable the looping will cause huge effect on another else game.. I hope the loop can be fixed soon.. Anyway, thanks for the answer unknown, and I always hope dev team can keep up the good work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet