Skip to content

Commit

Permalink
rename seq2wav to Clef
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Higerd committed Feb 19, 2024
1 parent 25f8077 commit 4bdb602
Show file tree
Hide file tree
Showing 77 changed files with 489 additions and 486 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
build
build_win
include
seq2wav_test*
clef_test*
*.dll
*.a
*.so
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
seq2wav is copyright (c) 2020 Adam Higerd
libclef is copyright (c) 2020-2024 Adam Higerd

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
first: test

include config.mak

test: seq2wav_test$(EXE)
test: clef_test$(EXE)

debug: seq2wav_test_d$(EXE)
debug: clef_test_d$(EXE)

static: $(BUILDPATH)/libseq2wav.a
static: $(BUILDPATH)/libclef.a

$(BUILDPATH)/Makefile.d: $(wildcard src/*.cpp src/*/*.cpp src/*.h src/*/*.h) Makefile src/Makefile
$(MAKE) -C src ../$(BUILDPATH)/Makefile.d

seq2wav_test$(EXE) seq2wav_test_d$(EXE): src/Makefile $(BUILDPATH)/Makefile.d
clef_test$(EXE) clef_test_d$(EXE): src/Makefile $(BUILDPATH)/Makefile.d
$(MAKE) -C src ../$@

$(BUILDPATH)/libseq2wav.a $(BUILDPATH)/libseq2wav_d.a: src/Makefile $(BUILDPATH)/Makefile.d $(INCLUDES)
$(BUILDPATH)/libclef.a $(BUILDPATH)/libclef_d.a: src/Makefile $(BUILDPATH)/Makefile.d $(INCLUDES)
$(MAKE) -C src ../$@

clean: FORCE
-rm -f $(BUILDPATH)/*.o $(BUILDPATH)/*.d $(BUILDPATH)/*/*.o $(BUILDPATH)/Makefile.d
-rm -f seq2wav_test$(EXE) seq2wav_test_d$(EXE) $(BUILDPATH)/libseq2wav.a $(BUILDPATH)/libseq2wav_d.a
-rm -f clef_test$(EXE) clef_test_d$(EXE) $(BUILDPATH)/libclef.a $(BUILDPATH)/libclef_d.a

FORCE:
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
seq2wav
libclef
=======

seq2wav is a generic library for building decoders and media player plugins for sequenced audio formats.
libclef is a generic library for building decoders and media player plugins for sequenced audio formats.
It was formerly known as "seq2wav".

Currently, there is support for the following targets:

Expand All @@ -13,43 +14,43 @@ Currently, there is support for the following targets:

Building
--------
seq2wav is meant to be statically linked as a component in another project. See the "Template
libclef is meant to be statically linked as a component in another project. See the "Template
project" section below for more information.

On POSIX systems or when building under MinGW, seq2wav itself has no dependencies beyond a
C++17-compliant compiler and GNU Make. To build seq2wav using Microsoft Visual Studio, ATL support
On POSIX systems or when building under MinGW, libclef itself has no dependencies beyond a
C++17-compliant compiler and GNU Make. To build libclef using Microsoft Visual Studio, ATL support
and the Visual Studio command-line tools must be installed.

To build an Audacious plugin, the Audacious development headers must be present. These may be found in
the `audacious-dev` package on Debian-based distros.) The seq2wav build system uses `pkg-config` to
the `audacious-dev` package on Debian-based distros.) The libclef build system uses `pkg-config` to
locate the required files. Audacious plugins cannot currently be built using Microsoft Visual C++.

