Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,32 @@ ELSE(LMMS_BUILD_WIN32)
SET(STATUS_WINMM "<not supported on this platform>")
ENDIF(LMMS_BUILD_WIN32)

IF(LMMS_BUILD_OPENBSD)
# “don't link deprecated ossaudio on OpenBSD”
# https://cvsweb.openbsd.org/checkout/ports/audio/lmms/patches/patch-CMakeLists_txt?rev=1.3
SET(WANT_OSS OFF)
SET(STATUS_OSS "<not supported on this platform>")
# LMMS finds SDL and compiles fine with it enabled, but it doesn't
# appear as an option when choosing an audio backend in settings for
# some reason. This might be fixable, but the OpenBSD ports
# maintainers have also explicitly disabled SDL since 2010-10-28.
# https://cvsweb.openbsd.org/checkout/ports/audio/lmms/Makefile?rev=1.1
SET(WANT_SDL OFF)
SET(STATUS_SDL "<not supported on this platform>")
# “explicitly disable pulseaudio in these ports so they won't pick
# it up when it becomes available.”
# https://cvsweb.openbsd.org/checkout/ports/audio/lmms/Makefile?rev=1.5
SET(WANT_PULSEAUDIO OFF)
SET(STATUS_PULSEAUDIO "<not supported on this platform>")
Comment thread
messmerd marked this conversation as resolved.
# OpenBSD does not and never will have WINE, which is necessary for
# Windows VST support.
# TODO: Is Linux VST support on OpenBSD possible?
SET(WANT_VST OFF)
SET(STATUS_VST "<not supported on this platform>")
SET(STATUS_VST_32 "<not supported on this platform>")
SET(STATUS_VST_64 "<not supported on this platform>")
ENDIF()

SET(CMAKE_CXX_STANDARD_REQUIRED ON)

CHECK_INCLUDE_FILES(pthread.h LMMS_HAVE_PTHREAD_H)
Expand All @@ -165,8 +191,6 @@ CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
CHECK_INCLUDE_FILES(fcntl.h LMMS_HAVE_FCNTL_H)
CHECK_INCLUDE_FILES(sys/ioctl.h LMMS_HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILES(ctype.h LMMS_HAVE_CTYPE_H)
CHECK_INCLUDE_FILES(string.h LMMS_HAVE_STRING_H)
CHECK_INCLUDE_FILES(process.h LMMS_HAVE_PROCESS_H)
CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)

Expand Down
9 changes: 9 additions & 0 deletions cmake/modules/DetectMachine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,12 @@ IF(LMMS_BUILD_APPLE)
STRING(REGEX REPLACE "\\.[0-9]*$" "" APPLE_OS_VER "${APPLE_OS_VER}")
SET(CMAKE_MACOSX_RPATH 1)
ENDIF()

IF(LMMS_BUILD_OPENBSD)
SET(Qt5_DIR "${OPENBSD_LOCALBASE}/lib/qt5/cmake/Qt5/")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use case where a user specifies this on command line? If so, this would overwrite it?

IIRC, find_package logic is to only set those ...DIR variables if they are not set yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use case where a user specifies this on command line?

OpenBSD is a bit more predictable than Linux as the kernel and userland are developed in the same project, there is exactly one distro, there is exactly one package manager, etc. If the user has installed Qt through pkg_add, this location will be correct. If the user was compiling against a local build of Qt they self-compiled, this might be a problem, but there is no precedent for compiling LMMS against a custom Qt that I am aware of.

As far as not overwriting variables provided on invocation, CMake actually accounts for this with SET(CACHE{foo} ...). However, it was added in CMake 4.2, and I'm not interested in bumping the minimum required in this PR, especially

SET(Qt5Test_DIR "${OPENBSD_LOCALBASE}/lib/qt5/cmake/Qt5Test/")
SET(Qt6_DIR "${OPENBSD_LOCALBASE}/lib/qt6/cmake/Qt6/")
SET(Qt6Test_DIR "${OPENBSD_LOCALBASE}/lib/qt6/cmake/Qt6Test/")
INCLUDE_DIRECTORIES("${OPENBSD_LOCALBASE}/include/" "${OPENBSD_X11BASE}/include/")
LINK_DIRECTORIES("${OPENBSD_LOCALBASE}/lib/" "${OPENBSD_X11BASE}/lib/")
ENDIF()
2 changes: 0 additions & 2 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1981,8 +1981,6 @@ PREDEFINED = "LMMS_BUILD_LINUX=" \
"LMMS_HAVE_SOUNDCARD_H=" \
"LMMS_HAVE_FCNTL_H=" \
"LMMS_HAVE_SYS_IOCTL_H=" \
"LMMS_HAVE_CTYPE_H=" \
"LMMS_HAVE_STRING_H=" \
"LMMS_HAVE_PROCESS_H=" \
"LMMS_HAVE_LOCALE_H=" \

Expand Down
22 changes: 18 additions & 4 deletions src/core/audio/AudioSndio.cpp
Comment thread
messmerd marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ AudioSndio::AudioSndio(bool& _success_ful, AudioEngine* _audioEngine)
sio_initpar(&m_par);

m_par.pchan = channels();
m_par.bits = 16;
m_par.bits = sizeof(int_sample_t) * 8;
m_par.sig = 1; // int_sample_t must be signed
m_par.le = SIO_LE_NATIVE;
m_par.rate = sampleRate();
m_par.round = audioEngine()->framesPerAudioBuffer();
Expand Down Expand Up @@ -130,12 +131,25 @@ void AudioSndio::stopProcessingImpl()
void AudioSndio::run()
{
const auto framesPerAudioBuffer = audioEngine()->framesPerAudioBuffer();
auto buf = std::vector<float>(framesPerAudioBuffer * channels());
const auto samplesPerAudioBuffer = framesPerAudioBuffer * channels();
auto fbuf = std::vector<sample_t>(samplesPerAudioBuffer);
auto ibuf = std::vector<int_sample_t>(samplesPerAudioBuffer);

while (AudioDevice::isRunning())
{
audioEngine()->renderNextBuffer({buf.data(), channels(), framesPerAudioBuffer});
sio_write(m_hdl, buf.data(), buf.size() * sizeof(float));
audioEngine()->renderNextBuffer({fbuf.data(), channels(), framesPerAudioBuffer});

// Sndio doesn't speak float, so convert samples to signed int.
// While convertToS16() exists, it is intentionally not used
// here. There is no need to convert endian-ness since sndio was
// initialized with SIO_LE_NATIVE, and there's no reason to
// also convert to SampleFrame.
for (auto i = 0u; i < samplesPerAudioBuffer; ++i)
{
ibuf[i] = static_cast<int_sample_t>(AudioEngine::clip(fbuf[i]) * OUTPUT_SAMPLE_MULTIPLIER);
}

sio_write(m_hdl, ibuf.data(), ibuf.size() * sizeof(int_sample_t));
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/lmmsconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,5 @@
#cmakedefine LMMS_HAVE_SOUNDCARD_H
#cmakedefine LMMS_HAVE_FCNTL_H
#cmakedefine LMMS_HAVE_SYS_IOCTL_H
#cmakedefine LMMS_HAVE_CTYPE_H
#cmakedefine LMMS_HAVE_STRING_H
#cmakedefine LMMS_HAVE_PROCESS_H
#cmakedefine LMMS_HAVE_LOCALE_H
Loading