OpenVIII - an open-source Final Fantasy VIII engine implementation

  • Thread starter Thread starter makipl
  • Start date Start date
Status
Not open for further replies.
Well I was fiddling with Naudio and managed to get the Overture ogg file to play. I'm unsure about the portability. I'm gonna D/L ubuntu and install in vm. To see if it works. Looks like I need to make a helper class to enable looping. Just wanna see if it works in linux first before i put more effort into it :P

Man Virtualbox is going slow. I think it's the hard drive slowing it down. I didn't wanna use my ssd space, but it's maxing out my hard drive speed lol.

Maybe it's because I was only giving it 1 core and 1gb of ram. it was probably chocking it's self going in and out of the virtual memory/swap.

Yep that fixed it. I sat here for like an hour watching apt-get stuck on something lol

I was thinking that the instructions line "apt-get install mono" should be changed to a link for https://www.monodevelop.com/download/#fndtn-download-lin at least for me mono isn't a package. after adding the repository the package it told me to install was mono-devel.

Maybe need to add "sudo apt-get install monodevelop" to instructions
 
Last edited:
I got some audio playing in linux but it's all distorted for some reason. I am loading the entire ogg into a byte array to add to a sound effect. I heard something but it's noisey, lots of static.

Okay after much time. I found the answer on a form for what i thought was the problem and issue solved.
https://stackoverflow.com/questions...yte-array-to-use-in-monogam/42151979#42151979

I'm unsure what the other sounds format is but i might run the bytes through this function and see if the distortion goes away for those.

I didn't know WaveFormatConversionStream.CreatePcmStream() was there. I just attempted to stick it in but it didn't like the vorbis source. So i guess we stick with the current version for now.
 
Last edited:
I got some audio playing in linux but it's all distorted for some reason.
It's expected behaviour- I am not converting ADPCM to PCM stream due to NAudio compatibility issues with Linux- instead I'm forcing to play compressed sound.
I'll be moving to FFMpeg soon- that will solve this problem

I am loading the entire ogg into a byte array to add to a sound effect.
Vorbis OGG is also a compression format, just like adpcm. They both need conversion to basic stream, which FFMpeg will be capable of this.
 
It's expected behaviour- I am not converting ADPCM to PCM stream due to NAudio compatibility issues with Linux- instead I'm forcing to play compressed sound.
I realized all this after a while. I spent a lot of time trying too google a way to convert the adpcm to pcm. Just kept finding the function that you already were using in windows. I actually thought I fixed it by removing waveout from the equation. Till I went to check again last night and i then realized I was looking at the wrong function as the problem.  I was thinking of comparing the bytes of the pre and post converted audio. *shrugs*.
Vorbis OGG is also a compression format, just like adpcm. They both need conversion to basic stream, which FFMpeg will be capable of this.
Naudio.Vorbis uncompesses the audio to a 32-bit float WaveStream. I found a function to convert it to 16 bit. So the ogg music is playing and looping in Windows and Linux.
I'll be moving to FFMpeg soon- that will solve this problem
Sounds good. I was thinking of finishing up the ogg music playing stuff. It works like the directmusic stuff. So I was going to setup my code to mirror what you have there.
I'm sorry for these posts. I was figuring things out as I went. I shoulda came back and edited more as I figured things out.

--- edit---
For some reason the loop is not working correctly at least not on all the files... I'm 99% sure my code is correct but on '512 The Loser.ogg' it's obvious that STARTLOOP is being ignored. So it is looping the whole sound effect. So I look forward to ffmpeg.

symbolNames in module-field_debug doesn't seem to be working. Just a black screen. i'm getting string[1] with a lot of 0 values. On testbl3 it gives a out of range exception on the line of Code: [Select]
Code:
epe[i].labelASM = symbolNames[epe[i].label];
"C:\\ff8\\Data\\eng\\FIELD\\mapdata\\te\\testbl3\\testbl3.sy" I guess this is supposed to be a bunch of strings. It's many 0 and 255 values instead. I was getting a lot of index out of range errors when it was trying parse it.
I uncommented statupscript and started seeing images. with some exceptions which might be why it was commented :P

I'm looking at the diffs in github's app might try to commit tonight.
 
Last edited:
For some reason the loop is not working correctly at least not on all the files... I'm 99% sure my code is correct but on '512 The Loser.ogg' it's obvious that STARTLOOP is being ignored. So it is looping the whole sound effect. So I look forward to ffmpeg.

<

