home *** CD-ROM | disk | FTP | other *** search
- #include <method\methodSx.h>
- #include <sxlib.h>
- #include "pcm8pp.h"
- #include "spsx.h"
-
- remote extern stPlayList_t stPlayList; /* 再生ファイルの一覧の構造体 */
- extern int iPlayMode;
-
- uchar acFileName[256]; /* 再生ファイル名 */
- int iPlayFlag; /* 再生フラグ(1曲)( 0:再生終了 1:再生中) */
- int iIsPlaying; /* 再生フラグ(全体) */
-
- int iPlayTrack;
- uchar *pcPlayTitle;
-
- /* 操作ボタン用イメージのポインタ */
- extern rectImg **pImgPlayButton; /* 再生ボタン */
- extern rectImg **pImgStopButton; /* 停止ボタン */
- extern rectImg **pImgNextButton; /* 次曲ボタン */
- extern rectImg **pImgBeforeButton; /* 前曲ボタン */
- extern rectImg **pImgRandomButton; /* ランダムボタン */
- extern rectImg **pImgPauseButton; /* 一時停止ボタン */
- extern rectImg **pImgRestartButton; /* 再開ボタン */
- extern rectImg **pImgDisRndButton; /* ランダム取り消しボタン */
- extern rectImg **pImgPushPlayButton; /* 再生ボタンを押した状態 */
- extern rectImg **pImgPushStopButton; /* 停止ボタンを押した状態 */
- extern rectImg **pImgPushNextButton; /* 次曲ボタンを押した状態 */
- extern rectImg **pImgPushBeforeButton; /* 前曲ボタンを押した状態 */
- extern rectImg **pImgPushRndButton; /* ランダムボタンを押した状態 */
- extern rectImg **pImgPushPauseButton; /* 一時停止ボタンを押した状態 */
- extern rectImg **pImgPushRestartButton; /* 再開ボタンを押した状態 */
- extern rectImg **pImgPushDisRndButton; /* ランダム取り消しボタンを押した状態 */
-
-
- extern rectImg **pImageH[5]; /* イメージボタン配列(通常ボタン) */
- extern rectImg **pImageL[5]; /* (押されている時) */
-
- extern method_t mCtrlButton;
-
- extern job_t jobPcmPlay;
-
- int iPlayCtrlMain(tsevent *ts);
- int iPlayCtrlInit(tsevent *ts);
- int iPlayCtrlEnd(tsevent *ts);
- int iPlayCtrlPause(tsevent *ts);
- int iPlayCtrlRestart(tsevent *ts);
-
- job_t jobPlayCtrl = {
- NULL,
- iPlayCtrlMain,
- iPlayCtrlInit,
- iPlayCtrlEnd,
- iPlayCtrlPause,
- iPlayCtrlRestart,
- 0 };
-
-
- int iPlayCtrlMain(tsevent *ts)
- {
- int i;
-
- if ( iPlayFlag == 0 ) {
- if ( stPlayList.iPlayCount < stPlayList.iMusicCount) {
-
- if ( iPlayMode == PLAY_RANDOM ) {
- i = rand() % stPlayList.iMusicCount;
- while ( stPlayList.pstPlayList[i].iPlayFlag ) {
- i = rand() % stPlayList.iMusicCount;
- }
- stPlayList.pstPlayList[i].iPlayFlag = 1;
- }
- else {
- i = stPlayList.iPlayingNo;
- }
-
- strcpy(acFileName,stPlayList.pstPlayList[i].acFileName);
-
- iPlayFlag = 1;
-
- ChainAJob(0,&jobPcmPlay);
-
- stPlayList.iPlayCount++;
- stPlayList.iPlayingNo = i + 1;
-
- iPlayTrack = i + 1;
- iDrawTrack();
-
- pcPlayTitle = stPlayList.pstPlayList[i].acTitle;
- iDrawTitle();
- }
- else {
- UnchainJob();
- return 0;
- }
- }
-
- return 0;
- }
-
- int iPlayCtrlInit(tsevent *ts)
- {
- int i;
-
- pImageH[0] = pImgPauseButton;
- pImageL[0] = pImgPushPauseButton;
- DrawAPM(&mCtrlButton,0);
- iPlayFlag = 0;
-
-
- for ( i = 0; i < stPlayList.iMusicCount; i++ ) {
- stPlayList.pstPlayList[i].iPlayFlag = 0;
- }
-
-
- return 0;
- }
-
- int iPlayCtrlEnd(tsevent *ts)
- {
-
- iPlayFlag = 0;
- iIsPlaying = 0;
-
- pImageH[0] = pImgPlayButton;
- pImageL[0] = pImgPushPlayButton;
- DrawAPM(&mCtrlButton,0);
-
- iPlayMode = PLAY_NORMAL;
-
-
- if ( stPlayList.iMusicCount > 0 ) {
- iPlayTrack = 1;
- pcPlayTitle = stPlayList.pstPlayList[0].acTitle;
- }
- else {
- iPlayTrack = 0;
- pcPlayTitle = NULL;
- }
-
- iDrawTrack();
- iDrawTitle();
-
- stPlayList.iPlayCount = 0;
- stPlayList.iPlayingNo = 0;
-
- return 0;
- }
-
- int iPlayCtrlPause(tsevent *ts)
- {
- SleepJob(&jobPcmPlay);
- pImageH[0] = pImgRestartButton;
- pImageL[0] = pImgPushRestartButton;
- DrawAPM(&mCtrlButton,0);
-
- return 0;
- }
-
- int iPlayCtrlRestart(tsevent *ts)
- {
- AwakeJob(&jobPcmPlay);
- pImageH[0] = pImgPauseButton;
- pImageL[0] = pImgPushPauseButton;
- DrawAPM(&mCtrlButton,0);
-
- return 0;
- }