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 ... 4 5 [6] 7 8 ... 12
76
Interesting.

Tone editor can play the files as expected.
There is this error, though.

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

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

I really don't think there is anything wrong the files. The issue is most likely my code.
It crashes when I use PCM-GFS handle but gives Error 303 when I use PCM-Memory handle after GFS_Load.

I did find out the Sega tools expect the file to have the extension AIFF, I wonder if SBL is the same? No big deal, I can just not-shorten it to AIF, doesn't change anything.

77
I'm trying a different Mac emulator. Basilisk II maybe just doesn't work I DON'T KNOW

78
No, actually... I don't know what sound tool is relevant to this, and how to even open them.
The PCM to ADPCM (XA?) converter converts them and correctly reports their bitrate and such correctly, though that doesn't mean anything about what Saturn hardware would read.
Every program of "Sound tools" in the Macintosh section of the documentation site opens with errors.

From the documentation, it looks like they expect you to have a Saturn dev kit for any of it to work. Obviously I don't have one of those.

79
I'd like to share something that might be important.

Here is a structure to get some error codes:

Code: [Select]
PcmErrCode pcmsysErr = PCM_GetErr();
jo_printf(0, 19, "(%x)", pcmsysErr);
PCM_Task(pcm);

What could these codes be?

Code: [Select]
/* エラーコード	*/
typedef enum {
PCM_ERR_OK = 0x00000000,/* エラーは発生していない */

/* PCM_Create のエラー */
PCM_ERR_OUT_OF_HANDLE = 0x00000101,/* ハンドル売り切れ */
PCM_ERR_NO_INIT = 0x00000103,/* 初期化関数がコールされてない */

/* PCM_Destroy のエラー */
PCM_ERR_INVALID_HN = 0x00000201,/* 不正なハンドルで消去 */
PCM_ERR_ILL_CREATE_MODE = 0x00000202,/* Create 時のモードと違う */

/* pcm_HeaderProcess のエラー */
PCM_ERR_TOO_LARGE_HEADER = 0x00000302,/* ヘッダがき大すぎる */
/* (バッファサイズが小さすぎる) */
PCM_ERR_HEADER_DATA = 0x00000303,/* ヘッダデータエラー */
PCM_ERR_TOO_SMALL_PCMBUF = 0x00000304,/* PCMバッファサイズが小さすぎる */
PCM_ERR_ILL_SIZE_PCMBUF = 0x00000305,/* PCMバッファサイズ不正 4096*2~16 */
PCM_ERR_AFI_NO_COMMON = 0x00000306,/* CommonChunk が無い */
PCM_ERR_AFI_COMMPRESS = 0x00000307,/* 未対応圧縮タイプ */
PCM_ERR_NOT_DECLARE_ADPCM = 0x00000308,/* ADPCM使用宣言がない */

/*  */
PCM_ERR_ILLEGAL_PARA = 0x00000503,/* 引き数の指定が間違っている */
PCM_ERR_ILLEGAL_HANDLE = 0x00000504,/* ハンドルが異常 */

/* 連続再生に関するエラー */
PCM_ERR_NEXT_HN_STATUS = 0x00000601,/* 連続再生ハンドルの状態異常 */
PCM_ERR_NEXT_HN_AUDIO = 0x00000602,/* オーディオの条件が一致しない */
PCM_ERR_CHANGE_NO_ENTRY = 0x00000605,/* エントリがない状態でチェンジ */

/* ポーズに関するエラー */
PCM_ERR_PAUSE_STATUS = 0x00000701,/* PCM_STAT_PLAY_TIME, または、
* PCM_STAT_PLAY_PAUSE 以外の
* 状態でポーズ関数をコールした。
*/
PCM_ERR_PAUSE_WORK_NULL = 0x00000702,/* ポーズ処理用ワーク異常 */
PCM_ERR_PAUSE_WORK_SIZE = 0x00000703,/* ポーズ処理用ワーク異常 */
PCM_ERR_PAUSE_WORK_SET = 0x00000704,/* ポーズ処理用ワーク指定が不正*/

/* DMA転送に関するエラー */
PCM_ERR_DMA_MODE = 0x00000801,/* 未対応の転送方式 */
PCM_ERR_DMA_CPU_PCM = 0x00000802,/* DMAが異常終了 */

/* ファイル読み込みエラー */
PCM_ERR_GFS_READ = 0x00000901,/* GFSの読み込みで失敗 */

/* リングバッファへのデータ供給に関するエラー */
PCM_ERR_RING_SUPPLY = 0x00000a01,/* 再生完了後に供給があった    */
/* (供給が間に合わす中断した)*/

PCM_ERR_END
} PcmErrCode;

