Fixes the OpenBSD build. (#3716)

This commit is contained in:
David CARLIER
2017-08-08 12:27:54 +02:00
committed by Umcaruje
parent e9a4063119
commit 9ae339c82b
3 changed files with 23 additions and 15 deletions

View File

@@ -72,6 +72,8 @@ private:
struct sio_hdl *m_hdl;
struct sio_par m_par;
bool m_convertEndian;
} ;

View File

@@ -27,9 +27,9 @@
#ifdef LMMS_HAVE_SNDIO
#include <QtCore/QFileInfo>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QFileInfo>
#include <QLabel>
#include <QLineEdit>
#include "endian_handling.h"
#include "LcdSpinBox.h"
@@ -52,9 +52,10 @@
AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
AudioDevice( tLimit<ch_cnt_t>(
ConfigManager::inst()->value( "audiosndio", "channels" ).toInt(),
DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer )
DEFAULT_CHANNELS, SURROUND_CHANNELS ), _mixer ),
m_convertEndian ( false )
{
_success_ful = FALSE;
_success_ful = false;
QString dev = ConfigManager::inst()->value( "audiosndio", "device" );
@@ -64,7 +65,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
}
else
{
m_hdl = sio_open( dev.toAscii().data(), SIO_PLAY, 0 );
m_hdl = sio_open( dev.toLatin1().constData(), SIO_PLAY, 0 );
}
if( m_hdl == NULL )
@@ -82,6 +83,11 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
m_par.round = mixer()->framesPerPeriod();
m_par.appbufsz = m_par.round * 2;
if ( (isLittleEndian() && (m_par.le == 0)) ||
(!isLittleEndian() && (m_par.le == 1))) {
m_convertEndian = true;
}
struct sio_par reqpar = m_par;
if (!sio_setpar(m_hdl, &m_par))
@@ -110,7 +116,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
return;
}
_success_ful = TRUE;
_success_ful = true;
}
@@ -160,7 +166,7 @@ void AudioSndio::run( void )
int_sample_t * outbuf =
new int_sample_t[mixer()->framesPerPeriod() * channels()];
while( TRUE )
while( true )
{
const fpp_t frames = getNextBuffer( temp );
if( !frames )
@@ -169,7 +175,7 @@ void AudioSndio::run( void )
}
uint bytes = convertToS16( temp, frames,
mixer()->masterGain(), outbuf, FALSE );
mixer()->masterGain(), outbuf, m_convertEndian );
if( sio_write( m_hdl, outbuf, bytes ) != bytes )
{
break;

View File

@@ -27,8 +27,8 @@
#ifdef LMMS_HAVE_SNDIO
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QLabel>
#include <QLineEdit>
#ifdef LMMS_HAVE_STDLIB_H
#include <stdlib.h>
@@ -42,7 +42,7 @@
MidiSndio::MidiSndio( void ) :
MidiClientRaw(),
m_quit( FALSE )
m_quit( false )
{
QString dev = probeDevice();
@@ -52,7 +52,7 @@ MidiSndio::MidiSndio( void ) :
}
else
{
m_hdl = mio_open( dev.toAscii().data(), MIO_IN | MIO_OUT, 0 );
m_hdl = mio_open( dev.toLatin1().constData(), MIO_IN | MIO_OUT, 0 );
}
if( m_hdl == NULL )
@@ -69,7 +69,7 @@ MidiSndio::~MidiSndio()
{
if( isRunning() )
{
m_quit = TRUE;
m_quit = true;
wait( 1000 );
terminate();
}
@@ -97,7 +97,7 @@ void MidiSndio::run( void )
char buf[0x100], *p;
size_t n;
int ret;
while( m_quit == FALSE && m_hdl )
while( m_quit == false && m_hdl )
{
nfds = mio_pollfd( m_hdl, &pfd, POLLIN );
ret = poll( &pfd, nfds, 100 );