1 /*  MikMod module player
2 	(c) 1998 - 2000 Miodrag Vallat and others - see file AUTHORS for
3 	complete list.
4 
5 	This program is free software; you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation; either version 2 of the License, or
8 	(at your option) any later version.
9 
10 	This program is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with this program; if not, write to the Free Software
17 	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 	02111-1307, USA.
19 */
20 
21 /*==============================================================================
22 
23   $Id: mlist.h,v 1.1.1.1 2004/01/16 02:07:37 raph Exp $
24 
25   Playlist management functions
26 
27 ==============================================================================*/
28 
29 #ifndef MLIST_H
30 #define MLIST_H
31 
32 #include <mikmod.h> /* for BOOL and CHAR */
33 
34 #define PL_CONT_NEXT (1)
35 #define PL_CONT_PREV (2)
36 #define PL_CONT_POS  (3)
37 
38 #define PM_MODULE  (1)			/* Module repeatly */
39 #define PM_MULTI   (2)			/* PlayList repeatly */
40 #define PM_SHUFFLE (4)			/* shuffle PlayList */
41 #define PM_RANDOM  (8)			/* PlayList in random order */
42 
43 #define PL_IDENT "MikMod playlist\n"
44 
45 typedef struct {
46 	CHAR *file;
47 	CHAR *archive;
48 	int time;
49 	BOOL played;
50 } PLAYENTRY;
51 
52 typedef struct {
53 	PLAYENTRY *entry;
54 	int length;
55 	int current;
56 	BOOL curr_deleted;
57 	int add_pos;
58 } PLAYLIST;
59 
60 extern PLAYLIST playlist;
61 
62 BOOL PL_isPlaylistFilename(const CHAR *filename);
63 void PL_InitList(PLAYLIST * pl);
64 void PL_InitCurrent(PLAYLIST * pl);
65 void PL_ClearList(PLAYLIST * pl);
66 
67 BOOL PL_CurrentDeleted(PLAYLIST * pl);
68 
69 int PL_GetCurrentPos(PLAYLIST * pl);
70 PLAYENTRY *PL_GetCurrent(PLAYLIST * pl);
71 PLAYENTRY *PL_GetEntry(PLAYLIST * pl, int number);
72 int PL_GetLength(PLAYLIST * pl);
73 void PL_SetTimeCurrent(PLAYLIST * pl, long sngtime);
74 void PL_SetPlayedCurrent(PLAYLIST * pl);
75 
76 BOOL PL_DelEntry(PLAYLIST * pl, int number);
77 BOOL PL_DelDouble(PLAYLIST * pl);
78 void PL_Add(PLAYLIST * pl, const CHAR *file, const CHAR *arc, int time, BOOL played);
79 void PL_StartInsert(PLAYLIST * pl, int pos);
80 void PL_StopInsert(PLAYLIST * pl);
81 
82 BOOL PL_Load(PLAYLIST * pl, const CHAR *filename);
83 BOOL PL_Save(PLAYLIST * pl, const CHAR *filename);
84 char *PL_GetFilename(void);
85 BOOL PL_LoadDefault(PLAYLIST * pl);
86 BOOL PL_SaveDefault(PLAYLIST * pl);
87 
88 /* Get new playlist entry and change current accordingly */
89 BOOL PL_ContNext(PLAYLIST * pl, CHAR **retfile, CHAR **retarc, int mode);
90 BOOL PL_ContPrev(PLAYLIST * pl, CHAR **retfile, CHAR **retarc);
91 BOOL PL_ContPos(PLAYLIST * pl, CHAR **retfile, CHAR **retarc, int number);
92 
93 void PL_Sort(PLAYLIST * pl,
94 			 int (*compar) (PLAYENTRY * small, PLAYENTRY * big));
95 void PL_Randomize(PLAYLIST * pl);
96 
97 #endif
98 
99 /* ex:set ts=4: */
100