summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opierec/device.cpp16
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp7
3 files changed, 27 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 7b4bfd9..e6afbd8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -252,65 +252,69 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
w = videoUI()->width();
h = videoUI()->height();
if ( drawnOnScreenDisplay ) {
if ( onScreenDisplayVolume > v ) {
videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
}
}
drawnOnScreenDisplay = TRUE;
onScreenDisplayVolume = v;
QPainter p( videoUI() );
p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
QFont f;
f.setPixelSize( 20 );
f.setBold( TRUE );
p.setFont( f );
p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
for ( unsigned int i = 0; i < 10; i++ ) {
if ( v > i ) {
p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
} else {
p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
}
}
}
}
void MediaPlayer::blank( bool b ) {
+#ifdef QT_QWS_DEVFS
+ fd=open("/dev/fb/0",O_RDWR);
+#else
fd=open("/dev/fb0",O_RDWR);
+#endif
#ifdef QT_QWS_SL5XXX
fl= open( "/dev/fl", O_RDWR );
#endif
if (fd != -1) {
if ( b ) {
odebug << "do blanking" << oendl;
#ifdef QT_QWS_SL5XXX
ioctl( fd, FBIOBLANK, 1 );
if(fl !=-1) {
ioctl( fl, 2 );
::close(fl);
}
#else
ioctl( fd, FBIOBLANK, 3 );
#endif
isBlanked = TRUE;
} else {
odebug << "do unblanking" << oendl;
ioctl( fd, FBIOBLANK, 0);
#ifdef QT_QWS_SL5XXX
if(fl != -1) {
ioctl( fl, 1);
::close(fl);
}
#endif
isBlanked = FALSE;
}
close( fd );
} else {
odebug << "<< /dev/fb0 could not be opened >>" << oendl;
}
}
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index 683f0a5..cb47b77 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -46,65 +46,69 @@ bool Device::openDsp() {
perror("<<<<<<<<<<<<<<ioctl(\"Open device\")");
return false;
}
return true;
}
int Device::openDevice( int flags) {
/* pid_t pid;
int status;
int pipefd[2];
char message[20];
if (pipe(pipefd) == -1){
perror ("Error creating pipe");
exit(1);
}
switch (pid = fork()) {
case -1:
perror("The fork failed!");
break;
case 0: {
*/
qDebug( "Opening %s",dspstr);
if (( sd = ::open( dspstr, flags)) == -1) {
perror("open(\"/dev/dsp\")");
QString errorMsg="Could not open audio device\n /dev/dsp\n"
+(QString)strerror(errno);
qDebug( "XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
return -1;
}
qDebug( "Opening mixer" );
int mixerHandle=0;
+#ifdef QT_QWS_DEVFS
+ if (( mixerHandle = open("/dev/sound/mixer",O_RDWR))<0) {
+#else
if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) {
+#endif
perror("open(\"/dev/mixer\")");
QString errorMsg="Could not open audio device\n /dev/dsp\n"
+(QString)strerror(errno);
qDebug( "XXXXXXXXXXXXXXXXXXXXXX "+errorMsg );
}
if(ioctl(sd,SNDCTL_DSP_RESET,0)<0){
perror("ioctl RESET");
}
// sprintf(message, "%d", sd);
/* QFile f1("/pid");
f1.open(IO_WriteOnly );
f1.writeBlock(message, strlen(message));
f1.close();
*/
/* close(pipefd[0]);
write(pipefd[1], message, sizeof(message));
close(pipefd[1]);
// qDebug( "" + soundDevice->sd );
_exit(0);
}
default:
// pid greater than zero is parent getting the child's pid
printf("Child's pid is %d\n",pid);
QString s;
close(pipefd[1]);
read(pipefd[0], message, sizeof(message));
s = message;
close(pipefd[0]);
// while(wait(NULL)!=pid)
@@ -139,97 +143,109 @@ int Device::getOutVolume( ) {
if(ioctl( mixerHandle, MIXER_READ(SOUND_MIXER_VOLUME), &volume )==-1)
perror("<<<<<<<<<<<<<<ioctl(\"MIXER_READ\")");
::close( mixerHandle );
} else
perror("open(\"/dev/mixer\")");
printf("<<<<<<<<<<<<<<<<<<<<output volume %d\n",volume);
Config cfg("qpe");
cfg.setGroup("Volume");
return cfg.readNumEntry("VolumePercent");
}
int Device::getInVolume() {
unsigned int volume=0;
int mixerHandle = ::open( mixstr, O_RDWR );
if ( mixerHandle >= 0 ) {
if(ioctl( mixerHandle, MIXER_READ(SOUND_MIXER_MIC), &volume )==-1)
perror("<<<<<<<<<<<<<<<ioctl(\"MIXER_READ\")");
::close( mixerHandle );
} else
perror("open(\"/dev/mixer\")");
printf("<<<<<<<<<<<<<<input volume %d\n", volume );
Config cfg("qpe");
cfg.setGroup("Volume");
return cfg.readNumEntry("Mic");
}
void Device::changedOutVolume(int vol) {
int level = (vol << 8) + vol;
int fd = 0;
+#ifdef QT_QWS_DEVFS
+ if ((fd = open("/dev/sound/mixer", O_RDWR))>=0) {
+#else
if ((fd = open("/dev/mixer", O_RDWR))>=0) {
+#endif
if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &level) == -1)
perror("ioctl(\"MIXER_IN_WRITE\")");
Config cfg("qpe");
cfg.setGroup("Volume");
cfg.writeEntry("VolumePercent", QString::number( vol ));
QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
qDebug("changing output vol %d" ,vol );
}
::close(fd);
}
void Device::changedInVolume(int vol ) {
int level = (vol << 8) + vol;
int fd = 0;
+#ifdef QT_QWS_DEVFS
+ if ((fd = open("/dev/sound/mixer", O_RDWR))>=0) {
+#else
if ((fd = open("/dev/mixer", O_RDWR))>=0) {
+#endif
if(ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &level) == -1)
perror("ioctl(\"MIXER_IN_WRITE\")");
Config cfg("qpe");
cfg.setGroup("Volume");
cfg.writeEntry("Mic", QString::number(vol ));
QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
qDebug("changing input volume %d",vol);
}
::close(fd);
}
bool Device::selectMicInput() {
int md=0;
int info=MIXER_WRITE(SOUND_MIXER_MIC);
+#ifdef QT_QWS_DEVFS
+ md = ::open( "/dev/sound/mixer", O_RDWR );
+#else
md = ::open( "/dev/mixer", O_RDWR );
+#endif
if ( md == -1)
perror("open(\"/dev/mixer\")");
else {
if( ioctl( md, SOUND_MIXER_WRITE_RECSRC, &info) == -1)
perror("ioctl(\"SOUND_MIXER_WRITE_RECSRC\")");
::close(md);
return false;
}
::close(md);
return true;
}
bool Device::closeDevice( bool) {
// if(b) {//close now
// if (ioctl( sd, SNDCTL_DSP_RESET, 0) == -1) {
// perror("ioctl(\"SNDCTL_DSP_RESET\")");
// }
// } else { //let play
// if (ioctl( sd, SNDCTL_DSP_SYNC, 0) == -1) {
// perror("ioctl(\"SNDCTL_DSP_SYNC\")");
// }
// }
::close( sd); //close sound device
// sdfd=0;
// sd=0;
// qDebug( "closed dsp" );
return true;
}
bool Device::setDeviceFormat( int form) {
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 1141faa..c237726 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -50,68 +50,75 @@ using namespace Opie::Core;
#include <sys/types.h>
#include <sys/vfs.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/signal.h>
#include <pthread.h>
#ifdef PDAUDIO //ALSA
#include <alsa/asoundlib.h>
static int deviceSampleRates[8] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000, -1 };
static int deviceBitRates[] = { 8, 16, 24, 32, -1 };
#else //OSS
static int deviceSampleRates[6] = { 11025, 16000, 22050, 32000, 44100, -1 };
static int deviceBitRates[] = { 8, 16, -1 };
#endif
#if defined(QT_QWS_SL5XXX)
///#if defined(QT_QWS_EBX)
#define DSPSTROUT "/dev/dsp"
#define DSPSTRMIXEROUT "/dev/mixer"
#ifdef SHARP
#define DSPSTRIN "/dev/dsp1"
#define DSPSTRMIXERIN "/dev/mixer1"
#else
#define DSPSTRIN "/dev/dsp"
#define DSPSTRMIXERIN "/dev/mixer"
#endif
#else
+#ifdef QT_QWS_DEVFS
+#define DSPSTROUT "/dev/sound/dsp"
+#define DSPSTRIN "/dev/sound/dsp"
+#define DSPSTRMIXERIN "/dev/sound/mixer"
+#define DSPSTRMIXEROUT "/dev/sound/mixer"
+#else
#define DSPSTROUT "/dev/dsp"
#define DSPSTRIN "/dev/dsp"
#define DSPSTRMIXERIN "/dev/mixer"
#define DSPSTRMIXEROUT "/dev/mixer"
+#endif
#endif
//#define ZAURUS 0
struct adpcm_state encoder_state;
struct adpcm_state decoder_state;
typedef struct {
int sampleRate;
/* int fragSize; */
/* int blockSize; */
int resolution; //bitrate
int channels; //number of channels
int fd; //file descriptor
int sd; //sound device descriptor
int numberSamples; //total number of samples
int SecondsToRecord; // number of seconds that should be recorded
float numberOfRecordedSeconds; //total number of samples recorded
int samplesToRecord; //number of samples to be recorded
int inVol; //input volume
int outVol; //output volume
int format; //wavfile format PCM.. ADPCM
const char *fileName; //name of fiel to be played/recorded
} fileParameters;
fileParameters filePara;
bool monitoring, recording, playing;
bool stopped;
QLabel *timeLabel;
QSlider *timeSlider;
int sd;