Subversion Repositories Kolibri OS

Rev

Rev 1843 | Rev 3533 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1843 Rev 3495
Line 62... Line 62...
62
int pan =0;
62
int pan =0;
Line 63... Line 63...
63
 
63
 
64
DWORD status;
64
DWORD status;
65
DWORD first_sync;
65
DWORD first_sync;
-
 
66
DWORD PLStatus=0; //Asper+
-
 
67
byte replay=0;
Line 66... Line 68...
66
DWORD PLStatus=0; //Asper+
68
byte hidden=0;
67
 
69
 
68
#ifdef DOCKABLE_WINDOW
70
#ifdef DOCKABLE_WINDOW
Line 90... Line 92...
90
char header[] = "AC97 MP3 player";
92
char header[] = "AC97 MP3 player";
91
char header_PL[] = "PLAYLIST";
93
char header_PL[] = "PLAYLIST";
92
char buttons_xm[]  = " Play    Stop                    Vol-    Vol+"; /* uFMOD integration */
94
char buttons_xm[]  = " Play    Stop                    Vol-    Vol+"; /* uFMOD integration */
93
char buttons_wav[] = " Play    Stop     <<      >>     Vol-    Vol+"; /* uFMOD integration */
95
char buttons_wav[] = " Play    Stop     <<      >>     Vol-    Vol+"; /* uFMOD integration */
94
char button_PL[] = "PL"; //Asper+
96
char button_PL[] = "PL"; //Asper+
-
 
97
char button_R[] = "R"; //Asper+
95
char *buttons_text = buttons_wav;                                     /* uFMOD integration */
98
char *buttons_text = buttons_wav;                                     /* uFMOD integration */
Line 96... Line 99...
96
 
99
 
97
void play_xm();                                                       /* uFMOD integration */
100
void play_xm();                                                       /* uFMOD integration */
Line 221... Line 224...
221
                 case 0x01:  //Esc
224
                 case 0x01:  //Esc
222
					 PLStatus=0x00;
225
					 PLStatus=0x00;
223
					 exit();
226
					 exit();
224
					 break;
227
					 break;
Line -... Line 228...
-
 
228
 
-
 
229
				 case 0x19: //P - playlist
-
 
230
				   switch (PLStatus)
-
 
231
				   {    case 0x00: //PL not started.
-
 
232
							pl_tid=create_thread(pl_thread_proc, 0, 4096);              
-
 
233
							PLStatus=0x12;
-
 
234
						break;
-
 
235
						case 0x01: //PL started, but hidden.
-
 
236
							PLStatus=0x12;
-
 
237
						break;
-
 
238
						case 0x02: //PL started and showed.
-
 
239
							PLStatus=0x11;
-
 
240
						break;
-
 
241
				   }
-
 
242
				   break;
225
 
243
 
226
				 case 0x1C:  //Enter                   
244
				 case 0x1C:  //Enter                   
227
					 currActive=currFirstShowed+currSelected-1;
245
					 currActive=currFirstShowed+currSelected-1;
228
					 status = ST_TRACK; 
246
					 status = ST_TRACK; 
-
 
247
					 break; 
-
 
248
 
-
 
249
				 case 0x2C: //Z - previous
-
 
250
				   currActive-=2;
-
 
251
				   status = ST_TRACK;
-
 
252
				   break;
-
 
253
				 
-
 
254
				 case 0x2D: //X - play
-
 
255
				   status = ST_PLAY;
-
 
256
				   break;
-
 
257
				 
-
 
258
				 case 0x2E: //C - pause
-
 
259
				   break;
-
 
260
				 
-
 
261
				 case 0x2F: //V - stop
-
 
262
                   status = ST_STOP;
-
 
263
				   break;
-
 
264
				 
-
 
265
				 case 0x30: //B - next
-
 
266
				   status = ST_TRACK;
-
 
267
				   break;
229
					 break; 
268
 
230
                 case 0x47:  //Home
269
                 case 0x47:  //Home
231
					 if(l_vol < 0)
270
					 if(l_vol < 0)
