Sega Saturn Development > General Jo Engine Help

Doomsday Phrase: undefined reference to "ADP_DecMono" (and stereo)

<< < (2/8) > >>

LackofTrack:
I thought the CPU overhead they were referring to was one of the SH2 processors.
It would be a relief if they were talking about the M68k processor, but if that's the case then what's stopping you from doing 44khz ADPCM? It is only has about 30% CPU overhead.(What else would the M68k processor be doing besides this?)

ponut64:
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.

XL2:
The impact is mainly on SH2 as, as you said, we don't care about sound cpu usage since it doesn't do much.
The decompression is done in software.
Have you checked the SBL library to make sure it doesn't have the source code?
They also have the code for the sound cpus and drivers if I'm not mistaken.
AFAIK the compression ratio should be 1:4, which is quite nice.

ponut64:
Now I have a different problem.

Sega's documentation has stuff like this:

--- Code: ---
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);
--- End code ---

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?

ponut64:
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: ---
#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();

}


--- End code ---

i've also included some sample files

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Sitemap 1 2 3 4 5 6 7 8 9 10 
Go to full version