I am currently facing Error 303. Header data error. Hmm...
I wonder if... it's not reading the header correctly?
I wonder if... my files simply do not have the correct header data for the Saturn to read? Any period-correct (like Apple / Basilisk II compatible) WAV / MP3 to AIFF converters you guys know of?

80
Well I had a day where I couldn't work on it, so now I don't remember what did and what didn't produce 'results' with SBL.

But I would like to let nobody know that the code is still freezing at "PCM_Task".
Trying to use GFS handles with AIFF files.
I do know it is the handle because if I use a bad file-name, it doesn't get stuck (but obviously, it doesn't play sound).
So if I figure out what's crashing or freezing it, maybe I will get it to make sound.
--> And I am no longer using jo engine callback (though it doesn't behave differently with or without it so far)

81
AIFFs do play (not with 'my SBL' yet... may it be damned), they are formatted identically to Saturn PCM as far as I can tell. (They just have a header)
Using AIFFs is the simplest of any variety as far as converting the files.
But I have put in the SBL init functions and SGL still plays sound, so that should at least indicate that SBL would play sound whenever I actually got the stupid stuff to work.
SGL still doesn't play them back at the correct rate.

It's funny how the documentation says
Quote
The PCM-ADPCM Playback Library enables simplified playback of PCM audio on the
SEGA SATURN
Yes, "simplified"
I am humoring myself don't worry

82
Nevermind.

SGL seems completely unable to properly playback anything different from 44.1 KHz PCM. Nowhere can you set the bitrate...
That makes things extra difficult. It looks like I have to figure out the PCM-ADPCM SBL library, one way or another...
Why is sound such a pain in the ass?

thankfully, the Rockin' B might come to the rescue with Saturn Sound Player. It mixes SBL and SGL PCM libraries so he proves it's possible.

83
It's a pretty basic thing with code in C.
Create a struct for a ship.
Code: [Select]
typedef struct {

} ship;
Have it include the relevant sprites for a ship, including the destroyed sprite.
Have it also include states, like if the ship is destroyed or not.
From that bool, you can set it to display either the ship sprite or the explosion sprite.

Then, you can use something like
Code: [Select]
Sint32 curtime = jo_get_ticks();
whenever the condition for exploding the ship is called, and...
Code: [Select]
if(explodeShip != true){
//Display the normal ship sprite.
} else if(explodeShip == true){
//Display the explode sprite.
if(curtime > 99){
//Display an empty sprite.
}
}

84
My guess at this point is in order to use the SBL PCM-ADPCM library, you have to set up an SBL program (rather than an SGL program).
And that is much more complicated than SGL, since you must manage the system interrupts (like a DOS program, but worse).
That's something that will make a lot of other things break, so I am abandoning this quest.

I will post back here when I get PCM streaming under SGL working, though.
I am happy I could at least get some code to compile.


85
That's what I thought but I didn't know for sure.
I always assumed the A bus was slower than the system could process from, maybe it is maybe it isn't.

I will probably give up on SBL in a day or two but I will keep poking at it tomorrow

86
Just to update you and the specifications,

clearly with the Saturn having an X2 speed CD-ROM drive, the system should be able to handle up to about 5 KB per frame (at 30 FPS) (with a good quality CD and laser?).
I must have had a bad burn that made testing at 2048 bytes per frame cause slow-down. I just did another burn and it handled 2048 bytes per frame (at 30 FPS) without a hitch.
So we can do more than I thought.

87
That is a good catch that they are asking for number of samples. I know so little about audio files. What we need the number of samples for is to determine how long to play the file.

Changing
PCM_INFO_FILE_TYPE(&info) = PCM_FILE_TYPE_NO_HEADER;
to
PCM_INFO_FILE_TYPE(&info) = PCM_FILE_TYPE_AIFF;
makes the stream read more of the file specified, if that means anything.

I just haven't got it to make any sound so far.
AIFF or CDDA really is not an option ATM (unless I can 'accept' 6 KHz music..) because I need time free on the CD system.
Of course it's entirely possible I have the bandwidth capabilities of the CD system grossly underestimated, but I'm pretty sure we are working with somewhere in the realm of 768 bytes per frame (at 30 FPS). Program-controlled by GFS inside each program's frame of course. The idea is to get music files that can be read 256 bytes or less to get the sound in time each frame.

The reason that could be heavily understated is because the Saturn can obviously play 44.1KHz redbook audio.
I'm more concerned about A-bus/SH1 saturation, because of course the Saturn's CD-ROM is X2 speed and thus should be able to spit out around 5 KB per frame (300 KB/s).
Maybe I should just do more testing on the fetch speed.
Still it would be nice to get ADPCM to free up more time on the CD system to do other things.

/e: Okay, So. 2048 bytes per frame works. I do not know what was happening that made that slow-down at one point. Maybe a bad burn? Man, that makes things a lot faster.
I might be able to use 16 KHz mono PCM then.
I only estimate need of the CD for the following things:
- Area data (Level - paths - visibility - item data - etc)
- SFX (PCM at leisure, and needed much less often)
- ZTP (Binary model files and textures)
- Music

My plan has always been to segment these into different buffers that can have reads to them activated or deactivated at any time, with overlapping requests being simultaneous fetch, interleaved CD reads. I guess that is unncessarily complicated; it should all be interleaved reads & fetch, allowing every read data type to be using full bandwidth.

... I'm not giving up on pursuing SBL PCM though. I want it to make SOUND ! Sure, Jo engine can already do that...

88
It doesn't play sound, but the Stream program does work. I am assuming if SSF would do that, then real hardware would. (Because when SSF didn't, real hardware didn't even if other emulators did)

I really think since it isn't playing ANY sound right now, I am either setting up the PCM play info completely wrong (which is weird, since Sega samples set it up like that, but also they don't work when I compile them either! when sent at PCM or ADPCM files!) OR I am sending the stream to the wrong address. I really do not know where I am supposed to put the data to play it back as a PCM file.

