Skip to content

Commit

Permalink
Only static now
Browse files Browse the repository at this point in the history
  • Loading branch information
emcifuntik committed Mar 22, 2023
1 parent 1cc92a9 commit a4987b3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 41 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,19 @@ jobs:
mkdir upload\lib\debug
mkdir upload\include
copy build\windows\x64\release\alt-voice.lib upload\lib\release
copy build\windows\x64\release\opus.lib upload\lib\release
copy build\windows\x64\release\rnnoise.lib upload\lib\release
copy build\windows\x64\release\bass.lib upload\lib\release
copy build\windows\x64\release\bass_fx.lib upload\lib\release
copy build\windows\x64\debug\alt-voice.lib upload\lib\debug
copy build\windows\x64\debug\opus.lib upload\lib\debug
copy build\windows\x64\debug\rnnoise.lib upload\lib\debug
copy build\windows\x64\debug\bass.lib upload\lib\debug
copy build\windows\x64\debug\bass_fx.lib upload\lib\debug
copy build\windows\x64\release\bass_fx.dll upload\bin\release
copy build\windows\x64\release\bass.dll upload\bin\release
copy build\windows\x64\debug\bass_fx.dll upload\bin\debug
copy build\windows\x64\debug\bass.dll upload\bin\debug
copy include\alt-voice.h upload\include
copy include\IAudioFilter.h upload\include
copy include\IOpusDecoder.h upload\include
Expand Down
44 changes: 11 additions & 33 deletions include/alt-voice.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,14 @@ constexpr int AUDIO_CHANNELS = 1;
constexpr int FRAME_SIZE_SAMPLES = SAMPLE_RATE / 10;
constexpr int FRAME_SIZE_BYTES = FRAME_SIZE_SAMPLES * sizeof(int16_t);

#ifndef ALT_VOICE_API
#if defined(ALT_LIB_STATIC)
#define ALT_VOICE_API
#elif defined(_WIN32)
#if defined(ALT_VOICE_LIB)
#define ALT_VOICE_API __declspec(dllexport)
#else
#define ALT_VOICE_API __declspec(dllimport)
#endif
#else
#define ALT_VOICE_API extern
#endif
#endif

#if defined(__cplusplus)
extern "C" {
#endif

ALT_VOICE_API AltVoiceError AV_Initialize();
ALT_VOICE_API AltVoiceError AV_CreateSoundOutput(int bitrate, ISoundIO** soundOutput);
ALT_VOICE_API AltVoiceError AV_CreateSoundInput(int bitrate, ISoundIO** soundInput);
ALT_VOICE_API void AV_DestroySoundInput(ISoundIO* input);
ALT_VOICE_API const char* AV_GetVoiceErrorText(AltVoiceError error);
ALT_VOICE_API AltVoiceError AV_CreateOpusEncoder(IOpusEncoder** opusEncoder, int bitRate);
ALT_VOICE_API AltVoiceError AV_CreateOpusDecoder(IOpusDecoder** opusDecoder);
ALT_VOICE_API void AV_DestroyOpusEncoder(IOpusEncoder* opusEncoder);
ALT_VOICE_API void AV_DestroyOpusDecoder(IOpusDecoder* opusDecoder);
ALT_VOICE_API AltVoiceError AV_CreateAudioFilter(IAudioFilter** audioFilter);
ALT_VOICE_API void AV_DestroyAudioFilter(IAudioFilter* audioFilter);

#if defined(__cplusplus)
}
#endif
AltVoiceError AV_Initialize();
AltVoiceError AV_CreateSoundOutput(int bitrate, ISoundIO** soundOutput);
AltVoiceError AV_CreateSoundInput(int bitrate, ISoundIO** soundInput);
void AV_DestroySoundInput(ISoundIO* input);
const char* AV_GetVoiceErrorText(AltVoiceError error);
AltVoiceError AV_CreateOpusEncoder(IOpusEncoder** opusEncoder, int bitRate);
AltVoiceError AV_CreateOpusDecoder(IOpusDecoder** opusDecoder);
void AV_DestroyOpusEncoder(IOpusEncoder* opusEncoder);
void AV_DestroyOpusDecoder(IOpusDecoder* opusDecoder);
AltVoiceError AV_CreateAudioFilter(IAudioFilter** audioFilter);
void AV_DestroyAudioFilter(IAudioFilter* audioFilter);
12 changes: 6 additions & 6 deletions src/alt-voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const char * AV_GetVoiceErrorText(const AltVoiceError error)
}
}

ALT_VOICE_API AltVoiceError AV_CreateOpusEncoder(IOpusEncoder** opusEncoder, int bitRate)
AltVoiceError AV_CreateOpusEncoder(IOpusEncoder** opusEncoder, int bitRate)
{
try
{
Expand All @@ -105,7 +105,7 @@ ALT_VOICE_API AltVoiceError AV_CreateOpusEncoder(IOpusEncoder** opusEncoder, int
}
}

ALT_VOICE_API AltVoiceError AV_CreateOpusDecoder(IOpusDecoder** opusDecoder)
AltVoiceError AV_CreateOpusDecoder(IOpusDecoder** opusDecoder)
{
try
{
Expand All @@ -119,7 +119,7 @@ ALT_VOICE_API AltVoiceError AV_CreateOpusDecoder(IOpusDecoder** opusDecoder)
}
}

ALT_VOICE_API AltVoiceError AV_CreateAudioFilter(IAudioFilter** audioFilter)
AltVoiceError AV_CreateAudioFilter(IAudioFilter** audioFilter)
{
try
{
Expand All @@ -133,17 +133,17 @@ ALT_VOICE_API AltVoiceError AV_CreateAudioFilter(IAudioFilter** audioFilter)
}
}

ALT_VOICE_API void AV_DestroyOpusEncoder(const IOpusEncoder* opusEncoder)
void AV_DestroyOpusEncoder(const IOpusEncoder* opusEncoder)
{
delete opusEncoder;
}

ALT_VOICE_API void AV_DestroyOpusDecoder(const IOpusDecoder* opusDecoder)
void AV_DestroyOpusDecoder(const IOpusDecoder* opusDecoder)
{
delete opusDecoder;
}

ALT_VOICE_API void AV_DestroyAudioFilter(const IAudioFilter* audioFilter)
void AV_DestroyAudioFilter(const IAudioFilter* audioFilter)
{
delete audioFilter;
}
2 changes: 0 additions & 2 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ target("alt-voice")
add_headerfiles("src/**.h", "include/**.h")
add_includedirs("src/", "include/", { public = true })
add_packages("bass", "bass-fx", "libopus", "rnnoise")
add_defines("ALT_LIB_STATIC")
after_build(function (target)
for pkg, pkg_details in pairs(target:pkgs()) do
if os.isdir(pkg_details._INFO.installdir) then
Expand All @@ -36,6 +35,5 @@ target("devicetests")
add_files("examples/devicetests.cpp")
add_packages("bass", "bass-fx", "libopus")
add_deps("alt-voice")
add_defines("ALT_LIB_STATIC")

add_rules("plugin.vsxmake.autoupdate")

0 comments on commit a4987b3

Please sign in to comment.