Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ponut64

Pages: 1 ... 5 6 [7] 8 9 ... 12
91
That is a thought, but this is converted AIFF files to ADPCM using a different tool (still a Mac tool though). The documentation refers to this as "User-specified ADPCM" (not the optimage thing, but referred at the bottom of this page as "ADPCM Encoder" https://antime.kapsi.fi/sega/docs.html). In that case, since the AIFF file has a header, so should the ADPCM file (it isn't discarded when compressed). It should be noted that if you try to playback the ADPCM file as a PCM file with Jo engine functions, you get sound, it's just garbage. T
Maybe CD-XA would work. The issue is I imagine that won't work over an .ISO file. The reason I've skipped over CD-DA is because Bizhawk, Yabause, and SSF won't accept files like that. Maybe it will work for CD-XA though I am no more certain on how to actually playback CD-XA than AIFF-ADPCM files seeing as the documentation tells you jack shit about how to do that. (I exaggerate, I just vehemently dislike their code example because it leaves so much up to imagination)

92
I really don't have a clue.

I can use the ADP_DecMono (decompress mono) function with the Jo engine PCM load function, which should work since it just outputs a decompressed PCM.
It compiles, it doesn't crash, but the sound doesn't play.
I am not sure what to do...

93
It looks like this is another one of my "play-by-play" update threads.

So here is some code. It's errorless, but the sound does not play. I am not sure where to put the data in memory to get it to play.

Of course one must earlier plan out your GFS and also call the commands PCM_Init(); and     PCM_DeclareUseAdpcm();

Code: [Select]
#ifndef __AUDIO_H__
#define __AUDIO_H__

#define RING_BUF_SIZE  (2048L*10)
#define PCM_ADDR  ((void*)0x25a20000)
// The above seems to point somewhere in LWRAM.
#define PCM_SIZE  (4096L*2)
#define SND_RAM (94371840)
#define LW_RAM (2097152)

//Functions go here
void adpcm_load(void);



#endif

//audio.c
//this file is compiled separately
#include <jo/jo.h>
#include "audio.h"

//goals:
//load an ADPCM file from CD (GFS_Load)
//Set up a PCM memory handle using the loaded CD data
//--> Understand PCM_VblIn or otherwise SBL interrupt system
//Playback the PCM file from PCM memory handle

void adpcm_load(void){
/* Work  */
PcmWork pcm_work;
PcmCreatePara para;
/* Ring Buffer  */
Uint32  ring_buf[RING_BUF_SIZE / sizeof(Uint32)];
PcmHn       adpcm;
/* Create Handle */
PCM_PARA_WORK(&para) = &pcm_work;
PCM_PARA_RING_ADDR(&para) = ring_buf;
PCM_PARA_RING_SIZE(&para) = RING_BUF_SIZE;
PCM_PARA_PCM_ADDR(&para) = PCM_ADDR;
PCM_PARA_PCM_SIZE(&para) = PCM_SIZE;
adpcm = PCM_CreateMemHandle(&para);
//Load
    void * soundAddress;
soundAddress = PCM_ADDR;
Sint8* name = "SHELL.ADP";
//Data of read structure
    Sint32 fid = GFS_NameToId(name);
GfsHn gfs;
Sint32 nsct;
Sint32 fsize;
//Data of read-in-process
Sint32 stat;
Sint32 rdsize;
//Destination address?
void * ptr2 = adpcm;
//Loading follows
gfs = GFS_Open(fid);
//Get sectors
//HEY! SBL DOCUMENTATION IS WRONG! THIRD ITEM nzect IS GFS SECTOR COUNT. SECOND ITEM IS CD SECTOR SIZE.
GFS_GetFileSize(gfs, NULL, &nsct, NULL);
GFS_GetFileInfo(gfs, NULL, NULL, &fsize, NULL);
//TIP: GFS_NwCdRead cannot be checked for completion. Sorry!
GFS_NwCdRead(gfs, fsize);
GFS_NwFread(gfs, nsct, (Uint32*)(soundAddress), fsize);
do{
GFS_NwExecOne(gfs);
GFS_NwGetStat(gfs, &stat, &rdsize);
jo_printf(0, 11, "(%i)", rdsize);
jo_printf(10, 11, "(fetched filesize)");
}while(stat != GFS_SVR_COMPLETED && rdsize < fsize);
// slDMACopy(soundAddress, ptr2, sizeof(PcmHn));
// slDMAWait();
/* Start Playback */
PCM_Start(adpcm);
while(TRUE) {
/* Playback task processing */
PCM_Task(adpcm);
/* End condition */
if (PCM_GetPlayStatus(adpcm) == PCM_STAT_PLAY_END) break;
}
/* Destroy Handle */
PCM_DestroyStmHandle(adpcm);
/* End Processing */
PCM_Finish();

}


i've also included some sample files

94
Project announcement / Re: Sonic Z-Treme
« on: June 23, 2018, 11:04:18 pm »
These improvements are hitting pretty rapidly, great work

95
Now I have a different problem.

Sega's documentation has stuff like this:
Code: [Select]
PCM_PARA_WORK(&para) = &pcm_work;
PCM_PARA_RING_ADDR(&para) = ring_buf;
PCM_PARA_RING_SIZE(&para) = RING_BUF_SIZE;
PCM_PARA_PCM_ADDR(&para) = PCM_ADDR;
PCM_PARA_PCM_SIZE(&para) = PCM_SIZE;
pcm = PCM_CreateStmHandle(&para, stm);

The issue is, PCM_PARA_WORK references a member of the PCM_PARA struct (&para) called "work".
.. No such member exists.

This is a basic fact of SBL PCM playback and I am not sure of a way around it.

There's also a plethora of other issues, such as the SBL STM documentation stating some functions have have void inputs, but in fact don't. (Stream functions aren't entirely necessary, they just decided to make a usage example with the stream functions..)
I guess this is going to take longer than "a few days" to get working.

And to get any of this to compile, it's best you just include the entire SBL library in jo engine makefile.

It's really not clear how to use SBL PCM. Not clear at all!

/e: So, they did not specify what type "para" in the example. It turns out it is the type "PcmCreatePara", not "PcmPara".
I better do a little more research before I post this stuff on the forums eh?

96
I'm not planning on 44 KHz ADPCM since that's too much data for the CD system (mostly the A bus) to handle simultaneously with the other tasks I have planned for it.
Assuming my ideas even work. They should though.
If you wonder what else might the M68K be doing, well there are 8 PCM sound channels and one could in theory be playing 44 KHz sound bytes on all of them.
Not just that, but let's say you processed some sort of reverb or echo in the program, that would involve some SH2 work but also the M68K too.

I guess once I get an ADPCM program implemented, someone might be able to probe the performance impact.

/e: Well, it would seem that the ADPCM decompression program is indeed using the SH2s to a significant extent (by looking over the source code). However, keep in mind the ADP library has no source code to be found and I imagine that's the case because its written in Assembly for the M68K. I don't know why I wonder so deeply when I can test it very soon.
Though it looks like it does a few back-and-forth transfers to sound RAM and if that's the case you're far more concerned about B-bus usage than anything else.

97
I'm not sure if we should be at all concerned with the CPU overhead, since I am pretty sure they are referring to the M68K which is dedicated to sound. You also probably don't need stereo for music, and using mono will cut the CPU usage in half.
If that isn't the case, then certainly, 20% of your work area CPU grunt being eaten up by music would be alarming.
You wouldn't have to worry about that overhead unless you were using a lot of special effects on many different PCM channels.
Which I suppose you could!

98
Thanks, I should be working with 22 KHz ADPCM in the following days.
It's really impressive since 22 KHz ADPCM is the same file-size as 44.1 KHz mp3 files.
Sure, half as compressed as mp3 files, but the Saturn can handle it.

99
/e: Nevermind, I seem to have fixed it!

Regardless for anyone who wants to use ADPCM, here is an updated LIBPCM.A and an updated jo engine makefile.

For anyone curious as to what the problem was, there's no SBL source code for ADPCM system. There is however LIBADP, which contains the object code for said functions, and they are in fact linked in the code its just there's no source.

So I downloaded SaturnOrbit and simply included the .o files in LIBPCM.A -- you shouldn't need LIBADP.A anymore, but it is there in any case.

You put LIBPCM.A in
\joengine-master\Compiler\SGL_302j\LIB_COFF
Keep your old LIBPCM! Who knows what I have broken!
You also should put the following line in your Jo engine makefile
JO_COMPILE_USING_SGL = 1
**IT SHOULD BE NOTED THIS IS THE SBL PCM LIBRARY, NOT SGL

100
Share your code / Re: Model converter (.ZTP) -0.1 - WIP
« on: June 21, 2018, 07:43:19 pm »
Yeah, it's the normals (at least that part of the code).
I definitely kept (and updated.. or is that a thing you are supposed to do? The generated .h file from converter has an ANORM section, I copy that into an ANORM.H) the anorm file.

If I load it into your demo (even using that demos ANORM file), that doesn't happen. The issue has to be the scale then.

Now I just wonder, how can I get the model visible without clipping into it and it still being the correct size! That is something I can figure out. Thanks for helping me again!

/e: Oh wait. Your demos ANORM file is just the right one. So to anyone reading this thread. Use that anorm file. It worked even if I scaled the model. Sorry.
Everything is peachy now. Have a wonderful day. Any chance I could pass you lunch money over PayPal?  ;D

https://i.imgur.com/QalXkJm.png?1

101
Share your code / Re: Model converter (.ZTP) -0.1 - WIP
« on: June 21, 2018, 07:18:18 pm »
I am assuming to fix the patchy-ness like this I'm going to have to increase the precision?
Or perhaps DUAL. Hmm.

https://i.imgur.com/4NGPF34.png?1

Really great so far though.

/e: DUAL attribute on the textures sort of gets around it

102
Share your code / Re: Model converter (.ZTP) -0.1 - WIP
« on: June 21, 2018, 06:41:49 pm »
Reducing the scale (incl. scale done in blender and in converter, but not scale in-engine) did put it back into shape. Thank you.
I guess that highlights the fact that I am running my crap on a pretty big scale, and it is OK to scale up the stuff in-engine for me.

It's not moving yet because I am a fool and somehow my OBJs are exporting as identical to one another. Note to self: Tick "Apply Modifiers", save headache.

Given how patchy the model is, I think I need to take its scale down even more...

103
Share your code / Re: Model converter (.ZTP) -0.1 - WIP
« on: June 21, 2018, 05:36:42 pm »
Hey,

Sorry to bug you again sir, but I have some more questions.

I got your Sonic ZTP and animation to load and play in my environment (which should be a no-brainer because that's all files and code that your wrote), but there seems to be something wrong with my Blender or OBJ files or.. something.

I have tried a couple of different things (certainly not exhaustive, however) and it all seems to end in vomit (once using the animation play function):
https://i.imgur.com/pXOdV5x.png?1
I did however re-convert your OBJ files using the tools with some different parameters and it did work, so I feel like I know how to type things in. Possibly.
I wonder, am I misinterpreting what this tool is for? Does this compress mesh-is-a-bone animation or per vertex animations?
(Looking at your Blender file, per vertex animation is clearly used so I don't know why I even ask)

104
General Jo Engine Help / Re: CD-DA Audio in Jo is broken...?
« on: June 21, 2018, 07:05:13 am »
No, I hadn't. That is good to hear for those who need to test CDDA though.

105
General Jo Engine Help / Re: CD-DA Audio in Jo is broken...?
« on: June 19, 2018, 11:06:14 pm »
Yes, that should work. If you burn from the CUE file which will include the music file (included from the CUE file) into the CD.
The problem is I can't debug anything without it being able to load properly in an emulator (*without burning a disc). So with that I am going to switch to 22 (maybe even 11) KHz ADPCM sound instead. The features for ADPCM are probably better suited to what I want to do, anyway.

Thanks for the confirmation.

Pages: 1 ... 5 6 [7] 8 9 ... 12
SMF spam blocked by CleanTalk