I tell ya what, if SGL had ADPCM, that would be really sweet because SGL is a helluva lot simpler to work with than SBL so far. Better documentation, less verbose code.
Unfortunately I am stuck with SBL since even if I could grab an ADPCM decompression program (in C) off the 'net, the point is to be able to stream it from the CD in some fashion.
I did find a M68K decompression program but listen, I barely understand what a "while" loop is, let alone live program addresses between two different CPUs through the SCU and SCSP.

Also, for a fun way to annihilate your ears, use the jo engine audio demo to try and playback ADPCM files.
... It's not fun. Heh.

89
More posts

I'm not sure why the Stream library is working in Yabause and not working on real hardware or in SSF.
Clearly some of the commands are "getting through"
Still not getting any sound, by the way, but understanding the stream system would be first.
/e: It has something to do with the CD-ROM XA keys. So commenting out the one line with 0x04 ant at least the Stream works in SSF.
The documentation does say CD-ROM XA needs the CD to be formatted as Mode 2 Form 2... how would I format like that, or is it even relevant?

Code: [Select]
#ifndef __AUDIO_H__
#define __AUDIO_H__

#define RING_BUF_SIZE  (2048L*10)
#define PCM_ADDR  ((void*)0x25a20000)
#define PCM_SIZE  (4096L*2)

#define SMP_1TASK_SAMPLE (1024)
#define SMP_TR_MODE_CD (PCM_TRMODE_SCU)
#define SMP_LOAD_NUM (10)

