Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding OpenBSD's sndio support. #2707

Merged
merged 1 commit into from
Mar 26, 2016
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
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,16 @@ IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD)
FIND_PACKAGE(Threads)
ENDIF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD)

IF(LMMS_BUILD_OPENBSD)
FIND_PACKAGE(Sndio)
IF(SNDIO_FOUND)
SET(LMMS_HAVE_SNDIO TRUE)
SET(STATUS_SNDIO "OK")
ELSE()
SET(STATUS_SNDIO "<not found or not supported on this platform>")
ENDIF(SNDIO_FOUND)
ENDIF(LMMS_BUILD_OPENBSD)

# check for WINE
IF(WANT_VST)
FIND_PACKAGE(Wine)
Expand Down Expand Up @@ -550,6 +560,7 @@ MESSAGE(
"* ALSA : ${STATUS_ALSA}\n"
"* JACK : ${STATUS_JACK}\n"
"* OSS : ${STATUS_OSS}\n"
"* Sndio : ${STATUS_SNDIO}\n"
"* PortAudio : ${STATUS_PORTAUDIO}\n"
"* libsoundio : ${STATUS_SOUNDIO}\n"
"* PulseAudio : ${STATUS_PULSEAUDIO}\n"
Expand All @@ -561,6 +572,7 @@ MESSAGE(
"-------------------------\n"
"* ALSA : ${STATUS_ALSA}\n"
"* OSS : ${STATUS_OSS}\n"
"* Sndio : ${STATUS_SNDIO}\n"
"* WinMM : ${STATUS_WINMM}\n"
"* AppleMidi : ${STATUS_APPLEMIDI}\n"
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/DetectMachine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ IF(WIN32)
ELSEIF(APPLE)
SET(LMMS_BUILD_APPLE 1)
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
SET(LMMS_BUILD_OPENBSD 1)
SET(LMMS_BUILD_OPENBSD 1)
ELSEIF(HAIKU)
SET(LMMS_BUILD_HAIKU 1)
ELSE()
Expand All @@ -27,7 +27,7 @@ ELSE(WIN32)
EXEC_PROGRAM( ${CMAKE_C_COMPILER} ARGS "-dumpmachine ${CMAKE_C_FLAGS}" OUTPUT_VARIABLE Machine )
MESSAGE("Machine: ${Machine}")
STRING(REGEX MATCH "i.86" IS_X86 "${Machine}")
STRING(REGEX MATCH "86_64" IS_X86_64 "${Machine}")
STRING(REGEX MATCH "86_64|amd64" IS_X86_64 "${Machine}")
Copy link
Member

Choose a reason for hiding this comment

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

👍

ENDIF(WIN32)

IF(IS_X86)
Expand Down
32 changes: 32 additions & 0 deletions cmake/modules/FindSndio.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# sndio check, based on FindAlsa.cmake
#

# Copyright (c) 2006, David Faure, <faure@kde.org>
# Copyright (c) 2007, Matthias Kretz <kretz@kde.org>
# Copyright (c) 2009, Jacob Meuser <jakemsr@sdf.lonestar.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

include(CheckIncludeFiles)
include(CheckIncludeFileCXX)
include(CheckLibraryExists)

# Already done by toplevel
find_library(SNDIO_LIBRARY sndio)
set(SNDIO_LIBRARY_DIR "")
if(SNDIO_LIBRARY)
get_filename_component(SNDIO_LIBRARY_DIR ${SNDIO_LIBRARY} PATH)
endif(SNDIO_LIBRARY)

check_library_exists(sndio sio_open "${SNDIO_LIBRARY_DIR}" HAVE_SNDIO)
if(HAVE_SNDIO)
message(STATUS "Found sndio: ${SNDIO_LIBRARY}")
else(HAVE_SNDIO)
message(STATUS "sndio not found")
endif(HAVE_SNDIO)
set(SNDIO_FOUND ${HAVE_SNDIO})

find_path(SNDIO_INCLUDES sndio.h)

mark_as_advanced(SNDIO_INCLUDES SNDIO_LIBRARY)
54 changes: 54 additions & 0 deletions include/AudioSndio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#ifndef _AUDIO_SNDIO_H
#define _AUDIO_SNDIO_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_SNDIO

#include <sndio.h>

#include "AudioDevice.h"
#include "AudioDeviceSetupWidget.h"

class LcdSpinBox;
class QLineEdit;


class AudioSndio : public AudioDevice, public QThread
{
public:
AudioSndio( bool & _success_ful, Mixer * _mixer );
virtual ~AudioSndio();

inline static QString name( void )
{
return QT_TRANSLATE_NOOP( "setupWidget", "sndio" );
}

class setupWidget : public AudioDeviceSetupWidget
{
public:
setupWidget( QWidget * _parent );
virtual ~setupWidget();

virtual void saveSettings( void );

private:
QLineEdit * m_device;
LcdSpinBox * m_channels;
} ;

private:
virtual void startProcessing( void );
virtual void stopProcessing( void );
virtual void applyQualitySettings( void );
virtual void run( void );

struct sio_hdl *m_hdl;
struct sio_par m_par;
} ;


#endif /* LMMS_HAVE_SNDIO */

#endif /* _AUDIO_SNDIO_H */
48 changes: 48 additions & 0 deletions include/MidiSndio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#ifndef _MIDI_SNDIO_H
#define _MIDI_SNDIO_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_SNDIO

#include <QtCore/QThread>
#include <QtCore/QFile>

#include <sndio.h>

#include "MidiClient.h"

class QLineEdit;


class MidiSndio : public MidiClientRaw, public QThread
{
public:
MidiSndio( void );
virtual ~MidiSndio();

static QString probeDevice(void);

inline static QString name(void)
{
return QT_TRANSLATE_NOOP("MidiSetupWidget", "sndio MIDI");
}

inline static QString configSection()
{
return "MidiSndio";
}


protected:
virtual void sendByte(const unsigned char c);
virtual void run(void);

private:
struct mio_hdl *m_hdl;
volatile bool m_quit;
} ;

#endif /* LMMS_HAVE_SNDIO */

#endif /* _MIDI_SNDIO_H */
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ INCLUDE_DIRECTORIES(
${JACK_INCLUDE_DIRS}
${SAMPLERATE_INCLUDE_DIRS}
${SNDFILE_INCLUDE_DIRS}
${SNDIO_INCLUDE_DIRS}
)

IF(NOT ("${SDL_INCLUDE_DIR}" STREQUAL ""))
Expand Down Expand Up @@ -117,6 +118,7 @@ SET(LMMS_REQUIRED_LIBS
${SDL_LIBRARY}
${PORTAUDIO_LIBRARIES}
${SOUNDIO_LIBRARY}
${SNDIO_LIBRARY}
${PULSEAUDIO_LIBRARIES}
${JACK_LIBRARIES}
${OGGVORBIS_LIBRARIES}
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ set(LMMS_SRCS
core/audio/AudioFileWave.cpp
core/audio/AudioJack.cpp
core/audio/AudioOss.cpp
core/audio/AudioSndio.cpp
core/audio/AudioPort.cpp
core/audio/AudioPortAudio.cpp
core/audio/AudioSoundIo.cpp
Expand All @@ -83,6 +84,7 @@ set(LMMS_SRCS
core/midi/MidiClient.cpp
core/midi/MidiController.cpp
core/midi/MidiOss.cpp
core/midi/MidiSndio.cpp
core/midi/MidiApple.cpp
core/midi/MidiPort.cpp
core/midi/MidiTime.cpp
Expand Down
14 changes: 14 additions & 0 deletions src/core/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "AudioAlsa.h"
#include "AudioJack.h"
#include "AudioOss.h"
#include "AudioSndio.h"
#include "AudioPortAudio.h"
#include "AudioSoundIo.h"
#include "AudioPulseAudio.h"
Expand Down Expand Up @@ -795,6 +796,19 @@ AudioDevice * Mixer::tryAudioDevices()
}
#endif

#ifdef LMMS_HAVE_SNDIO
if( dev_name == AudioSndio::name() || dev_name == "" )
{
dev = new AudioSndio( success_ful, this );
if( success_ful )
{
m_audioDevName = AudioSndio::name();
return dev;
}
delete dev;
}
#endif


#ifdef LMMS_HAVE_JACK
if( dev_name == AudioJack::name() || dev_name == "" )
Expand Down
Loading