-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 14 |
2 files changed, 15 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index ad44abb..e0989d0 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp @@ -202,8 +202,10 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { int fragments = 0x10000 * 8 + sound_fragment_shift; int capabilities = 0; + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; + #ifdef KEEP_DEVICE_OPEN if ( AudioDevicePrivate::dspFd == 0 ) { #endif if ( ( d->handle = ::open( "/dev/dsp", O_WRONLY ) ) < 0 ) { @@ -243,13 +245,17 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; + } AudioDevice::~AudioDevice() { qDebug("destryo audiodevice"); + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; + #ifdef Q_OS_WIN32 waveOutClose( (HWAVEOUT)d->handle ); #else # ifndef KEEP_DEVICE_OPEN @@ -257,8 +263,10 @@ AudioDevice::~AudioDevice() { # endif delete d->unwrittenBuffer; delete d; #endif + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; + } void AudioDevice::volumeChanged( bool muted ) diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 6f86b4a..3171c4b 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -236,16 +236,16 @@ void LoopControl::startAudio() { long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; long sampleWaitTime = currentSample - sampleWeShouldBeAt; // this causes drop outs not sure why its even here -// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { -// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); -// } -// else if ( sampleWaitTime <= -5000 ) { -// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); + if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { + usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); + } + else if ( sampleWaitTime <= -5000 ) { + qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); -// currentSample = sampleWeShouldBeAt; -// } + currentSample = sampleWeShouldBeAt; + } audioDevice->write( audioBuffer, samplesRead * 2 * channels ); if( mediaPlayerState->isStreaming == FALSE) |