After looking at your code I noticed a few things off about it. So I made some adjustments to it. Please review it.
#ifndef __AUDIO_H__
#define __AUDIO_H__
#define SECTOR_SIZE (2324L)
#define RING_BUF_SIZE (2324L*10)
#define PCM_ADDR ((void*)0x25a20000)
#define PCM_SIZE (4096L*4)
#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(¶) = &pcm_work;
PCM_PARA_RING_ADDR(¶) = ring_buf;
PCM_PARA_RING_SIZE(¶) = RING_BUF_SIZE;
PCM_PARA_PCM_ADDR(¶) = PCM_ADDR;
PCM_PARA_PCM_SIZE(¶) = PCM_SIZE;
pcm = PCM_CreateStmHandle(¶, stm);
//SET PCM INFO FOR ADPCM
typedef struct {
PCM_INFO_FILE_TYPE;
PCM_INFO_DATA_TYPE;
// Sint32 file_size; how big is your file in bytes?
// Sint32 channel; how many channels does your file have? '1' if mono '2' if stereo.
// Sint32 sampling_bit; based on your comment I think this is 16.
// Sint32 sampling_rate; in your case this is 18900.
// Sint32 sample_file; I think this is asking for how many samples are in your file. In order to check this
// use a program like audacity.
// Sint32 compression_type; I don't actually know what this is asking for and have no idea what to put here.
} PcmInfo;
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();
}
Also if ADPCM doesn't work out for you in the end I'd probably just try to play AIFF files(Seems a lot easier to play compared to ADPCM) or even CD-DA files if your project allows it.