2 * Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file mm.h Symbols and declarations for mood methods. */
10 * Assign scores according to a mood_method.
12 * Each mood_method has its own mood_score_function. The first three parameters
13 * passed to that function are informations about the audio file whose score is
14 * to be computed. The data argument depends on the mood method this function
15 * is used for. It usually is the argument given at the end of a mood line.
17 * Mood score functions must return values between -100 and +100 inclusively.
18 * Boolean score functions should always return either -100 or +100.
20 * \sa struct \ref mood_method, \ref mood_parser.
22 typedef int mood_score_function(const char *path, const struct afs_info *afsi,
23 const struct afh_info *afhi, const void *data);
26 * Pre-process a mood line.
28 * The mood_parser of a mood_method is called once at mood open time for each
29 * line of the current mood definition that contains the mood_method's name as
30 * a keyword. The line is passed to the mood_parser as the first argument. The
31 * mood_parser must determine whether the line is syntactically correct and
32 * return a positive value if so and a negative value otherwise.
34 * Some mood parsers pre-process the data given in the mood line to compute a
35 * structure which depends of the particular mood_method and which is used
36 * later in the mood_score_function of the mood_method. The mood_parser may
37 * store a pointer to its structure via the void** pointer.
39 * \sa \ref mood_cleanup_function, \ref mood_score_function.
41 typedef int mood_parser(int, char **, void **);
44 * Deallocate resources which were allocated by the mood_parser.
46 * Function to free the resources allocated in \ref mood_method::parser. The
47 * argument is a pointer to mood method specific data returned by ->parser().
49 typedef void mood_cleanup_function(void *);
52 * Used for scoring and to determine whether a file is admissible.
55 /** The name of the method. */
57 /** Pointer to the mood parser. */
59 /** Pointer to the score function */
60 mood_score_function *score_function;
61 /** Optional cleanup function. */
62 mood_cleanup_function *cleanup;
65 /** The array of available mood methods. */
66 extern const struct mood_method mood_methods[];