Figure 3.1 Playback procedure during stream playback
#define RING_BUF_SIZE (2048L*10) #define PCM_ADDR ((void*)0x25a20000) #define PCM_SIZE (4096L*2) /* work */ PcmWork pcm_work; /* ring buffer */ Uint32 ring_buf[RING_BUF_SIZE / sizeof(Uint32)]; StmHn stm; PcmHn pcm; /* Initialize sound */ SND_Init(・・); /* Initialization */ PCM_Init(); /* ADPCM usage declaration (required when using ADPCM) */ PCM_DeclareUseAdpcm(); /* Interrupt handling settings */ Set the V blank IN interrupt using INT_???. Call PCM_VblIn(); within the V blank IN interrupt. /* File initialization */ GFS_Init(・・); STM_Init(・・); STM_OpenGrp(); STM_SetExecGrp(・・); /* Open stream */ stm = STM_OpenFid(・・); /* Generate 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); /* Start playing */ PCM_Start(pcm); while(TRUE) { /* Run the server */ STM_ExecServer(); /* Playback task processing */ PCM_Task(pcm); /* End judgment */ if (PCM_GetPlayStatus(pcm) == PCM_STAT_PLAY_END) break; } /* Abandoning handle */ PCM_DestroyStmHandle(pcm); /* Close stream */ STM_Close(stm); /* End processing */ PCM_Finish();