Project

General

Profile

runtime_v3.6jwt.h

Jim Turner, March 06, 2015 20:07

 
1
/*
2
 * runtime.h
3
 * Copyright 2014 John Lindgren
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions, and the following disclaimer.
10
 *
11
 * 2. Redistributions in binary form must reproduce the above copyright notice,
12
 *    this list of conditions, and the following disclaimer in the documentation
13
 *    provided with the distribution.
14
 *
15
 * This software is provided "as is" and without any warranty, express or
16
 * implied. In no event shall the authors be liable for any damages arising from
17
 * the use of this software.
18
 */
19

    
20
#ifndef LIBAUDCORE_RUNTIME_H
21
#define LIBAUDCORE_RUNTIME_H
22

    
23
#include <libaudcore/objects.h>
24

    
25
enum class AudPath {
26
    BinDir,
27
    DataDir,
28
    PluginDir,
29
    LocaleDir,
30
    DesktopFile,
31
    IconFile,
32
    UserDir,
33
    PlaylistDir,
34
    count
35
};
36

    
37
enum class MainloopType {
38
    GLib,
39
    Qt
40
};
41

    
42
enum class OutputReset {
43
    EffectsOnly,
44
    ReopenStream,
45
    ResetPlugin
46
};
47

    
48
namespace audlog
49
{
50
    enum Level {
51
        Debug,
52
        Info,
53
        Warning,
54
        Error
55
    };
56

    
57
    typedef void (* Handler) (Level level, const char * file, int line,
58
     const char * func, const char * message);
59

    
60
    void set_stderr_level (Level level);
61
    void subscribe (Handler handler, Level level);
62
    void unsubscribe (Handler handler);
63

    
64
    void log (Level level, const char * file, int line, const char * func,
65
     const char * format, ...);
66

    
67
    const char * get_level_name (Level level);
68
}
69

    
70
#define AUDERR(...) do { audlog::log (audlog::Error, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); } while (0)
71
#define AUDWARN(...) do { audlog::log (audlog::Warning, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); } while (0)
72
#define AUDINFO(...) do { audlog::log (audlog::Info, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); } while (0)
73
#define AUDDBG(...) do { audlog::log (audlog::Debug, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); } while (0)
74

    
75
void aud_init_paths ();
76
void aud_cleanup_paths ();
77

    
78
const char * aud_get_path (AudPath id);
79

    
80
void aud_set_headless_mode (bool headless);
81
bool aud_get_headless_mode ();
82

    
83
EXPORT void aud_set_pausemute_mode (bool pausemute_mode);  /* JWT */
84
EXPORT bool aud_get_pausemute_mode ();
85

    
86
void aud_set_mainloop_type (MainloopType type);
87
MainloopType aud_get_mainloop_type ();
88

    
89
/* Requires: aud_init_paths() */
90
void aud_init_i18n ();
91

    
92
void aud_config_set_defaults (const char * section, const char * const * entries);
93

    
94
void aud_set_str (const char * section, const char * name, const char * value);
95
String aud_get_str (const char * section, const char * name);
96
void aud_set_bool (const char * section, const char * name, bool value);
97
bool aud_get_bool (const char * section, const char * name);
98
void aud_set_int (const char * section, const char * name, int value);
99
int aud_get_int (const char * section, const char * name);
100
void aud_set_double (const char * section, const char * name, double value);
101
double aud_get_double (const char * section, const char * name);
102

    
103
void aud_init ();
104
void aud_resume ();
105
void aud_run ();
106
void aud_quit ();
107
void aud_cleanup ();
108

    
109
void aud_leak_check ();
110

    
111
String aud_history_get (int entry);
112
void aud_history_add (const char * path);
113

    
114
void aud_output_reset (OutputReset type);
115

    
116
#endif