Are you sure?  LOOPSTART should be absent when you don't want a loop.  LOOPSTART=0 will loop from start.
I just found the reason OpenAL is ignoring LOOPSTART and LOOPLENGTH. Monogame has a variable to set for LOOPSTART but it just doesn't do anything. Though if I set LOOPLENGTH it throws an exception. heh.
https://github.com/MonoGame/MonoGame/issues/5186


--edit--
there was a commit to attempt to fix. now I'm wondering if it's using openal. or if the commit is live in the version i'm using.
https://github.com/MonoGame/MonoGame/commit/b749c4568edd73fde7e25a4c829d759a8ff5db9d

--edit--
I think all opengl projects default to using openal for audio via these functions. The function where I set the LOOPSTART -> http://www.monogame.net/documentation/?page=M_Microsoft_Xna_Framework_Audio_SoundEffect__ctor
I'm done messing with this for now.  :P

--
just going to fiddle. I was thinking I might be able to do the ingame menus just need to learn how more of the things these classes work.
 
Last edited:
I started messing with ffmpeg last night. I found some src for the goal i think in c++.
Mainly just was trying to add audio to the video player you made to see how good it would work.
I am stuck on one line of the c++ that I can't seem to find the correct cast for one of the variables.
I don't know if the lines below this will work till I get this line functional.
code i'm referencing.
https://github.com/gavv/snippets/blob/master/decode_play/ffmpeg_decode.cpp
line i'm having trouble with.
Code: [Select]
Code:
       // convert input frame to output buffer        int got_samples = swr_convert(            swr_ctx,            &buffer, out_samples,            (const uint8_t **)frame->data, frame->nb_samples);
frame->data is the issue. it's throwing an error cannot cast byte_ptrArray8 to byte **.
I'm using ffmpeg.autogen from the NuGet. And the newest ffmpeg 32bit dlls.

Gonna take a break and watch some anime.

--- edit
Code: [Select]
Code:
#define  AV_NUM_DATA_POINTERS   8uint8_t *  data [AV_NUM_DATA_POINTERS]//  pointer to the picture/channel planes.
https://www.ffmpeg.org/doxygen/2.6/structAVFrame.html
https://www.ffmpeg.org/doxygen/3.0/frame_8h.html
if i were to make it in c#, i think it would look like Code: [Select]
Code:
 byte*[] data = new byte*[8];
so I did make one of those and copied that data one byte at a time to it. But then I couldn't make byte*[] into byte**;
*shugs*
------
I might of got past this part.. there is a extended_data variable. Which I think is the same thing but it's a byte** instead of the other.

So now it's just getting all this data into a form i can play it back.
----
PROGRESS!! :D sound at last!

Sound is playing but it's not in the correct format so it's sounding like garbage :P. So I just need to get the code working that converts the sound to 16bit pcm.

i might be celebrating too early after converting and it still sound bad i'll know :P
====
well I think I was just getting random garbage to play.
swr_convert is returing a -22 didn't notice it at first. I found the errorcode function and turns out that is invalid argument. So I don't think it likes extended data.
I sware i tried using fixed before... It still isn't working but i am sending data.
Code: [Select]
Code:
byte*[] a = frame->data;                int frame_count=0;                fixed (byte** b = a)                {                    frame_count = ffmpeg.swr_convert(swr, (byte**)&buffer, frame->nb_samples, b, frame->nb_samples);                    if (frame_count < 0)                        throw new Exception($"{frame_count} - {averror(frame_count)}");                }
------
I got rid of that error finally. I guess I had a issue with my swr context. Or the channel_layout was 0. I changed both. :P
 
Last edited:
I guess we could ignore the last post now. I made a class to deal with ffmpeg stuff. It's using the newer API. I still need to finish audio. I redid the current video functionality that Aforge did, with color corrected I think. At least for me the video had Red and Blue switched. Some issues with linux that should be able to be worked out per the FFmpeg.Autogen github. So now I will go back to audio and try to get that going. After I look at some Java for a friend.

Audio should be a drop in the bucket now as the video code is known good. I just need to tell it give me the audio and tada, I hope.

I've committed everything locally. I think I need permission on Github to submit to you. It should probably go in it's own branch to prevent messing anything you are working on.

For fun: I added the squaresoft logo to the front of overture. The intro movie to new game.
 
Last edited:
There a pull request :D

I just noticed there might a issue if RaW isn't installed. I forgot to check if the folder existed.
 I just did a commit to fix on my fork. Do I do another pull request or just wait till I've done more?

I'm gonna eat dinner. then mess with the ffmpeg audio some.
 
Okay Testing with eyes_on_me.wav is successful. Reads it without resample and with.

