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
2 changes: 2 additions & 0 deletions include/AudioSndio.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class AudioSndio : public AudioDevice, public QThread

struct sio_hdl *m_hdl;
struct sio_par m_par;

bool m_convertEndian;
} ;


Expand Down
24 changes: 15 additions & 9 deletions src/core/audio/AudioSndio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" );

Expand All @@ -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 )
Expand All @@ -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))
Expand Down Expand Up @@ -110,7 +116,7 @@ AudioSndio::AudioSndio(bool & _success_ful, Mixer * _mixer) :
return;
}

_success_ful = TRUE;
_success_ful = true;
}


Expand Down Expand Up @@ -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 )
Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/core/midi/MidiSndio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -42,7 +42,7 @@

MidiSndio::MidiSndio( void ) :
MidiClientRaw(),
m_quit( FALSE )
m_quit( false )
{
QString dev = probeDevice();

Expand All @@ -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 )
Expand All @@ -69,7 +69,7 @@ MidiSndio::~MidiSndio()
{
if( isRunning() )
{
m_quit = TRUE;
m_quit = true;
wait( 1000 );
terminate();
}
Expand Down Expand Up @@ -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 );
Expand Down