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

sndfile and CDAUDIO.WAD support needs backporting #347

Open
Lwmte opened this issue Jun 27, 2016 · 12 comments
Open

sndfile and CDAUDIO.WAD support needs backporting #347

Lwmte opened this issue Jun 27, 2016 · 12 comments

Comments

@Lwmte
Copy link

Lwmte commented Jun 27, 2016

Also, gone with "refactored old master".

@Lwmte Lwmte self-assigned this Jun 27, 2016
@stohrendorf stohrendorf added this to the TR1 milestone Sep 2, 2016
@TeslaRus
Copy link
Contributor

TeslaRus commented Sep 3, 2016

wad audio file loading had been implemented, only audio scripts should be updated / tuned

@vvs-
Copy link
Contributor

vvs- commented Sep 3, 2016

Script_GetSoundtrack doesn't allow to omit the file name in every track. And duplicating it a hundred times serve no purpose. So, it might require to modify Lua support code as well.

@TeslaRus
Copy link
Contributor

TeslaRus commented Sep 3, 2016

for wad file using script should return only CDAUDIO.WAD and type = WAD, track number are used iside audio module (by track number audio module access to wad header, takes offset to the track and loads track)

@vvs-
Copy link
Contributor

vvs- commented Sep 4, 2016

And this doesn't work because Script_GetSoundtrack concatenates the track path and file names which are stored in an array. You'd need to put the same file name into each array entry for this to work. And it requires the file names to be present.

EDIT: Ok, I was mistaken. It's actually getTrackInfo which concatenates these names.

This will do the trick:

diff --git a/scripts/audio/soundtrack.lua b/scripts/audio/soundtrack.lua
index 9972f70..1b409b0 100644
--- a/scripts/audio/soundtrack.lua
+++ b/scripts/audio/soundtrack.lua
@@ -728,8 +728,9 @@ function getTrackInfo(ver, id)
         else
             tbl  = tr3_old_track_tbl;    -- TR_III (OLD)
         end
-        path   = "data/tr3/audio/";
-        method = OGG;
+        path   = "data/tr3/audio/cdaudio.wad";
+        method = WAD;
+       return path, tbl[id].mode, method;
     elseif(ver < 8) then                -- TR_IV, TR_IV_DEMO
         tbl    = tr4_track_tbl;
         path   = "data/tr4/audio/";

@Lwmte
Copy link
Author

Lwmte commented Oct 10, 2016

Just not to forget: no any WAD file support exists in current OpenTomb master, nor any support for MS-ADPCM WAV files. There is no any streaming routines except OGG streaming, which currently doesn't work as it should (as it loads WHOLE ogg files into memory on level start).

Solution 1: Brace ourselves and integrate sndfile once again.
Solution 2: Find working code for MS-ADPCM streaming somewhere.

@Lwmte Lwmte removed their assignment Oct 10, 2016
@vvs-
Copy link
Contributor

vvs- commented Oct 10, 2016

What do you mean? The above Lua script patch actually makes it possible to use WAD file for TR3.

Also, similar patch is needed for Lua scripts to use WAV files for TR4/5. Only file names extensions and method need to be changed. I'm able to successfully use such a patch locally.

It's true that there is no streaming support yet. All files are preloaded at the level start.

@Lwmte
Copy link
Author

Lwmte commented Nov 16, 2016

I just mean that preloading soundtrack files on level start instead of streaming couldn't in any way count as "support". Sorry. It's absolutely ridiculous and wrong way to work with long audio files.

@vvs-
Copy link
Contributor

vvs- commented Oct 8, 2017

@Lwmte Seems that streaming is working now. Should this be closed?

@TeslaRus
Copy link
Contributor

TeslaRus commented Oct 9, 2017

This time audio streaming works itself, but it preload ALL audio data to the buffer (it is bad); Only one streaming works correctly: RPL video playing (streaming system); May be it will be more correct to create task for real streaming system (I though about moving all audio streaming format support to rpl code part)

@vvs-
Copy link
Contributor

vvs- commented Oct 9, 2017

BTW, streams can't be stopped now except when Lara dies. This means that several streams can now be played simultaneously which wasn't intended.

@TeslaRus
Copy link
Contributor

TeslaRus commented Oct 9, 2017

Streams stopped by next logic [type filtered]: only one type==background or type==chat may be played, type==one_shot do not stop other one_shot streams
Stream types was introduced by Lwmte

@vvs-
Copy link
Contributor

vvs- commented Oct 9, 2017

Yes. But ONCE streams were stopped before recent audio refactoring. And now it's possible to play several ONCE streams at once. This sounds awful and wasn't intended in original Core levels. This isn't obvious in PC version because it just lacks anything besides LOOP and CHAT streams. But in OT it's now perfectly possible to do that, e.g. in Caves.

EDIT: It's impossible to play the same ONCE stream twice, but nothing prevents from playing different streams.

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

No branches or pull requests

4 participants