tested video.
So sound is working, as in is not distorted but it is ending prematurely
 
Great job! I have merged the commits. Everything looks great. I'll make sure to add you as an collaborator soon
 
I feel like I'm missing something on this ffmpeg audio resampler. Decided to try posting to https://stackoverflow.com/questions...16-bit-pcm-to-be-used-with-xna-soundeffect-au I haven't posted on stackoverflow since 2013. lol

I followed someone's code and made a audio converter but depending on what you asked it to make it would work or not. And I didn't know why. :P I was thinking if i could make it work it'd help with my issues over on this project. Like disc00_30h.avi to mp3 worked fine. But ogg skipped ahead every few seconds and wav does the same thing my code was doing-- plays 18 seconds and stops.

I'll keep fiddling. Maybe someone will have an answer on stackoverflow or I'll figure it out :P

Just fixed the code for the little audio converter so wav is working in that, after fixing that ogg is playing fine now too. I should be able to take parts of this and put them in my class and it work after that. Though this is setup to write the files to the drive and it uses the deprecated api.

I'm not sure I thought decoding and resampling would be good enough for playback. Maybe I do actually need to encode it.

I kinda wish we could do one frame of audio at a time like we do with video. I think it would work if we could queue up samples. Right now the approach I'm doing is process it all load it all into ram and play. This adds some lag to the start of video playback.
---
Did two tests with using the audio converter to take disc03_06h.avi to wav and s16le (signed 16 bit le pcm) both of those files played in sound effect. so I'll continue adding the encoder to the class.

---
update today. I got a partial success today. It's outputting wave files. But there's something wrong with them and sound effect will not load the files. I think it could be because I am mixing API's
per ffmpeg documentation the new api should not be used with old. So either I'm decoding the files incorrectly because this resample/encode code should be correct. Or it's not working because of the two apis conflicting. So i'm gonna do some more tests. using the code in a separate program that just only does this one thing update the code.

---
update
so I updated the audio converter app to the new api. I think the issue is my decoder code is faulty. I kinda rewrote that in the audio converter app when i updated the api. so back to porting code over. to the project. and hopefully the bugs go away. :P
 
Last edited:
Sounds kinda. Currently the code is messy. It writes a <filename>.pcm to your %temp% folder. Then reads it into MemoryStream->SoundEffect. And it plays. I did notice our fps counter might need tweaked. The intro movie video was about 10 or so seconds behind the audio. Now that I have code that works I can tweak it to remove the need for a file. I am thinking for the fps I can maybe store the current framenumber and total frames. Using that I can see if we are behind or ahead and adjust via some math.

---
Update sound is work 100% reads the raw audio right into the memory and plays it.
Fixed the sync issue. I made a function that starts a StopWatch right before playing the audio. Then before it draws the frame it checks for Correct frame or Ahead a frame. And added a frame skip bool that checks if the player is Behind. The stopwatch is reset when stopaudio is called.

Though somewhere in this unsafe code is memory leak(s). I been trying to track some of them down. I added right and left to the movie player in debug mode. So while a movie is playing I can switch to the next or prev movie. And I noticed the memory usage go up as I was holding down the arrow. to the point it would throw an exception around 1gb.
 
Last edited:
I'd recommend increasing the movement speed on the world map segment, takes too long to explore.
 
I'd recommend increasing the movement speed on the world map segment, takes too long to explore.
Maybe I could add the plus and minus keys as a throttle.

Sent from my Pixel XL using Tapatalk
 
jjpg.jpg

Good news. We got the monsters more-or-less working:
ezgif-com-optimize.gif
 
I updated my fork to be current and saw monsters on the battle screen lol

I just did a small update to add speed controls per Yagami Light's request. For the FPS camera in worldmap and battlemap.

+,-,*
 
Monsters looks so cool, I downloaded the new version but I get exception skipping to main menu

System.BadImageFormatException: 'Could not load file or assembly 'DirectMidiNet, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
 
Monsters looks so cool, I downloaded the new version but I get exception skipping to main menu

System.BadImageFormatException: 'Could not load file or assembly 'DirectMidiNet, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
Make sure you are on 32 bit. Midi doesn't work on 64 bit
----------
I just updated, to add a flag for 64 bit so we can quarantine the code that doesn't work in 64bit. So shouldn't get the exception anymore, just won't have midi if not on 32 bit.
 
Last edited:
Ok now I get exception error when I try enter any of the battle encounters

System.UnauthorizedAccessException: 'Access to the path 'D:\out.dat' is denied.'
 
Status
Not open for further replies.
Back
Top