232
					 { l_vol+=100;
271
					 { l_vol+=100;
233
					   r_vol+=100;  
272
					   r_vol+=100;  
Line 237... Line 276...
237
                 case 0x48:  //Up
276
                 case 0x48:  //Up
238
					 if (currSelected==0) 
277
					 if (currSelected==0) 
239
					 {
278
					 {
240
						 if (currFirstShowed>0)
279
						 if (currFirstShowed>0)
241
							 currFirstShowed--;
280
							 currFirstShowed--;
-
 
281
						 else break;
242
						 ShowPLContent(pl_buff);
282
						 ShowPLContent(pl_buff);
243
						 break;
283
						 break;
244
					 }
284
					 }
245
					 currSelected--;
285
					 currSelected--;
246
					 ShowPLContent(pl_buff);
286
					 ShowPLContent(pl_buff);
Line 287... Line 327...
287
		  if (button==1)
327
		  if (button==1)
288
		  {
328
		  {
289
			  PLStatus=0x00;
329
			  PLStatus=0x00;
290
			  exit();
330
			  exit();
291
		  }
331
		  }
292
		  for (i=0;i
-
 
293
		  {
-
 
294
			  if (button==0x10+i)
-
 
295
			  {
-
 
296
				  currActive=currFirstShowed+i-1;
332
		  currActive=currFirstShowed+button-0x10-1;
297
				  status = ST_TRACK; 
333
		  status = ST_TRACK; 
298
				  break;
334
		  break;
299
			  }
-
 
300
		  }
-
 
301
		  break;
-
 
302
	  case EV_IPC:
335
	  case EV_IPC:
303
  		  *ipc_buff='\0';
336
  		  *ipc_buff='\0';
304
		  ShowPLContent(pl_buff);
337
		  ShowPLContent(pl_buff);
305
		  break;
338
		  break;
Line 342... Line 375...
342
		ch=plbuff[i];
375
		ch=plbuff[i];
343
		if (ch!='#' && i && plbuff[i-1]=='\n')
376
		if (ch!='#' && i && plbuff[i-1]=='\n')
344
			count++;
377
			count++;
345
		if (count-1==index) 
378
		if (count-1==index)
346
		{
379
		{
347
			if (j>MAX_TEXT_WIDTH || ch=='\n')
380
			if (j>MAX_TEXT_WIDTH || ch=='\r' || ch=='\n')
348
			{
381
			{
349
				name[j-1]='\0';
382
				name[j]='\0';
350
				break;
383
				break;
351
			}
384
			}
352
			if (ch=='\\') ch='/';
385
			if (ch=='\\') ch='/';
353
			name[j++]=ch;
386
			name[j++]=ch;
354
		}
387
		}
Line 395... Line 428...
395
		write_text(11,i*(PLI_BUTTON_HEIGHT+1)+27,text_color, st, len);
428
		write_text(11,i*(PLI_BUTTON_HEIGHT+1)+27,text_color, st, len);
396
	}
429
	}
397
	return 1;
430
	return 1;
398
}
431
}
399
//Asper_____________________Play List code end_____________________________ 
432
//Asper_____________________Play List code end_____________________________ 
-
 
433
void redraw_R_button() //Asper +
-
 
434
{
-
 
435
	DWORD rc = 0xA0FFA0; //R button text color
-
 
436
	if (!replay) rc = 0x404040;
-
 
437
	write_text(14,74,rc|FONT0,button_R,sizeof(button_R)-1);
-
 
438
}
Line 400... Line 439...
400
 
439
 
401
void update_dinamic_content() //Asper +
440
void update_dinamic_content() //Asper +
402
{
441
{
-
 
442
	int len = strlen(filename);
403
	int len;                                                          /* uFMOD integration */
443
	if (len > 47) len = 47;
404
	draw_bar(7,41,286,11,main_wc);
-
 
405
	
444
	draw_bar(7,41,286,11,main_wc);
406
	draw_bar(7,55,286,11,main_wc);
-
 
407
	len = strlen(filename);                                                /* uFMOD integration */
-
 
408
	if(len > 47) len = 47;                                              /* uFMOD integration */
445
	draw_bar(7,55,286,11,main_wc);
409
	write_text(11,57,0x00FF20|FONT0, filename, len);                        /* uFMOD integration */
446
	write_text(11,57,0x00FF20|FONT0, filename, len);
Line 410... Line 447...
410
}
447
}
411
 
448
 
412
void draw_window()
449
void draw_window()
-
 
