Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
music.h
Go to the documentation of this file.
1
/*
2
* Copyright 2019 Twilight
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#pragma once
17
18
#include <QObject>
19
#include <QJsonValue>
20
#include <QVector>
21
#include <QString>
22
#include <QHash>
23
24
#include <
pse-common/types.h
>
25
#include "
./db_autoport.h
"
26
27
struct
MapDBEntry
;
28
class
QQmlEngine;
29
38
struct
DB_AUTOPORT
MusicDBEntry
{
39
MusicDBEntry
();
40
MusicDBEntry
(QJsonValue& data);
41
42
QString
name
;
43
var8
bank
= 0;
44
var8
id
= 0;
45
46
QVector<MapDBEntry*>
toMaps
;
47
};
48
56
class
DB_AUTOPORT
MusicDB :
public
QObject
57
{
58
Q_OBJECT
59
Q_PROPERTY(
int
getStoreSize
READ
getStoreSize
CONSTANT)
60
61
public
:
62
static
MusicDB*
inst
();
63
64
[[nodiscard]]
const
QVector<MusicDBEntry*>
getStore
()
const
;
65
[[nodiscard]]
const
QHash<QString, MusicDBEntry*>
getInd
()
const
;
66
[[nodiscard]]
int
getStoreSize
()
const
;
67
68
Q_INVOKABLE
MusicDBEntry
*
getStoreAt
(
int
idx)
const
;
69
Q_INVOKABLE
MusicDBEntry
*
getIndAt
(
const
QString& key)
const
;
70
71
public
slots:
72
void
load
();
73
void
index
();
74
void
qmlProtect
(
const
QQmlEngine*
const
engine)
const
;
75
76
private
slots:
77
void
qmlRegister()
const
;
78
79
private
:
80
MusicDB();
81
82
QVector<MusicDBEntry*> store;
83
QHash<QString, MusicDBEntry*> ind;
84
};
MusicDB::getStore
const QVector< MusicDBEntry * > getStore() const
All tracks.
Definition
music.cpp:43
MusicDB::getStoreAt
MusicDBEntry * getStoreAt(int idx) const
Track by store index (for QML).
Definition
music.cpp:47
MusicDB::getInd
const QHash< QString, MusicDBEntry * > getInd() const
Name->entry index.
Definition
music.cpp:44
MusicDB::load
void load()
Load tracks from JSON.
Definition
music.cpp:58
MusicDB::getStoreSize
int getStoreSize() const
Track count.
Definition
music.cpp:45
MusicDB::index
void index()
Build the name->entry index.
Definition
music.cpp:68
MusicDB::getIndAt
MusicDBEntry * getIndAt(const QString &key) const
Track by name key (for QML).
Definition
music.cpp:53
MusicDB::inst
static MusicDB * inst()
< Number of tracks.
Definition
music.cpp:37
MusicDB::qmlProtect
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
Definition
music.cpp:79
types.h
Project-wide fixed-width integer aliases (var8, var16, ...).
var8
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition
types.h:124
db_autoport.h
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
DB_AUTOPORT
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition
db_autoport.h:37
MapDBEntry
One map's complete static definition – the root of the MapDBEntry family.
Definition
mapdbentry.h:56
MusicDBEntry
One music track: its name and bank/id, plus the maps that use it.
Definition
music.h:38
MusicDBEntry::toMaps
QVector< MapDBEntry * > toMaps
Maps that play this track (back-ref, set by MapsDB).
Definition
music.h:46
MusicDBEntry::bank
var8 bank
Audio bank.
Definition
music.h:43
MusicDBEntry::MusicDBEntry
MusicDBEntry()
Empty entry.
Definition
music.cpp:29
MusicDBEntry::name
QString name
Track name (key).
Definition
music.h:42
projects
db
src
pse-db
music.h
Generated by
1.17.0