d17ba739e8
- Fixed bug in localization - Memory leak fixed - Localization added, thanks to Mario Scheel - Tray icon support added, thanks to Thomas Zell - Some errors fixed
112 lines
2.5 KiB
Text
112 lines
2.5 KiB
Text
$NetBSD: patch-ah,v 1.2 2004/11/13 18:33:44 tron Exp $
|
|
|
|
--- kphone/dspoutoss.cpp.orig 2004-10-18 09:57:56.000000000 +0200
|
|
+++ kphone/dspoutoss.cpp 2004-11-13 19:15:54.000000000 +0100
|
|
@@ -8,6 +8,10 @@
|
|
#include <errno.h>
|
|
#include <qobject.h>
|
|
|
|
+#ifdef __NetBSD__
|
|
+#include <sys/audioio.h>
|
|
+#endif
|
|
+
|
|
#include "dspoutoss.h"
|
|
|
|
DspOutOss::DspOutOss( const QString &fileName )
|
|
@@ -53,6 +57,7 @@
|
|
flags &= ~O_NONBLOCK;
|
|
fcntl( audio_fd, F_SETFL, flags );
|
|
|
|
+#ifndef __NetBSD__
|
|
// keep fragsize less than 20ms !!
|
|
int frag = ( ( 32767 << 16 ) | 7 );
|
|
if( ioctl( audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag ) ) {
|
|
@@ -60,6 +65,7 @@
|
|
printf( "ERROR: %s\n", lasterror.ascii() );
|
|
return false;
|
|
}
|
|
+#endif
|
|
|
|
int format = AFMT_S16_LE;
|
|
|
|
@@ -109,6 +115,23 @@
|
|
8000, rate, 100*((rate-8000)/8000.0) );
|
|
}
|
|
|
|
+#ifdef __NetBSD__
|
|
+ int duplex = 1;
|
|
+
|
|
+ if( ioctl( audio_fd, AUDIO_SETFD, &duplex ) == -1 ) {
|
|
+ lasterror = QString( "SETFD" ) + QString( strerror( errno ) );
|
|
+ printf( "ERROR: %s\n", lasterror.ascii() );
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ // keep fragsize less than 20ms !!
|
|
+ int frag = ( ( 32767 << 16 ) | 7 );
|
|
+ if( ioctl( audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag ) ) {
|
|
+ lasterror = QString( "SETFRAG" ) + QString( strerror( errno ) );
|
|
+ printf( "ERROR: %s\n", lasterror.ascii() );
|
|
+ return false;
|
|
+ }
|
|
+#endif
|
|
|
|
audio_buf_info info;
|
|
|
|
@@ -127,6 +150,14 @@
|
|
}
|
|
audio_buf.resize( info.fragsize * sizeof( short ) );
|
|
|
|
+#ifdef __NetBSD__
|
|
+ if( ioctl( audio_fd, AUDIO_FLUSH, 0 ) == -1 ) {
|
|
+ lasterror = QString( "FLUSH" ) + QString( strerror( errno ) );
|
|
+ printf( "ERROR: %s\n", lasterror.ascii() );
|
|
+ return false;
|
|
+ }
|
|
+#endif
|
|
+
|
|
lasterror = QString::null;
|
|
devstate = DeviceOpened;
|
|
return true;
|
|
@@ -150,6 +181,14 @@
|
|
}
|
|
audio_buf.resize( info.fragsize * sizeof( short ) );
|
|
|
|
+#ifdef __NetBSD__
|
|
+ if( ioctl( audio_fd, AUDIO_FLUSH, 0 ) == -1 ) {
|
|
+ lasterror = QString( "FLUSH" ) + QString( strerror( errno ) );
|
|
+ printf( "ERROR: %s\n", lasterror.ascii() );
|
|
+ return false;
|
|
+ }
|
|
+#endif
|
|
+
|
|
lasterror = QString::null;
|
|
devstate = DeviceOpened;
|
|
return true;
|
|
@@ -216,6 +255,7 @@
|
|
|
|
unsigned int DspOutOss::readableBytes( void )
|
|
{
|
|
+#ifndef __NetBSD__
|
|
audio_buf_info info;
|
|
struct timeval timeout;
|
|
fd_set read_fds;
|
|
@@ -239,6 +279,18 @@
|
|
}
|
|
|
|
return info.bytes;
|
|
+
|
|
+#else /* !__NetBSD__ */
|
|
+
|
|
+ /* XXXSCW: This sucks, but kphone refuses to work without it */
|
|
+ int rsize;
|
|
+
|
|
+ if( ioctl( audio_fd, FIONREAD, &rsize) < 0 )
|
|
+ return 0;
|
|
+ if (rsize == 0)
|
|
+ rsize = 256;
|
|
+ return rsize;
|
|
+#endif /* __NetBSD__ */
|
|
}
|
|
|
|
|