450
{
413
{
451
   BeginDraw();
414
   BeginDraw();
452
   if (!hidden)
Line 415... Line 453...
415
 
453
   {
416
   DrawWindow(100,100,299,main_wh,main_wc,4,0,0,0); //Asper+   
454
      DrawWindow(100,100,299,main_wh,main_wc,4,0,0,0); //Asper+   
417
 
455
 
418
   make_button(7,24,45,13, 0x10|BT_NORMAL,main_bc);
456
      make_button(7,24,45,13, 0x10|BT_NORMAL,main_bc);
419
   make_button(56,24,45,13, 0x11|BT_NORMAL,main_bc);
457
      make_button(56,24,45,13, 0x11|BT_NORMAL,main_bc);
420
   make_button(104,24,45,13, 0x12|BT_NORMAL,main_bc);
458
      make_button(104,24,45,13, 0x12|BT_NORMAL,main_bc);
Line 421... Line 459...
421
   make_button(152,24,45,13, 0x13|BT_NORMAL,main_bc);
459
      make_button(152,24,45,13, 0x13|BT_NORMAL,main_bc);
-
 
460
      make_button(200,24,45,13, 0x14|BT_NORMAL,main_bc);
Line 422... Line 461...
422
   make_button(200,24,45,13, 0x14|BT_NORMAL,main_bc);
461
      make_button(248,24,45,13, 0x15|BT_NORMAL,main_bc);
Line 423... Line 462...
423
   make_button(248,24,45,13, 0x15|BT_NORMAL,main_bc);
462
 
424
 
463
      make_button(268,70,25,13, 0x16|BT_NORMAL,main_bc); //Asper+ PL button
425
   make_button(268,70,25,13, 0x16|BT_NORMAL,main_bc); //Asper+ PL button
464
      make_button(10,70,12,13, 0x17|BT_NORMAL,main_wc); //Asper+ R button
426
 
465
 
Line 427... Line 466...
427
   make_button(7,41,286,11, 0x30|BT_HIDE|BT_NOFRAME,main_wc);
466
      make_button(7,41,286,11, 0x30|BT_HIDE|BT_NOFRAME,main_wc);
428
 
467
 
-
 
468
      update_dinamic_content();
-
 
469
      write_text(8,8,FONT0, header, sizeof(header)-1);                     /* uFMOD integration */
429
   update_dinamic_content();
470
      write_text(12,28,main_wc|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
430
   write_text(8,8,FONT0, header, sizeof(header)-1);                     /* uFMOD integration */
471
      write_text(11,27,0xA0FFA0|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
Line 431... Line 472...
431
   write_text(12,28,main_wc|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
472
 
432
   write_text(11,27,0xA0FFA0|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
473
      write_text(276,74,main_wc|FONT0,button_PL,sizeof(button_PL)-1); //Asper+ PL button text
Line 622... Line 663...
622
int main(int argc, char *argv[])
663
int main(int argc, char *argv[])
623
{
664
{
624
   int err, ver;
665
   int err, ver;
625
   int i;
666
   int i;
626
   char ipc_msg[2]="\0\0";
667
   char ipc_msg[2]="\0\0";
-
 
668
   pl_items_number=0;
Line -... Line 669...
-
 
669
 
-
 
670
   if (argv[1][0]=='-' && argv[1][1]=='h')
-
 
671
   {
-
 
672
      hidden = 1;
-
 
673
	  argv[1]+=3;
627
    
674
   }
628
   strcpy (full_filename, argv[1]);
-
 
Line 629... Line 675...
629
   pl_items_number=0;
675
   strcpy (full_filename, argv[1]);
Line 630... Line 676...
630
    
676
   
631
   InitHeap(1024*1024);
677
   InitHeap(1024*1024);
Line 661... Line 707...
661
			if (LoadTrack(++currActive))
707
			if (LoadTrack(++currActive))
662
			{
708
			{
663
				if (LoadFile(full_filename))
709
				if (LoadFile(full_filename))
664
					status = ST_PLAY;
710
					status = ST_PLAY;
665
			}
711
			}
-
 
712
			else 
-
 
713
			{
-
 
714
				currSelected=currFirstShowed=0;
-
 
715
				currActive=-1;
666
			else status = ST_STOP;
716
				if (!replay) status = ST_STOP;
-
 
717
				continue;
-
 
718
			}
Line 667... Line 719...
667
 
719
 
668
			//Update ac97snd and PL windows
720
			//Update ac97snd and PL windows
669
			i=currActive-currFirstShowed;
721
			i=currActive-currFirstShowed;
670
			if (i>PL_MAX_SHOWN_ITEMS-1)
722
			if (i>PL_MAX_SHOWN_ITEMS-1)
Line 902... Line 954...
902
                 case 0x01:  //Esc
954
                 case 0x01:  //Esc
903
                   status = ST_EXIT;
955
                   status = ST_EXIT;
904
                   exit();
956
                   exit();
905
                   break;
957
                   break;
Line -... Line 958...
-
 
958
               
-
 
959
				 case 0x13: //R - repeat on/off
-
 
960
				   replay=!replay;
-
 
961
				   redraw_R_button();
-
 
962
				   break;
-
 
963
 
-
 
964
				 case 0x19: //P - playlist
-
 
965
				   switch (PLStatus)
-
 
966
				   {    case 0x00: //PL not started.
-
 
967
							pl_tid=create_thread(pl_thread_proc, 0, 4096);              
-
 
968
							PLStatus=0x12;
-
 
969
						break;
-
 
970
						case 0x01: //PL started, but hidden.
-
 
971
							PLStatus=0x12;
-
 
972
						break;
-
 
973
						case 0x02: //PL started and showed.
-
 
974
							PLStatus=0x11;
-
 
975
						break;
-
 
976
				   }
-
 
977
				   break;
-
 
978
 
-
 
979
				 case 0x2C: //Z - previous
-
 
980
				   currActive-=2;
-
 
981
				   status = ST_TRACK;
-
 
982
				   break;
-
 
983
				 
-
 
984
				 case 0x2D: //X - play
-
 
985
				   status = ST_PLAY;
-
 
986
				   break;
-
 
987
				 
-
 
988
				 case 0x2E: //C - pause
-
 
989
				   break;
-
 
990
				 
-
 
991
				 case 0x2F: //V - stop
-
 
992
                   status = ST_STOP;
-
 
993
				   break;
-
 
994
				 
-
 
995
				 case 0x30: //B - next
-
 
996
				   status = ST_TRACK;
-
 
997
				   break;
906
               
998
 
907
                 case 0x47:  //Home
999
				 case 0x47:  //Home
908
                   if(l_vol < 0)
1000
                   if(l_vol < 0)
909
                   { l_vol+=100;
1001
                   { l_vol+=100;
910
                     r_vol+=100;  
1002
                     r_vol+=100;  
Line 942... Line 1034...
942
             exit();
1034
             exit();
943
             break;
1035
             break;
Line 944... Line 1036...
944
             
1036
             
945
           case 0x10:
1037
           case 0x10:
946
             status = ST_PLAY;
1038
             status = ST_PLAY;
Line 947... Line 1039...
947
             continue;
1039
             break;//continue;
948
 
1040
 
949
           case 0x11:
1041
           case 0x11:
950
             status = ST_STOP;
1042
             status = ST_STOP;
Line 985... Line 1077...
985
					case 0x02: //PL started and showed.
1077
					case 0x02: //PL started and showed.
986
						PLStatus=0x11;
1078
						PLStatus=0x11;
987
					break;
1079
					break;
988
			   }
1080
			   }
989
            break;
1081
            break;
-
 
1082
           case 0x17: //Asper+ PL button action
-
 
1083
			   replay=!replay;
-
 
1084
			   redraw_R_button();
-
 
1085
            break;
Line 990... Line 1086...
990
 
1086
 
991
           case 0x30:
1087
           case 0x30:
992
            if(status==ST_DONE)
1088
            if(status==ST_DONE)
993
              break;
1089
              break;
Line 1180... Line 1276...
1180
 
1276
 
Line 1181... Line 1277...
1181
//Asper+_______end strings routines___________________
1277
//Asper+_______end strings routines___________________
1182
 
1278
 
1183
 
1279
 
1184
///*********
1280
///*********
Line 1185... Line 1281...
1185
void *__cdecl memmove ( void * dst, const void * src, unsigned int count)  /* uFMOD integration */
1281
void *memmove ( void * dst, void * src, unsigned int count)  /* uFMOD integration */
1186
{ void *ret;
1282
{ void *ret;