Commit Graph

56 Commits

Author SHA1 Message Date
Henrik Rydgård 651a972019 More sceAudioCodec implementation work. Atrac3+ partially works now. 2025-04-02 17:26:59 +02:00
Henrik Rydgård e5d28975fa Fix playback of mono Atrac3+ tracks in videos
This is rare, but does occur: #19782

I missed that setChannels could happen late in my refactor (#19033)
2025-01-03 17:28:29 +01:00
Henrik Rydgård e5baebf139 Prevent a buffer overflow at the end of Atrac tracks.
Fixes #19177
2024-05-27 12:36:19 +02:00
Henrik Rydgård 1b366afa35 Refactor: Change *outBytes to *outSamples in AudioDecoder::Decode. 2024-04-16 15:31:11 +02:00
Henrik Rydgård d402068745 Fix mono output from Atrac decoders. (sceAtrac*MOut* functions) 2024-04-15 11:50:32 +02:00
Henrik Rydgård effae82208 sceAtrac: Do some renaming to make things make more sense 2024-04-13 10:35:39 +02:00
Henrik Rydgård 5ed77b58ca Improve the AudioDecoder API to avoid having to call a function to get the bytes consumed 2024-04-11 16:49:00 +02:00
Henrik Rydgård 45936e8826 Atrac: Add "flush_buffers" api. The ffmpeg atrac decoder was missing this. 2024-04-11 16:35:27 +02:00
Henrik Rydgård bf280eb410 Remove "SetExtraData" from AudioDecoder, pass in the data at creation instead 2024-04-11 14:39:59 +02:00
Henrik Rydgård db929ea042 Use minimp3 for in-game mp3 decoding. Doesn't solve any issues it seems, but works like before. 2024-04-11 14:19:22 +02:00
Henrik Rydgård 3de85c8d14 Remove more unnecessary accessors 2024-04-11 14:18:07 +02:00
Henrik Rydgård 8adca6492c Move class SimpleAudio into the cpp file 2024-04-10 13:03:19 +02:00
Henrik Rydgård 1805910fac More refactoring 2024-04-10 12:22:58 +02:00
Henrik Rydgård 1938d3b876 More prep for plugging in alternate audio decoders 2024-04-10 12:14:58 +02:00
Henrik Rydgård 32ca7ab59a Minor code cleanups 2024-04-10 12:07:03 +02:00
Henrik Rydgård 88eb2c2e0b Add a virtual base class so we can implement alternative decoders 2024-04-10 00:45:02 +02:00
Henrik Rydgård ddbe0e853b Remove unused code 2024-04-10 00:40:16 +02:00
Henrik Rydgård e19e9b2793 Delete pointless accessors, update some comments 2024-04-10 00:35:48 +02:00
Andrew Udvare 930b7f644d ffmpeg: Improved fix for checking if const AVCodec* is necessary 2024-02-05 14:37:09 -05:00
Andrew Udvare 402f9acb5e Fix compilation with newer ffmpeg versions 2024-01-13 00:12:21 -05:00
Unknown W. Brackets a7b7bf7826 Global: Set many read-only params as const.
This makes what they do and which args to use clearer, if nothing else.
2022-12-10 21:13:36 -08:00
Henrik Rydgård e6403d7157 Split GetPointer into two versions, to help with const correctness 2022-07-24 13:26:19 +02:00
Unknown W. Brackets d45fe93588 Mp3: Output PCM data using even/odd buffer slot.
This makes sense since the audio APIs are all async.
2022-01-27 00:22:44 -08:00
Unknown W. Brackets 4903e14aae Mp3: Cleanup AuCtx constructor. 2022-01-27 00:22:43 -08:00
Henrik Rydgård 3162f30158 Merge base/basictypes.h into Common/Common.h (mostly). 2020-09-29 15:51:51 +02:00
Henrik Rydgård ff65b813d9 Assorted warning fixes 2019-05-10 23:26:34 +02:00
Unknown W. Brackets fde59c955d Mp3: Use a vector for the temp buffer.
Hopefully will move to reading RAM directly.  I think this was not always
adding data properly, as I got wrong output after decode.  Makes more
sense as a vector, anyway.
2019-04-29 04:45:36 -07:00
Unknown W. Brackets ac43e55194 Mp3: Loop correctly from an offset.
If the offset points to an ID3 tag or the middle of a frame, that's fine -
it should just search forward to the next sync.  FFmpeg just returns a
decode error, so we do this first.
2019-04-28 08:35:35 -07:00
Unknown W. Brackets 0d6570e8ad Mp3: Correct sceMp3GetMaxOutputSample.
Was based on output buffer size, rather than frame size, before.

Fixes choppy audio in Velocity.
2019-04-24 14:31:12 -07:00
Unknown W. Brackets be6710ea4a Mp3: Fix errors for a bunch of init getters. 2019-04-24 14:13:46 -07:00
Unknown W. Brackets e4d2712897 Mp3: Apply offset to stream read buffer.
Handle errors for sceMp3CheckStreamDataNeeded as well.
2019-04-23 21:14:54 -07:00
Unknown W. Brackets f9863c3be2 Mp3: Align CheckStreamDataNeeded with InfoToAdd.
May cause problems if they don't match.
2019-04-23 20:42:13 -07:00
Unknown W. Brackets f1eaf9dc0e Mp3: Don't change buffer accounting until add.
If we just ask what we should add, that is meant to stay static until we
do actually add it.

This also reduces the max we ask for at a time, which better matches
correct behavior and might impact game behavior.
2019-04-23 20:18:16 -07:00
Unknown W. Brackets 0b1102a622 Mpeg: Correctly handle mono audio in videos. 2016-01-21 23:19:03 -08:00
Henrik Rydgård e632b32be2 Merge pull request #8011 from unknownbrackets/atrac-demux
Manually read packets in sceAtrac, skipping ffmpeg
2015-10-18 20:51:39 +02:00
Lioncash b1901fbad2 Core: Remove unimplemented class function declarations 2015-10-18 10:55:11 -04:00
Unknown W. Brackets 0e8d3d9c56 Fix leak in FFmpeg codec ctx usage.
Turns out we were leaking these here too.
2015-10-17 16:20:25 -07:00
Unknown W. Brackets daa90024ed Defer opening audio codec 'til we have block size.
May fix issues with newer versions of FFmpeg (#5772.)
2015-01-18 12:59:26 -08:00
Unknown W. Brackets 47ad97617e Play AT3 files in background audio too.
Fixes 3rd Birthday and PQ2, at least.
2014-06-22 09:55:14 -07:00
Henrik Rydgard 8c36921d3c Have SimpleAudio respect channels/samplerate passed in 2014-06-22 18:33:09 +02:00
Henrik Rydgard cefc0bc96f Play the game's SND0.AT3 when a game is selected in the menu and on the "game screen". 2014-06-22 17:02:04 +02:00
Henrik Rydgard 12cef8fa80 Oops, buildfixes 2014-06-22 14:23:06 +02:00
Henrik Rydgard 1d0cc3417c Audio stuff: Cleanup, delete dead code 2014-06-22 14:01:23 +02:00
Unknown W. Brackets c142207a93 Fix a few warnings, mostly type comparisons. 2014-05-31 21:42:57 -07:00
Unknown W. Brackets 95414d6727 Get rid of some duplicate code. 2014-05-29 08:30:00 -07:00
kaienfr c6a1b0e743 Provide a new method AuCtx::AuCreateCodecContextFromSource()
This method can automatically read audio information from file (as channels, sample rate etc) via ffmpeg,
and create accurate ffmpeg's codec context.
Especially used for unknown audio format but supported  by ffmpeg.
2014-04-14 13:23:10 +02:00
kaienfr d5fde0baee implement sceMp3GetFrameNum 2014-04-14 11:47:28 +02:00
kaienfr e25bc6908a Fix nonsmooth sound issue and incomplete frame at the end of source and pcm buffers.
using a std::string to save the source buffer, and changing the loading strategy so as we will not get any incomplete frame.
2014-04-12 23:16:38 +02:00
kaienfr b3a7568811 change the way in AuGetInfoToAddStreamData and AuNotifyAddStreamData.
readPos and available buffer is firstly updated in AuGetInfoToAddStreamData then notified in AuNotifyAddStreamData.
Since, some games as Dead and alive may not call NotifyAddStreamData after GetInfoToAddStreamData
2014-04-12 14:54:25 +02:00
kaienfr a7691737b5 Transfer old mp3 savestate into new mode; Rename class functions sceAu... to Au...
Tests on games are just ok.
2014-04-12 02:12:25 +02:00