File: IniConfig.h

package info (click to toggle)
sidplayfp 2.16.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 688 kB
  • sloc: cpp: 6,782; makefile: 116
file content (129 lines) | stat: -rw-r--r-- 3,668 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * This file is part of sidplayfp, a console SID player.
 *
 * Copyright 2011-2021 Leandro Nini
 * Copyright 2000 Simon White
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

#ifndef INICONFIG_H
#define INICONFIG_H

#include "ini/types.h"
#include "ini/iniHandler.h"

#include "sidlib_features.h"

#include <sidplayfp/sidplayfp.h>
#include <sidplayfp/SidConfig.h>

/*
 * Sidplayfp config file reader.
 */
class IniConfig
{
public:
    struct sidplay2_section
    {
        int            version;
        SID_STRING     database;
        uint_least32_t playLength;
        uint_least32_t recordLength;
        SID_STRING     kernalRom;
        SID_STRING     basicRom;
        SID_STRING     chargenRom;
        int            verboseLevel;
    };

    struct console_section
    {   // INI Section - [Console]
        bool ansi;
        char topLeft;
        char topRight;
        char bottomLeft;
        char bottomRight;
        char vertical;
        char horizontal;
        char junctionLeft;
        char junctionRight;
    };

    struct audio_section
    {   // INI Section - [Audio]
        int frequency; // sample rate
        int channels;  // number of channels
        int precision; // sample precision in bits
        int bufLength; // buffer length in milliseconds
        int getBufSize() const { return (bufLength * frequency) / 1000; }
    };

    struct emulation_section
    {   // INI Section - [Emulation]
        SID_STRING    engine;
        SidConfig::c64_model_t  modelDefault;
        bool          modelForced;
        SidConfig::sid_model_t  sidModel;
        bool          forceModel;
        SidConfig::cia_model_t  ciaModel;
        bool          digiboost;
        bool          filter;
        double        bias;
        double        filterCurve6581;
#ifdef FEAT_FILTER_RANGE
        double        filterRange6581;
#endif
        double        filterCurve8580;
#ifdef FEAT_CW_STRENGTH
        SidConfig::sid_cw_t combinedWaveformsStrength;
#endif
        int           powerOnDelay;
        SidConfig::sampling_method_t  samplingMethod;
        bool          fastSampling;
    };

protected:
    struct    sidplay2_section  sidplay2_s;
    struct    console_section   console_s;
    struct    audio_section     audio_s;
    struct    emulation_section emulation_s;

protected:
    void  clear ();

    void readSidplay2  (iniHandler &ini);
    void readConsole   (iniHandler &ini);
    void readAudio     (iniHandler &ini);
    void readEmulation (iniHandler &ini);

private:
    SID_STRING m_fileName;

public:
    IniConfig  ();
    ~IniConfig ();

    SID_STRING getFilename() const { return m_fileName; }

    void read ();

    // Sidplayfp Specific Section
    const sidplay2_section&  sidplay2  () { return sidplay2_s; }
    const console_section&   console   () { return console_s; }
    const audio_section&     audio     () { return audio_s; }
    const emulation_section& emulation () { return emulation_s; }
};

#endif // INICONFIG_H