• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguiwindowsc翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

BASIC compiler/interpreter for PIC32MX/MZ-80K (suspended)


コミットメタ情報

リビジョン264 (tree)
日時2018-07-30 08:45:42
作者kmorimatsu

ログメッセージ

Stop music after running code, implement PLAYWAVE() function, stop music when null string for PLAYWAVE statement.

変更サマリ

差分

--- mips/branches/zoea/editor.c (revision 263)
+++ mips/branches/zoea/editor.c (revision 264)
@@ -2142,6 +2142,7 @@
21422142 while(vkey!=0);
21432143 ps2mode(); //キーボード有効化
21442144 inputchar(); //1文字入力待ち
2145+ stop_music(); //音楽再生停止
21452146 init_composite(); //パレット初期化のため画面初期化
21462147 //画面モードを戻す
21472148 if(widthmode==WIDTH_X1) set_width(0);
--- mips/branches/zoea/envspecific.c (revision 263)
+++ mips/branches/zoea/envspecific.c (revision 264)
@@ -18,7 +18,7 @@
1818 */
1919
2020 void pre_run(){
21- // TODO
21+ // Currently, do nothing.
2222 }
2323
2424 void post_run(){
--- mips/branches/zoea/music.c (revision 263)
+++ mips/branches/zoea/music.c (revision 264)
@@ -78,7 +78,7 @@
7878
7979 static char g_sound_mode=0;
8080 static FSFILE* g_fhandle=0;
81-static char* g_wavtable;
81+static char* g_wavtable=0;
8282
8383 #define SOUND_MODE_MUSIC 1
8484 #define SOUND_MODE_WAVE 2
@@ -87,8 +87,19 @@
8787 #define stop_dma() T4CONCLR=0x8000; DCH2CONCLR=0x00000080; g_sound_mode=SOUND_MODE_MUSIC
8888
8989 int waveRemaining(int mode){
90- // TODO
91- return 0;
90+ if (!g_fhandle) return 0;
91+ switch(mode){
92+ case 1: // current position (header excluded)
93+ return g_fhandle->seek-0x2c;
94+ break;
95+ case 2: // file size (header excluded)
96+ return g_fhandle->size-0x2c;
97+ break;
98+ case 0: // remaining
99+ default:
100+ return g_fhandle->size-g_fhandle->seek;
101+ break;
102+ }
92103 }
93104 int musicRemaining(int flagsLR){
94105 // flagsLR is ignored
@@ -223,8 +234,7 @@
223234 // Enable DMA, stop DMA2
224235 DMACONSET=0x8000;
225236 DCH2CONCLR=0x0080;
226- // Disable buffer
227- g_var_size[ALLOC_WAVE_BLOCK]=0;
237+
228238 // Close handle if open.
229239 if (g_fhandle) FSfclose(g_fhandle);
230240 g_fhandle=0;
@@ -587,14 +597,13 @@
587597 }
588598
589599 void play_wave(char* filename, int start){
590- // TODO: Implement start parameter
591600 int i;
592601 // Stop the previous play
593- T3CONCLR=0x8000;
594- T4CONCLR=0x8000;
595- DCH2CONCLR=0x0080;
596- g_musicstart=g_musicend=g_musicwait=g_soundstart=g_soundend=g_soundwait=g_soundrepeat=0;
597-
602+ stop_music();
603+ // Exit function if null filename
604+ if (filename[0]==0x00) {
605+ return;
606+ }
598607 // Alocate 524 byte buffer if not assigned
599608 if (g_var_size[ALLOC_WAVE_BLOCK]==0) {
600609 g_wavtable=(char*)alloc_memory(524/4,ALLOC_WAVE_BLOCK);
@@ -620,6 +629,8 @@
620629 }
621630 i+=checkChars((char*)&g_wavtable[34],"\x08\x00\x64\x61\x74\x61",6); // Check bit # and data
622631 if (i) err_wave();
632+ // Support defined start position here to skip file pointer here.
633+ FSfseek(g_fhandle, start, SEEK_CUR);
623634 // Read first 262 bytes.
624635 if (262 != FSfread((void*)&g_wavtable[0],1,262,g_fhandle)) err_file();
625636
@@ -631,14 +642,7 @@
631642
632643 /*
633644 TODO:
634- 1) divide routines into WAVE and MUSIC modes
635- 2) Initializing envionment (DMA, OC etc) is required for both modes.
636- 3) Insert WAVE mode into the inturrput function.
637- 4) Reset envionment after ending WAVE/MUSIC
638- 5) Consider when initialize WAVE and MUSIC. Currently, MUSIC is initialized in run.c
639- 6) Consider error or replace for starting WAVE/MUSIC when MUSIC/WAVE is running.
640645
641-
642646 Around init_music and init_wave
643647 Init_music also initialize tone and key. These must be done only when starting BASIC program.
644648 Create stop_music. This stops all MUSIC/SOUND/PLAYWAVE-initialized sound effects, and