Skip to content

Commit

Permalink
clean up for MSVC builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ahigerd committed Dec 11, 2020
1 parent 89fc02b commit e7f5707
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ seq2wav_d
*.a
*.so
*.exe
*.lib
*.exp
*.obj
4 changes: 1 addition & 3 deletions plugins/audacious/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
DLL = .so
EXPORT = __attribute__((visibility(\"default\")))
ifeq ($(OS),Windows_NT)
DLL = .dll
EXPORT = __declspec(dllexport)
endif

PLUGIN = TODO

CXXFLAGS = -std=gnu++14 -fPIC -Wno-multichar -I../../src -I../../seq2wav/include -march=native $(shell pkg-config --cflags audacious) -DPLUGIN_NAME=\"$(PLUGIN)\" "-DEXPORT=$(EXPORT)"
CXXFLAGS = -std=gnu++14 -fPIC -Wno-multichar -I../../src -I../../seq2wav/include -march=native $(shell pkg-config --cflags audacious) -DPLUGIN_NAME=\"$(PLUGIN)\"
CXXFLAGS_R = $(CXXFLAGS) -O3
CXXFLAGS_D = $(CXXFLAGS) -ggdb -fsanitize=address
LDFLAGS = -L../../seq2wav $(shell pkg-config --libs audacious)
Expand Down
19 changes: 19 additions & 0 deletions src/s2wconfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef S2W_S2WCONFIG_H
#define S2W_S2WCONFIG_H

#define _USE_MATH_DEFINES

#include <cstdlib>
#ifdef _MSC_VER
typedef unsigned int ssize_t;
#endif

#ifdef _WIN32
#define PATH_CHARS "\\/"
#define EXPORT __declspec(dllexport)
#else
#define PATH_CHARS "/"
#define EXPORT __attribute__((visibility("default")))
#endif

#endif
2 changes: 1 addition & 1 deletion src/synth/audionode.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef S2W_AUDIONODE_H
#define S2W_AUDIONODE_H

#include <cstdint>
#include "s2wconfig.h"
#include <unordered_map>
#include "audioparam.h"
class SynthContext;
Expand Down
2 changes: 1 addition & 1 deletion src/synth/channel.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef S2W_CHANNEL_H
#define S2W_CHANNEL_H

#include "s2wconfig.h"
#include <unordered_map>
#include <vector>
#include <memory>
#include <cstdint>
#include "audionode.h"
#include "envelope.h"
class SynthContext;
Expand Down
1 change: 1 addition & 0 deletions src/synth/iinterpolator.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef S2W_IINTERPOLATOR_H
#define S2W_IINTERPOLATOR_H

#include "s2wconfig.h"
#include <vector>
#include <cstdint>
class SampleData;
Expand Down
3 changes: 2 additions & 1 deletion src/synth/synthcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class IInterpolator;
class ITrack;
class RiffWriter;

struct SynthContext {
class SynthContext {
public:
SynthContext(double sampleRate, int outputChannels = 2);
~SynthContext();

Expand Down
16 changes: 2 additions & 14 deletions src/tagsm3u.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ static TagsM3U::TagMap m3uKeys = {

std::string TagsM3U::relativeTo(const std::string& trackPath)
{
int slashPos = trackPath.find_last_of(
#ifdef _WIN32
"\\/"
#else
"/"
#endif
);
int slashPos = trackPath.find_last_of(PATH_CHARS);
if (slashPos == std::string::npos) {
return "!tags.m3u";
}
Expand Down Expand Up @@ -239,13 +233,7 @@ void TagsM3U::addTrack(const std::string& trackName)

int TagsM3U::findTrack(const std::string& trackName) const
{
int slashPos = trackName.find_last_of(
#ifdef _WIN32
"\\/"
#else
"/"
#endif
);
int slashPos = trackName.find_last_of(PATH_CHARS);
std::string filename = trackName.substr(slashPos + 1);
for (int i = 0; i < tracks.size(); i++) {
if (tracks.at(i) == filename) {
Expand Down
1 change: 1 addition & 0 deletions src/tagsm3u.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef S2W_TAGSM3U_H
#define S2W_TAGSM3U_H

#include "s2wconfig.h"
#include <iostream>
#include <vector>
#include <unordered_map>
Expand Down
1 change: 1 addition & 0 deletions src/utility.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "utility.h"
#include <cmath>
#include <cctype>
#include <codecvt>
#include <locale>
#include <sstream>
Expand Down

0 comments on commit e7f5707

Please sign in to comment.