mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 11:11:35 +02:00
Update OpenAL Soft to 1.18.2
This commit is contained in:
@@ -1,29 +1,56 @@
|
||||
project(alsoft-config)
|
||||
|
||||
option(ALSOFT_NO_QT5 "Use Qt4 instead of Qt5 for alsoft-config" FALSE)
|
||||
|
||||
include_directories("${alsoft-config_BINARY_DIR}")
|
||||
|
||||
# Need Qt 4.8.0 or newer for the iconset theme attribute to work
|
||||
find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui)
|
||||
if(QT4_FOUND)
|
||||
include(${QT_USE_FILE})
|
||||
set(alsoft-config_SRCS main.cpp
|
||||
mainwindow.cpp
|
||||
)
|
||||
set(alsoft-config_UIS mainwindow.ui)
|
||||
set(alsoft-config_MOCS mainwindow.h)
|
||||
|
||||
set(alsoft-config_SRCS main.cpp
|
||||
mainwindow.cpp
|
||||
)
|
||||
find_package(Qt5Widgets)
|
||||
if(Qt5Widgets_FOUND AND NOT ALSOFT_NO_QT5)
|
||||
qt5_wrap_ui(UIS ${alsoft-config_UIS})
|
||||
|
||||
set(alsoft-config_UIS mainwindow.ui)
|
||||
QT4_WRAP_UI(UIS ${alsoft-config_UIS})
|
||||
|
||||
set(alsoft-config_MOCS mainwindow.h)
|
||||
QT4_WRAP_CPP(MOCS ${alsoft-config_MOCS})
|
||||
qt5_wrap_cpp(MOCS ${alsoft-config_MOCS})
|
||||
|
||||
add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS})
|
||||
target_link_libraries(alsoft-config ${QT_LIBRARIES})
|
||||
target_link_libraries(alsoft-config Qt5::Widgets)
|
||||
set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
|
||||
set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR})
|
||||
if(TARGET build_version)
|
||||
add_dependencies(alsoft-config build_version)
|
||||
endif()
|
||||
|
||||
install(TARGETS alsoft-config
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
else()
|
||||
# Need Qt 4.8.0 or newer for the iconset theme attribute to work
|
||||
find_package(Qt4 4.8.0 COMPONENTS QtCore QtGui)
|
||||
if(QT4_FOUND)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
qt4_wrap_ui(UIS ${alsoft-config_UIS})
|
||||
|
||||
qt4_wrap_cpp(MOCS ${alsoft-config_MOCS})
|
||||
|
||||
add_executable(alsoft-config ${alsoft-config_SRCS} ${UIS} ${RSCS} ${TRS} ${MOCS})
|
||||
target_link_libraries(alsoft-config ${QT_LIBRARIES})
|
||||
set_property(TARGET alsoft-config APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS})
|
||||
set_target_properties(alsoft-config PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OpenAL_BINARY_DIR})
|
||||
if(TARGET build_version)
|
||||
add_dependencies(alsoft-config build_version)
|
||||
endif()
|
||||
|
||||
install(TARGETS alsoft-config
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,16 +17,32 @@ public:
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void cancelCloseAction();
|
||||
|
||||
void saveCurrentConfig();
|
||||
|
||||
void saveConfigAsFile();
|
||||
void loadConfigFromFile();
|
||||
|
||||
void showAboutPage();
|
||||
|
||||
void enableApplyButton();
|
||||
|
||||
void updateResamplerLabel(int num);
|
||||
|
||||
void updatePeriodSizeEdit(int size);
|
||||
void updatePeriodSizeSlider();
|
||||
void updatePeriodCountEdit(int size);
|
||||
void updatePeriodCountSlider();
|
||||
|
||||
void selectQuadDecoderFile();
|
||||
void select51DecoderFile();
|
||||
void select61DecoderFile();
|
||||
void select71DecoderFile();
|
||||
|
||||
void updateJackBufferSizeEdit(int size);
|
||||
void updateJackBufferSizeSlider();
|
||||
|
||||
void addHrtfFile();
|
||||
void removeHrtfFile();
|
||||
|
||||
@@ -35,6 +51,13 @@ private slots:
|
||||
void showEnabledBackendMenu(QPoint pt);
|
||||
void showDisabledBackendMenu(QPoint pt);
|
||||
|
||||
void selectOSSPlayback();
|
||||
void selectOSSCapture();
|
||||
|
||||
void selectSolarisPlayback();
|
||||
|
||||
void selectWaveOutput();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
@@ -44,6 +67,15 @@ private:
|
||||
QValidator *mEffectSlotValidator;
|
||||
QValidator *mSourceSendValidator;
|
||||
QValidator *mSampleRateValidator;
|
||||
QValidator *mJackBufferValidator;
|
||||
|
||||
bool mNeedsSave;
|
||||
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
void selectDecoderFile(QLineEdit *line, const char *name);
|
||||
|
||||
QStringList collectHrtfs();
|
||||
|
||||
void loadConfig(const QString &fname);
|
||||
void saveConfig(const QString &fname) const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -364,11 +364,49 @@ static void BsiGenerateTables()
|
||||
fprintf(stdout, " },\n {");
|
||||
for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++)
|
||||
fprintf(stdout, " %d,", mt[si]);
|
||||
fprintf(stdout, " 0 }\n };\n");
|
||||
fprintf(stdout, " 0 }\n };\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* These methods generate a much simplified 4-point sinc interpolator using a
|
||||
* Kaiser windows. This is much simpler to process at run-time, but has notably
|
||||
* more aliasing noise.
|
||||
*/
|
||||
|
||||
/* Same as in alu.h! */
|
||||
#define FRACTIONBITS (12)
|
||||
#define FRACTIONONE (1<<FRACTIONBITS)
|
||||
|
||||
static double SincKaiser(double r, double x)
|
||||
{
|
||||
/* Limit rippling to -60dB. */
|
||||
return Kaiser(CalcKaiserBeta(60.0), x / r) * Sinc(x);
|
||||
}
|
||||
|
||||
static void Sinc4GenerateTables(void)
|
||||
{
|
||||
static double filter[FRACTIONONE][4];
|
||||
|
||||
int i;
|
||||
for(i = 0;i < FRACTIONONE;i++)
|
||||
{
|
||||
double mu = (double)i / FRACTIONONE;
|
||||
filter[i][0] = SincKaiser(2.0, mu - -1.0);
|
||||
filter[i][1] = SincKaiser(2.0, mu - 0.0);
|
||||
filter[i][2] = SincKaiser(2.0, mu - 1.0);
|
||||
filter[i][3] = SincKaiser(2.0, mu - 2.0);
|
||||
}
|
||||
|
||||
fprintf(stdout, "static const float sinc4Tab[%d][4] =\n{\n", FRACTIONONE);
|
||||
for(i = 0;i < FRACTIONONE;i++)
|
||||
fprintf(stdout, " { %+14.9ef, %+14.9ef, %+14.9ef, %+14.9ef },\n",
|
||||
filter[i][0], filter[i][1], filter[i][2], filter[i][3]);
|
||||
fprintf(stdout, "};\n\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
BsiGenerateTables();
|
||||
Sinc4GenerateTables();
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2296
-1993
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "AL/alc.h"
|
||||
#include "AL/al.h"
|
||||
@@ -41,6 +42,70 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
static WCHAR *FromUTF8(const char *str)
|
||||
{
|
||||
WCHAR *out = NULL;
|
||||
int len;
|
||||
|
||||
if((len=MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0)) > 0)
|
||||
{
|
||||
out = calloc(sizeof(WCHAR), len);
|
||||
MultiByteToWideChar(CP_UTF8, 0, str, -1, out, len);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Override printf, fprintf, and fwrite so we can print UTF-8 strings. */
|
||||
static void al_fprintf(FILE *file, const char *fmt, ...)
|
||||
{
|
||||
char str[1024];
|
||||
WCHAR *wstr;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(str, sizeof(str), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
str[sizeof(str)-1] = 0;
|
||||
wstr = FromUTF8(str);
|
||||
if(!wstr)
|
||||
fprintf(file, "<UTF-8 error> %s", str);
|
||||
else
|
||||
fprintf(file, "%ls", wstr);
|
||||
free(wstr);
|
||||
}
|
||||
#define fprintf al_fprintf
|
||||
#define printf(...) al_fprintf(stdout, __VA_ARGS__)
|
||||
|
||||
static int al_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *file)
|
||||
{
|
||||
char str[1024];
|
||||
WCHAR *wstr;
|
||||
size_t len;
|
||||
|
||||
len = size * nmemb;
|
||||
if(len > sizeof(str)-1)
|
||||
len = sizeof(str)-1;
|
||||
memcpy(str, ptr, len);
|
||||
str[len] = 0;
|
||||
|
||||
wstr = FromUTF8(str);
|
||||
if(!wstr)
|
||||
fprintf(file, "<UTF-8 error> %s", str);
|
||||
else
|
||||
fprintf(file, "%ls", wstr);
|
||||
free(wstr);
|
||||
|
||||
return len / size;
|
||||
}
|
||||
#define fwrite al_fwrite
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_WIDTH 80
|
||||
|
||||
static void printList(const char *list, char separator)
|
||||
@@ -186,6 +251,38 @@ static void printALInfo(void)
|
||||
checkALErrors();
|
||||
}
|
||||
|
||||
static void printResamplerInfo(void)
|
||||
{
|
||||
LPALGETSTRINGISOFT alGetStringiSOFT;
|
||||
ALint num_resamplers;
|
||||
ALint def_resampler;
|
||||
|
||||
if(!alIsExtensionPresent("AL_SOFT_source_resampler"))
|
||||
{
|
||||
printf("Resampler info not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
alGetStringiSOFT = alGetProcAddress("alGetStringiSOFT");
|
||||
|
||||
num_resamplers = alGetInteger(AL_NUM_RESAMPLERS_SOFT);
|
||||
def_resampler = alGetInteger(AL_DEFAULT_RESAMPLER_SOFT);
|
||||
|
||||
if(!num_resamplers)
|
||||
printf("!!! No resamplers found !!!\n");
|
||||
else
|
||||
{
|
||||
ALint i;
|
||||
printf("Available resamplers:\n");
|
||||
for(i = 0;i < num_resamplers;++i)
|
||||
{
|
||||
const ALchar *name = alGetStringiSOFT(AL_RESAMPLER_NAME_SOFT, i);
|
||||
printf(" %s%s\n", name, (i==def_resampler)?" *":"");
|
||||
}
|
||||
}
|
||||
checkALErrors();
|
||||
}
|
||||
|
||||
static void printEFXInfo(ALCdevice *device)
|
||||
{
|
||||
ALCint major, minor, sends;
|
||||
@@ -329,6 +426,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
printALInfo();
|
||||
printResamplerInfo();
|
||||
printEFXInfo(device);
|
||||
|
||||
alcMakeContextCurrent(NULL);
|
||||
|
||||
Reference in New Issue
Block a user