Audacity 3.2.0
LibsndfileTagger.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 LibsndfileTagger.h
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#pragma once
12
13#include "AcidizerTags.h"
14
15// SNDFILE is defined differently between libsndfile versions
16// making forward declarations impossible.
17#include <sndfile.h>
18
19#include <memory>
20#include <string>
21
22namespace LibImportExport
23{
24namespace Test
25{
34{
35 struct Beats
36 {
37 explicit Beats(int beats)
38 : beats { beats }
39 {
40 }
41 const int beats;
42 };
43
45
47 : beats { beats.beats }
48 {
49 }
50
51 const std::optional<int> beats;
52};
53
59class IMPORT_EXPORT_API LibsndfileTagger final
60{
61public:
62 LibsndfileTagger(double duration = 0., const std::string& filename = "");
64
65 operator bool() const;
66 void AddAcidizerTags(const Test::AcidizerTags& acidTags);
67 void AddDistributorInfo(const std::string& distributor);
68 SNDFILE& ReopenInReadMode();
69
70private:
71 const std::string mFilename;
72 SNDFILE* mFile;
73 std::unique_ptr<uint8_t[]> mAcidData;
74 std::unique_ptr<uint8_t[]> mDistributorData;
75};
76} // namespace Test
77} // namespace LibImportExport
When adding tags, the allocated memory must be preserved until the file is closed....
std::unique_ptr< uint8_t[]> mDistributorData
std::unique_ptr< uint8_t[]> mAcidData
Models how SoundForge allows the editing of ACID metadata, as far as our interest goes: setting the t...
Definition: AcidizerTags.h:26
In the Audacity code, we only are interested in LibFileFormats::AcidizerTags and the information it c...
const std::optional< int > beats