use right-side buttons to goto_nth_marker()
[ardour.git] / libs / fluidsynth / fluidsynth / log.h
1 /* FluidSynth - A Software Synthesizer
2  *
3  * Copyright (C) 2003  Peter Hanappe and others.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public License
7  * as published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *  
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA
19  */
20
21 #ifndef _FLUIDSYNTH_LOG_H
22 #define _FLUIDSYNTH_LOG_H
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29
30 /**
31  * @file log.h
32  * @brief Logging interface
33  *
34  * The default logging function of the fluidsynth prints its messages
35  * to the stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
36  * #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
37  *
38  * A client application can install a new log function to handle the
39  * messages differently. In the following example, the application
40  * sets a callback function to display #FLUID_PANIC messages in a dialog,
41  * and ignores all other messages by setting the log function to
42  * NULL:
43  *
44  * @code
45  *   fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
46  *   fluid_set_log_function(FLUID_ERR, NULL, NULL);
47  *   fluid_set_log_function(FLUID_WARN, NULL, NULL);
48  *   fluid_set_log_function(FLUID_DBG, NULL, NULL);
49  * @endcode
50  */
51
52 /**
53  * FluidSynth log levels.
54  */
55 enum fluid_log_level { 
56   FLUID_PANIC,   /**< The synth can't function correctly any more */
57   FLUID_ERR,     /**< Serious error occurred */
58   FLUID_WARN,    /**< Warning */
59   FLUID_INFO,    /**< Verbose informational messages */
60   FLUID_DBG,     /**< Debugging messages */
61   LAST_LOG_LEVEL
62 };
63
64 /**
65  * Log function handler callback type used by fluid_set_log_function().
66  * @param level Log level (#fluid_log_level)
67  * @param message Log message text
68  * @param data User data pointer supplied to fluid_set_log_function().
69  */
70 typedef void (*fluid_log_function_t)(int level, char* message, void* data);
71
72 FLUIDSYNTH_API 
73 fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
74
75 FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
76
77 FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...);
78
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif /* _FLUIDSYNTH_LOG_H */