To build a Foobar2000 plugin, the [Foobar2000 SDK](https://www.foobar2000.org/SDK) is required.
seq2wav has been tested with the 2020-07-28 version of the Foobar2000 SDK. The SDK should be
extracted into the `plugins/` folder of the project that uses seq2wav.
libclef has been tested with the 2020-07-28 version of the Foobar2000 SDK. The SDK should be
extracted into the `plugins/` folder of the project that uses libclef.

No additional dependencies are required for building a Winamp plugin.

Build scripts are included for cross-compiling Windows binaries on Linux using MinGW or using Wine
to run the Visual Studio command-line tools. (Installing the Visual Studio command-line tools on
Linux is left as an exercise to the reader.)

Further information for building seq2wav-based tools and plugins can be found in the [template
project documentation](template/README.md). If built standalone, seq2wav produces a very basic
Further information for building libclef-based tools and plugins can be found in the [template
project documentation](template/README.md). If built standalone, libclef produces a very basic
command-line test program that creates a file named `sample.wav`. The test program does not
support building with Microsoft Visual C++.

Template project
----------------
A template project for creating tools or plugins based on seq2wav may be found in the `template/`
folder. Copy all of the files in `template/` to a new folder and place the seq2wav source tree
in a `seq2wav/` folder inside it. (If using `git`, you may use
`git submodule add https://bitbucket.org/ahigerd/seq2wav` to clone seq2wav into the appropriate
A template project for creating tools or plugins based on libclef may be found in the `template/`
folder. Copy all of the files in `template/` to a new folder and place the libclef source tree
in a `libclef/` folder inside it. (If using `git`, you may use
`git submodule add https://github.com/ahigerd/libclef` to clone libclef into the appropriate
location and track it as a submodule.)

Modify `config.mak` in the new project to set `PLUGIN_NAME` appropriately, and change the filenames
in `buildvs.cmd` to refer to the same plugin name instead of `template`. Additionally, fill in
`plugins/s2wplugin.cpp` with the necessary metadata and code for the player plugins.
`plugins/clefplugin.cpp` with the necessary metadata and code for the player plugins.

Avoid nesting subdirectories more than one level inside `src/`, as the build scripts will not find
source files in any deeper levels.
Expand All @@ -58,8 +59,8 @@ Further information can be found in the [template project documentation](templat

License
-------
seq2wav is copyright (c) 2020-2023 Adam Higerd and distributed
under the terms of the [MIT license](LICENSE.md).
libclef is copyright (c) 2020-2023 Adam Higerd and distributed under the terms of the
[MIT license](LICENSE.md).

[CLAP](https://cleveraudio.org/) is an open-source audio plugin format. The
[CLAP SDK](https://github.com/free-audio/clap) is copyright (c) 2021 Alexander BIQUE
Expand Down
10 changes: 5 additions & 5 deletions config.mak
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Note: Don't use -march=native for code intended for distribution. -msse2 is probably good.
CXXFLAGS := -fPIC -std=gnu++17 -Wno-multichar -I../src -I../seq2wav/src -msse2 -I. -Isrc/ $(PLUGIN_CXXFLAGS)
CXXFLAGS := -fPIC -std=gnu++17 -Wno-multichar -I../src -I../libclef/src -msse2 -I. -Isrc/ $(PLUGIN_CXXFLAGS)
QMAKE = qmake

DLL := so
Expand Down Expand Up @@ -45,17 +45,17 @@ CXXFLAGS_D := $(CXXFLAGS) -Og -ffast-math -gstabs
else
CXXFLAGS_D := $(CXXFLAGS) -Og -ffast-math -ggdb3
endif
LDFLAGS := $(LDFLAGS) -L../seq2wav/$(BUILDPATH) -L../$(BUILDPATH) $(PLUGIN_LDFLAGS)
LDFLAGS_R := $(LDFLAGS) -lseq2wav
LDFLAGS_D := $(LDFLAGS) -lseq2wav_d
LDFLAGS := $(LDFLAGS) -L../libclef/$(BUILDPATH) -L../$(BUILDPATH) $(PLUGIN_LDFLAGS)
LDFLAGS_R := $(LDFLAGS) -lclef
LDFLAGS_D := $(LDFLAGS) -lclef_d

validate: FORCE
ifeq ($(PLUGIN_NAME),sample)
@echo Please update PLUGIN_NAME in config.mak.
@exit 1
endif

seq2wav/$(BUILDPATH)/libseq2wav.a seq2wav/$(BUILDPATH)/libseq2wav_d.a: validate
libclef/$(BUILDPATH)/libclef.a libclef/$(BUILDPATH)/libclef_d.a: validate

define validate_xspec =
ifeq ($(XSPEC),)
Expand Down
24 changes: 12 additions & 12 deletions gui/gui.pri
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
isEmpty(S2W_LDFLAGS) {
error("S2W_LDFLAGS must be set")
isEmpty(CLEF_LDFLAGS) {
error("CLEF_LDFLAGS must be set")
}

isEmpty(BUILDPATH) {
Expand All @@ -11,8 +11,8 @@ isEmpty(PLUGIN_NAME) {
}

PROJPATH = $$absolute_path($$BUILDPATH/..)
S2WPATH = $$absolute_path($$BUILDPATH/../seq2wav)
S2WBUILDPATH = $$absolute_path($$S2WPATH/$$relative_path($$BUILDPATH,$$PROJPATH))
CLEF_PATH = $$absolute_path($$BUILDPATH/../libclef)
CLEF_BUILDPATH = $$absolute_path($$CLEF_PATH/$$relative_path($$BUILDPATH,$$PROJPATH))

TEMPLATE = app

Expand All @@ -24,7 +24,7 @@ isEmpty(BUILD_DEBUG) {
CONFIG -= debug debug_and_release
CONFIG += release
LIBS += -L$$BUILDPATH -l$$PLUGIN_NAME
PRE_TARGETDEPS += $$BUILDPATH/lib$${PLUGIN_NAME}.a $$S2WBUILDPATH/libseq2wav.a
PRE_TARGETDEPS += $$BUILDPATH/lib$${PLUGIN_NAME}.a $$CLEF_BUILDPATH/libclef.a
} else {
TARGET = ../$${PLUGIN_NAME}_gui_d
OBJECTS_DIR = $$BUILDPATH/gui_d
Expand All @@ -33,18 +33,18 @@ isEmpty(BUILD_DEBUG) {
CONFIG -= release debug_and_release
CONFIG += debug
LIBS += -L$$BUILDPATH -l$${PLUGIN_NAME}_d
PRE_TARGETDEPS += $$BUILDPATH/lib$${PLUGIN_NAME}_d.a $$S2WBUILDPATH/libseq2wav_d.a
PRE_TARGETDEPS += $$BUILDPATH/lib$${PLUGIN_NAME}_d.a $$CLEF_BUILDPATH/libclef_d.a
}
QT = core gui widgets multimedia
CONFIG += c++17
QMAKE_CXXFLAGS += -std=c++17 -Wno-multichar
DEFINES -= QT_DEPRECATED_WARNINGS
DEFINES += QT_NO_DEPRECATED_WARNINGS
INCLUDEPATH += $$S2WPATH/src $$S2WPATH/gui $$PROJPATH/src
LIBS += $$S2W_LDFLAGS
INCLUDEPATH += $$CLEF_PATH/src $$CLEF_PATH/gui $$PROJPATH/src
LIBS += $$CLEF_LDFLAGS

S2W_CLASSES = mainwindow tagview playercontrols vumeter
for (CLS,S2W_CLASSES) {
exists($$S2WPATH/gui/$${CLS}.h):HEADERS += $$S2WPATH/gui/$${CLS}.h
exists($$S2WPATH/gui/$${CLS}.cpp):SOURCES += $$S2WPATH/gui/$${CLS}.cpp
CLEF_CLASSES = mainwindow tagview playercontrols vumeter
for (CLS,CLEF_CLASSES) {
exists($$CLEF_PATH/gui/$${CLS}.h):HEADERS += $$CLEF_PATH/gui/$${CLS}.h
exists($$CLEF_PATH/gui/$${CLS}.cpp):SOURCES += $$CLEF_PATH/gui/$${CLS}.cpp
}
4 changes: 2 additions & 2 deletions gui/guiutils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef S2W_GUIUTILS_H
#define S2W_GUIUTILS_H
#ifndef CLEF_GUIUTILS_H
#define CLEF_GUIUTILS_H

#include <QThread>

Expand Down
2 changes: 1 addition & 1 deletion gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <QThread>
#include <QTimer>

MainWindow::MainWindow(S2WPluginBase* plugin)
MainWindow::MainWindow(ClefPluginBase* plugin)
: QMainWindow(nullptr), m_plugin(plugin), ctx(nullptr), controls(nullptr), m_autoPlay(false)
{
setWindowTitle(QString::fromStdString(plugin->pluginName()));
Expand Down
10 changes: 5 additions & 5 deletions gui/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef S2W_MAINWINDOW_H
#define S2W_MAINWINDOW_H
#ifndef CLEF_MAINWINDOW_H
#define CLEF_MAINWINDOW_H

#include <QMainWindow>
#include <QPointer>
#include <QAtomicInteger>
class S2WPluginBase;
class ClefPluginBase;
class SynthContext;
class TagView;
class PlayerControls;
Expand All @@ -13,7 +13,7 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(S2WPluginBase* plugin);
MainWindow(ClefPluginBase* plugin);

void openFile(const QString& path, bool autoPlay = false);

Expand Down Expand Up @@ -44,7 +44,7 @@ private slots:
void openFile(const QString& path, bool doAcquire, bool autoPlay);

protected:
S2WPluginBase* m_plugin;
ClefPluginBase* m_plugin;
SynthContext* ctx;
PlayerControls* controls;

Expand Down
4 changes: 2 additions & 2 deletions gui/playercontrols.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef S2W_PLAYERCONTROLS_H
#define S2W_PLAYERCONTROLS_H
#ifndef CLEF_PLAYERCONTROLS_H
#define CLEF_PLAYERCONTROLS_H

#include <QWidget>
#include <QAudio>
Expand Down
2 changes: 1 addition & 1 deletion gui/tagview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TagView::TagView(QWidget* parent)
clearTags();
}

void TagView::loadTags(S2WPluginBase* plugin, const QString& filename, const std::string& stdFilename, const std::string& stdPath)
void TagView::loadTags(ClefPluginBase* plugin, const QString& filename, const std::string& stdFilename, const std::string& stdPath)
{
clearTags();
setTitle(filename);
Expand Down
8 changes: 4 additions & 4 deletions gui/tagview.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef S2W_TAGVIEW_H
#define S2W_TAGVIEW_H
#ifndef CLEF_TAGVIEW_H
#define CLEF_TAGVIEW_H

#include <QGroupBox>
#include <QList>
#include <string>
#include "tagmap.h"
class S2WPluginBase;
class ClefPluginBase;
class QLabel;
class QFormLayout;
class QComboBox;
Expand All @@ -19,7 +19,7 @@ Q_OBJECT
QString autoSubsong() const;

public slots:
void loadTags(S2WPluginBase* plugin, const QString& filename, const std::string& stdFilename, const std::string& stdPath);
void loadTags(ClefPluginBase* plugin, const QString& filename, const std::string& stdFilename, const std::string& stdPath);
void clearTags();

signals:
Expand Down
4 changes: 2 additions & 2 deletions gui/vumeter.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef S2W_VUMETER_H
#define S2W_VUMETER_H
#ifndef CLEF_VUMETER_H
#define CLEF_VUMETER_H

#include <QWidget>
#include <QVector>
Expand Down
14 changes: 7 additions & 7 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
include ../config.mak

CXXFLAGS := $(patsubst -I../seq2wav/src,-I../src,$(CXXFLAGS))
CXXFLAGS_R := $(patsubst -I../seq2wav/src,-I../src,$(CXXFLAGS_R))
CXXFLAGS_D := $(patsubst -I../seq2wav/src,-I../src,$(CXXFLAGS_D))
CXXFLAGS := $(patsubst -I../libclef/src,-I../src,$(CXXFLAGS))
CXXFLAGS_R := $(patsubst -I../libclef/src,-I../src,$(CXXFLAGS_R))
CXXFLAGS_D := $(patsubst -I../libclef/src,-I../src,$(CXXFLAGS_D))

SOURCES = $(filter-out main.cpp, $(wildcard *.cpp */*.cpp))

../seq2wav_test$(EXE): ../$(BUILDPATH)/main.o ../$(BUILDPATH)/libseq2wav.a
../clef_test$(EXE): ../$(BUILDPATH)/main.o ../$(BUILDPATH)/libclef.a
$(CXX) -o $@ $^

../seq2wav_test_d$(EXE): ../$(BUILDPATH)/main_d.o ../$(BUILDPATH)/libseq2wav_d.$(DLL)
../clef_test_d$(EXE): ../$(BUILDPATH)/main_d.o ../$(BUILDPATH)/libclef_d.$(DLL)
$(CXX) -o $@ $^

../$(BUILDPATH)/libseq2wav.a: $(patsubst %.cpp, ../$(BUILDPATH)/%.o, $(SOURCES)) | ../$(BUILDPATH)/Makefile.d
../$(BUILDPATH)/libclef.a: $(patsubst %.cpp, ../$(BUILDPATH)/%.o, $(SOURCES)) | ../$(BUILDPATH)/Makefile.d
rm -f $@
gcc-ar -rc $@ $^

../$(BUILDPATH)/libseq2wav_d.a: $(patsubst %.cpp, ../$(BUILDPATH)/%_d.o, $(SOURCES)) | ../$(BUILDPATH)/Makefile.d
../$(BUILDPATH)/libclef_d.a: $(patsubst %.cpp, ../$(BUILDPATH)/%_d.o, $(SOURCES)) | ../$(BUILDPATH)/Makefile.d
rm -f $@
gcc-ar -rc $@ $^

Expand Down
4 changes: 2 additions & 2 deletions src/s2wconfig.h → src/clefconfig.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef S2W_S2WCONFIG_H
#define S2W_S2WCONFIG_H
#ifndef CLEF_CLEFCONFIG_H
#define CLEF_CLEFCONFIG_H

#define _USE_MATH_DEFINES

Expand Down
16 changes: 8 additions & 8 deletions src/s2wcontext.cpp → src/clefcontext.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#include "s2wcontext.h"
#include "clefcontext.h"
#include "codec/sampledata.h"

S2WContext::S2WContext(const OpenFn& openFile)
: S2WContext(false, openFile)
ClefContext::ClefContext(const OpenFn& openFile)
: ClefContext(false, openFile)
{
// forwarded constructor only
}

S2WContext::S2WContext(bool isDawPlugin, const OpenFn& openFile)
ClefContext::ClefContext(bool isDawPlugin, const OpenFn& openFile)
: pluginData(nullptr), isDawPlugin(isDawPlugin), openFn(openFile), lastSampleID(0)
{
// initializers only
}

std::unique_ptr<std::istream> S2WContext::openFile(const std::string& path) const
std::unique_ptr<std::istream> ClefContext::openFile(const std::string& path) const
{
return openFn(path);
}

SampleData* S2WContext::getSample(uint64_t sampleID) const
SampleData* ClefContext::getSample(uint64_t sampleID) const
{
auto iter = sampleCache.find(sampleID);
if (iter == sampleCache.end()) {
Expand All @@ -27,13 +27,13 @@ SampleData* S2WContext::getSample(uint64_t sampleID) const
return iter->second.get();
}

void S2WContext::purgeSamples()
void ClefContext::purgeSamples()
{
sampleCache.clear();
lastSampleID = 0;
}

uint64_t S2WContext::nextSampleID()
uint64_t ClefContext::nextSampleID()
{
do {
++lastSampleID;
Expand Down
Loading

0 comments on commit 4bdb602

Please sign in to comment.