#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:
//Apparently, this file is CD-ROM XA.
void adpcm_load(void){
/* Work  */
PcmWork  pcm_work;
PcmCreatePara para;
/* Ring Buffer  */
Uint32  ring_buf[RING_BUF_SIZE / sizeof(Uint32)];
// Handles
StmHn       stm;
PcmHn       pcm;
StmGrpHn stmfpcm;
StmKey key;
PcmInfo info;
Sint8* name = "SHELL.ADP";
Sint32 fid = GFS_NameToId(name);

//Data of read in process
Sint32 rdsize;

/* Set Interrupt Process */
// Use
 // INT_???
// and set V-Blank IN interrupt.
// Call
 // PCM_VblIn();
// within V-Blank IN interrupt.

/* File initialization */
stmfpcm = STM_OpenGrp();
STM_SetExecGrp(stmfpcm);
STM_KEY_FN(&key) = STM_KEY_CN(&key) = STM_KEY_SMMSK(&key) =
STM_KEY_SMVAL(&key) = STM_KEY_CIMSK(&key) = STM_KEY_CIVAL(&key) =
STM_KEY_NONE;
//FOR CDROM XA
STM_KEY_SMMSK(&key) = STM_KEY_SMVAL(&key) = 0x04;/* Audio Sector */
STM_KEY_CN(&key) = 0; /* channel No. */

/* Open Stream */
stm = STM_OpenFid(stmfpcm, fid, &key, STM_LOOP_NOREAD);

/* 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;
pcm = PCM_CreateStmHandle(&para, stm);
//SET PCM INFO FOR ADPCM
PCM_INFO_FILE_TYPE(&info) = PCM_FILE_TYPE_NO_HEADER;
PCM_INFO_DATA_TYPE(&info) = PCM_DATA_TYPE_ADPCM_SCT;
PCM_SetVolume(pcm, 7);
PCM_SetInfo(pcm, &info);
PCM_SetLoadNum(pcm, SMP_LOAD_NUM);
PCM_SetTrModeCd(pcm, SMP_TR_MODE_CD);
PCM_Set1TaskSample(pcm, SMP_1TASK_SAMPLE);
PCM_ChangePcmPara(pcm);
/* Start Playback */
PCM_Start(pcm);
while(TRUE) {
STM_ExecServer();
rdsize = STM_GetNumCdbuf(stm);
jo_printf(0, 0, "(%i)", rdsize);
/* Playback task processing */
PCM_Task(pcm);
/* End condition */
if (PCM_GetPlayStatus(pcm) == PCM_STAT_PLAY_END) break;
if(jo_is_pad1_key_pressed(JO_KEY_A)){
break;
}
}
/* Destroy Handle */
PCM_DestroyStmHandle(pcm);
/* Close stream */
STM_Close(stm);
/* End Processing */
PCM_Finish();

}


/e: You can add these, it doesn't seem to care. I might get somewhere in a few years.

Code: [Select]
info.sampling_rate = 18900;
info.sampling_bit = 16;
info.channel = 1;
info.sample_file = 1;

More /e:

Frankly I don't even know where the data from the stream is going.
STM_SetTrBuf(stm, ring_buf, 2048, RING_BUF_SIZE);
doesn't seem to change anything.

Also, thank you again for clarifying that encoder is for XA audio. It IS headerless...

90
https://youtu.be/GD6qtc2_AQA

I am learned.

I didn't know that was the XA Audio encoder. It makes sense that it would be, it's the only one there, and they say the other one is from a 3rd party.
I'll have to move forward with SBL Stream system then!
I DID try that at one point, but it didn't work, but there's probably quite a few more reasons why it wouldn't that are explained since I need to figure out the stream library too.
And the header stuff. They say it should be filled in by the subheader?
Also, 22KHz ADPCM should not be possible with CD-XA. I'll have to re-do at 18.9 KHz right? (that only takes about 30 seconds)

Also, where's that other ADPCM encoder they mentioned?

More /e: There is a sample program for Stream playback, that's very good.
smppcm5.c in SBL

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