@ -150,7 +150,7 @@ void AlsaSoundDevice::saveState (KConfig *c) const
int i = 0 ;
for ( TQMapConstIterator < TQString , AlsaConfigMixerSetting > it = m_CaptureMixerSettings . begin ( ) ; it ! = m_CaptureMixerSettings . end ( ) ; + + it , + + i ) {
TQString prefix = TQString ( " mixer-setting-%1- " ) . tq arg( i ) ;
TQString prefix = TQString ( " mixer-setting-%1- " ) . arg( i ) ;
( * it ) . saveState ( c , prefix ) ;
}
@ -179,7 +179,7 @@ void AlsaSoundDevice::restoreState (KConfig *c)
int n = c - > readNumEntry ( " mixer-settings " , 0 ) ;
for ( int i = 0 ; i < n ; + + i ) {
TQString prefix = TQString ( " mixer-setting-%1- " ) . tq arg( i ) ;
TQString prefix = TQString ( " mixer-setting-%1- " ) . arg( i ) ;
AlsaConfigMixerSetting s ( c , prefix ) ;
m_CaptureMixerSettings . insert ( s . getIDString ( ) , s ) ;
}
@ -418,9 +418,9 @@ bool AlsaSoundDevice::stopCapture(SoundStreamID id)
slotPollCapture ( ) ;
// if (m_captureThread->error()) {
// logError(i18n("ALSA Plugin, device plughw:%1,%2: %3"). tq arg(m_CaptureCard)
// . tq arg(m_CaptureDevice)
// . tq arg(i18n("unknown error")));
// logError(i18n("ALSA Plugin, device plughw:%1,%2: %3"). arg(m_CaptureCard)
// . arg(m_CaptureDevice)
// . arg(i18n("unknown error")));
// }
//
// delete m_captureThread;
@ -526,7 +526,7 @@ bool AlsaSoundDevice::noticeSoundStreamData(SoundStreamID id,
/* if (n < size) {
m_PlaybackSkipCount + = size - n ;
} else if ( m_PlaybackSkipCount > 0 ) {
logWarning ( i18n ( " plughw:%1,%2: Playback buffer overflow. Skipped %3 bytes " ) . tq arg( m_PlaybackCard ) . tq arg( m_PlaybackDevice ) . tq arg( TQString : : number ( m_PlaybackSkipCount ) ) ) ;
logWarning ( i18n ( " plughw:%1,%2: Playback buffer overflow. Skipped %3 bytes " ) . arg( m_PlaybackCard ) . arg( m_PlaybackDevice ) . arg( TQString : : number ( m_PlaybackSkipCount ) ) ) ;
m_PlaybackSkipCount = 0 ;
}
return m_PlaybackSkipCount = = 0 ; */
@ -550,12 +550,12 @@ void AlsaSoundDevice::slotPollPlayback()
if ( framesWritten > 0 ) {
m_PlaybackBuffer . removeData ( bytesWritten ) ;
} else if ( framesWritten = = 0 ) {
logError ( i18n ( " ALSA Plugin: cannot write data for device plughw:%1,%2 " ) . tq arg( m_PlaybackCard ) . tq arg( m_PlaybackDevice ) ) ;
logError ( i18n ( " ALSA Plugin: cannot write data for device plughw:%1,%2 " ) . arg( m_PlaybackCard ) . arg( m_PlaybackDevice ) ) ;
} else if ( framesWritten = = - EAGAIN ) {
// do nothing
} else {
snd_pcm_prepare ( m_hPlayback ) ;
logWarning ( i18n ( " ALSA Plugin: buffer underrun for device plughw:%1,%2 " ) . tq arg( m_PlaybackCard ) . tq arg( m_PlaybackDevice ) ) ;
logWarning ( i18n ( " ALSA Plugin: buffer underrun for device plughw:%1,%2 " ) . arg( m_PlaybackCard ) . arg( m_PlaybackDevice ) ) ;
}
}
@ -577,7 +577,7 @@ void AlsaSoundDevice::slotPollCapture()
if ( m_CaptureStreamID . isValid ( ) & & m_hCapture ) {
// while (m_captureThread && m_captureThread->getAvailableReadBuffers()) {
// TQString dev = TQString("alsa://plughw:%1,%2"). tq arg(m_CaptureCard).tq arg(m_CaptureDevice);
// TQString dev = TQString("alsa://plughw:%1,%2"). arg(m_CaptureCard).arg(m_CaptureDevice);
// size_t size = 0;
// char *buffer = m_captureThread->getReadBuffer(size);
// time_t cur_time = time(NULL);
@ -608,22 +608,22 @@ void AlsaSoundDevice::slotPollCapture()
m_CaptureBuffer . removeFreeSpace ( bytesRead ) ;
} else if ( framesRead = = 0 ) {
snd_pcm_prepare ( m_hCapture ) ;
logError ( i18n ( " ALSA Plugin: cannot read data from device plughw:%1,%2 " ) . tq arg( m_CaptureCard ) . tq arg( m_CaptureDevice ) ) ;
logError ( i18n ( " ALSA Plugin: cannot read data from device plughw:%1,%2 " ) . arg( m_CaptureCard ) . arg( m_CaptureDevice ) ) ;
} else if ( framesRead = = - EAGAIN ) {
// do nothing
} else {
snd_pcm_prepare ( m_hCapture ) ;
logWarning ( i18n ( " ALSA Plugin: buffer overrun for device plughw:%1,%2 (buffersize=%3, buffer=%4) " ) . tq arg( m_CaptureCard ) . tq arg( m_CaptureDevice ) . tq arg( bufferSize ) . tq arg( ( long long unsigned ) buffer ) ) ;
logWarning ( i18n ( " ALSA Plugin: buffer overrun for device plughw:%1,%2 (buffersize=%3, buffer=%4) " ) . arg( m_CaptureCard ) . arg( m_CaptureDevice ) . arg( bufferSize ) . arg( ( long long unsigned ) buffer ) ) ;
}
TQString dev = TQString ( " alsa://plughw:%1,%2 " ) . tq arg( m_CaptureCard ) . tq arg( m_CaptureDevice ) ;
TQString dev = TQString ( " alsa://plughw:%1,%2 " ) . arg( m_CaptureCard ) . arg( m_CaptureDevice ) ;
while ( m_CaptureBuffer . getFillSize ( ) > m_CaptureBuffer . getSize ( ) / 3 ) {
size_t size = 0 ;
buffer = m_CaptureBuffer . getData ( size ) ;
time_t cur_time = time ( NULL ) ;
size_t consumed_size = SIZE_T_DONT_CARE ;
notifySoundStreamData ( m_CaptureStreamID , m_CaptureFormat , buffer , size , consumed_size , SoundMetaData ( m_CapturePos , cur_time - m_CaptureStartTime , cur_time , i18n ( " internal stream, not stored (%1) " ) . tq arg( dev ) ) ) ;
notifySoundStreamData ( m_CaptureStreamID , m_CaptureFormat , buffer , size , consumed_size , SoundMetaData ( m_CapturePos , cur_time - m_CaptureStartTime , cur_time , i18n ( " internal stream, not stored (%1) " ) . arg( dev ) ) ) ;
if ( consumed_size = = SIZE_T_DONT_CARE )
consumed_size = size ;
@ -664,7 +664,7 @@ bool AlsaSoundDevice::openPlaybackDevice(const SoundFormat &format, bool reopen)
m_PlaybackFormat = format ;
TQString dev = TQString ( " plughw:%1,%2 " ) . tq arg( m_PlaybackCard ) . tq arg( m_PlaybackDevice ) ;
TQString dev = TQString ( " plughw:%1,%2 " ) . arg( m_PlaybackCard ) . arg( m_PlaybackDevice ) ;
bool error = ! openAlsaDevice ( m_hPlayback , m_PlaybackFormat , dev . ascii ( ) , SND_PCM_STREAM_PLAYBACK , SND_PCM_NONBLOCK , m_PlaybackLatency ) ;
if ( ! error ) {
@ -704,7 +704,7 @@ bool AlsaSoundDevice::openCaptureDevice(const SoundFormat &format, bool reopen)
m_CaptureFormat = format ;
TQString dev = TQString ( " plughw:%1,%2 " ) . tq arg( m_CaptureCard ) . tq arg( m_CaptureDevice ) ;
TQString dev = TQString ( " plughw:%1,%2 " ) . arg( m_CaptureCard ) . arg( m_CaptureDevice ) ;
// bool error = !openAlsaDevice(m_hCapture, m_CaptureFormat, dev.ascii(), SND_PCM_STREAM_CAPTURE, /*flags = block*/0, m_CaptureLatency);
bool error = ! openAlsaDevice ( m_hCapture , m_CaptureFormat , dev . ascii ( ) , SND_PCM_STREAM_CAPTURE , SND_PCM_NONBLOCK , m_CaptureLatency ) ;
@ -733,19 +733,19 @@ bool AlsaSoundDevice::openAlsaDevice(snd_pcm_t *&alsa_handle, SoundFormat &forma
/* OPEN */
if ( ! error & & snd_pcm_open ( & alsa_handle , pcm_name , stream , flags ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error opening PCM device %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error opening PCM device %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
if ( ! error & & snd_pcm_hw_params_any ( alsa_handle , hwparams ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Can not configure PCM device %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Can not configure PCM device %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
/* interleaved access type */
if ( ! error & & snd_pcm_hw_params_set_access ( alsa_handle , hwparams , SND_PCM_ACCESS_RW_INTERLEAVED ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error setting access for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error setting access for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
@ -755,30 +755,30 @@ bool AlsaSoundDevice::openAlsaDevice(snd_pcm_t *&alsa_handle, SoundFormat &forma
! format . m_IsSigned ,
format . m_Endianess = = BIG_ENDIAN ) ;
if ( ! error & & snd_pcm_hw_params_set_format ( alsa_handle , hwparams , sample_format ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error setting sample format for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error setting sample format for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
/* channels */
if ( ! error & & snd_pcm_hw_params_set_channels ( alsa_handle , hwparams , format . m_Channels ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error setting channels for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error setting channels for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
/* sample rate */
int rate = format . m_SampleRate ;
if ( ! error & & snd_pcm_hw_params_set_rate_near ( alsa_handle , hwparams , & format . m_SampleRate , & dir ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error setting rate for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error setting rate for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
if ( ! error & & format . m_SampleRate ! = format . m_SampleRate ) {
logWarning ( i18n ( " ALSA Plugin: The rate %1 Hz is not supported by your hardware %2. Using %3 Hz instead " ) . tq arg( rate ) . tq arg( pcm_name ) . tq arg( format . m_SampleRate ) ) ;
logWarning ( i18n ( " ALSA Plugin: The rate %1 Hz is not supported by your hardware %2. Using %3 Hz instead " ) . arg( rate ) . arg( pcm_name ) . arg( format . m_SampleRate ) ) ;
}
snd_pcm_uframes_t period_size = m_HWBufferSize / format . frameSize ( ) ;
if ( ! error & & snd_pcm_hw_params_set_period_size_near ( alsa_handle , hwparams , & period_size , & dir ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error setting period size for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error setting period size for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
@ -788,7 +788,7 @@ bool AlsaSoundDevice::openAlsaDevice(snd_pcm_t *&alsa_handle, SoundFormat &forma
//
// /* fragments */
// if (!error && snd_pcm_hw_params_set_periods(alsa_handle, hwparams, periods, 0) < 0) {
// logError(i18n("ALSA Plugin: Error setting periods for %1"). tq arg(pcm_name));
// logError(i18n("ALSA Plugin: Error setting periods for %1"). arg(pcm_name));
// error = true;
// }
@ -798,17 +798,17 @@ bool AlsaSoundDevice::openAlsaDevice(snd_pcm_t *&alsa_handle, SoundFormat &forma
// if (!error && snd_pcm_hw_params_set_buffer_size_near(alsa_handle, hwparams, &exact_buffersize_frames) < 0) {
// exact_buffersize_frames = 4096;
// if (!error && snd_pcm_hw_params_set_buffer_size_near(alsa_handle, hwparams, &exact_buffersize_frames) < 0) {
// logError(i18n("ALSA Plugin: Error setting buffersize for %1"). tq arg(pcm_name));
// logError(i18n("ALSA Plugin: Error setting buffersize for %1"). arg(pcm_name));
// error = true;
// }
// }
// size_t exact_buffersize = exact_buffersize_frames * format.frameSize();
// if (!error && m_HWBufferSize != exact_buffersize) {
// logWarning(i18n("ALSA Plugin: Hardware %1 does not support buffer size of %2. Using buffer size of %3 instead."). tq arg(pcm_name).tq arg(m_HWBufferSize).tq arg(exact_buffersize));
// logWarning(i18n("ALSA Plugin: Hardware %1 does not support buffer size of %2. Using buffer size of %3 instead."). arg(pcm_name).arg(m_HWBufferSize).arg(exact_buffersize));
// size_t tmp = (((m_HWBufferSize - 1) / exact_buffersize) + 1) * exact_buffersize;
// setHWBufferSize(tmp);
// logInfo(i18n("ALSA Plugin: adjusted buffer size for %1 to %2 bytes"). tq arg(pcm_name).tq arg(TQString::number(tmp)));
// logInfo(i18n("ALSA Plugin: adjusted buffer size for %1 to %2 bytes"). arg(pcm_name).arg(TQString::number(tmp)));
// }
/* set all params */
@ -819,7 +819,7 @@ bool AlsaSoundDevice::openAlsaDevice(snd_pcm_t *&alsa_handle, SoundFormat &forma
}
if ( ! error & & snd_pcm_hw_params_get_period_size ( hwparams , & period_size , & dir ) < 0 ) {
logError ( i18n ( " ALSA Plugin: Error getting period size for %1 " ) . tq arg( pcm_name ) ) ;
logError ( i18n ( " ALSA Plugin: Error getting period size for %1 " ) . arg( pcm_name ) ) ;
error = true ;
}
@ -924,18 +924,18 @@ bool AlsaSoundDevice::openMixerDevice(snd_mixer_t *&mixer_handle, int card, bool
bool attached = false ;
if ( ! error ) {
if ( snd_mixer_attach ( mixer_handle , cardid . ascii ( ) ) < 0 ) {
staticLogError ( i18n ( " ALSA Plugin: ERROR: snd_mixer_attach for card %1 " ) . tq arg( card ) ) ;
staticLogError ( i18n ( " ALSA Plugin: ERROR: snd_mixer_attach for card %1 " ) . arg( card ) ) ;
error = true ;
} else {
attached = true ;
}
}
if ( ! error & & snd_mixer_selem_register ( mixer_handle , NULL , NULL ) < 0 ) {
staticLogError ( i18n ( " ALSA Plugin: Error: snd_mixer_selem_register for card %1 " ) . tq arg( card ) ) ;
staticLogError ( i18n ( " ALSA Plugin: Error: snd_mixer_selem_register for card %1 " ) . arg( card ) ) ;
error = true ;
}
if ( ! error & & snd_mixer_load ( mixer_handle ) < 0 ) {
staticLogError ( i18n ( " ALSA Plugin: Error: snd_mixer_load for card %1 " ) . tq arg( card ) ) ;
staticLogError ( i18n ( " ALSA Plugin: Error: snd_mixer_load for card %1 " ) . arg( card ) ) ;
error = true ;
}
if ( mixer_handle ) {
@ -1003,7 +1003,7 @@ void AlsaSoundDevice::getPlaybackMixerChannels(
TQString name = snd_mixer_selem_id_get_name ( sid ) ;
int idx = snd_mixer_selem_id_get_index ( sid ) ;
if ( idx )
name = i18n ( " context-mixername-number " , " %1 %2 " ) . tq arg( name ) . tq arg( idx ) ;
name = i18n ( " context-mixername-number " , " %1 %2 " ) . arg( name ) . arg( idx ) ;
if ( snd_mixer_selem_has_playback_volume ( elem ) ) {
ch2id [ name ] = sid ;
retval . append ( name ) ;
@ -1050,7 +1050,7 @@ void AlsaSoundDevice::getCaptureMixerChannels(
TQString name = snd_mixer_selem_id_get_name ( sid ) ;
int idx = snd_mixer_selem_id_get_index ( sid ) ;
if ( idx )
name = i18n ( " context-mixerelement-name-number " , " %1 %2 " ) . tq arg( name ) . tq arg( idx ) ;
name = i18n ( " context-mixerelement-name-number " , " %1 %2 " ) . arg( name ) . arg( idx ) ;
bool add2all = false ;
if ( snd_mixer_selem_has_capture_switch ( elem ) ) {
@ -1204,8 +1204,8 @@ float AlsaSoundDevice::readPlaybackMixerVolume(const TQString &channel, bool &mu
}
logError ( " AlsaSound::readPlaybackMixerVolume: " +
i18n ( " error while reading volume from hwplug:%1,%2 " )
. tq arg( m_PlaybackCard )
. tq arg( m_PlaybackDevice ) ) ;
. arg( m_PlaybackCard )
. arg( m_PlaybackDevice ) ) ;
return 0 ;
}
@ -1234,8 +1234,8 @@ float AlsaSoundDevice::readCaptureMixerVolume(const TQString &channel) const
}
logError ( " AlsaSound::readCaptureMixerVolume: " +
i18n ( " error while reading volume from hwplug:%1,%2 " )
. tq arg( m_CaptureCard )
. tq arg( m_CaptureDevice ) ) ;
. arg( m_CaptureCard )
. arg( m_CaptureDevice ) ) ;
return 0 ;
}
@ -1267,9 +1267,9 @@ bool AlsaSoundDevice::writePlaybackMixerVolume (const TQString &channel, float &
}
logError ( " AlsaSound::writePlaybackMixerVolume: " +
i18n ( " error while writing volume %1 to hwplug:%2,%3 " )
. tq arg( vol )
. tq arg( m_PlaybackCard )
. tq arg( m_PlaybackDevice ) ) ;
. arg( vol )
. arg( m_PlaybackCard )
. arg( m_PlaybackDevice ) ) ;
return false ;
}
@ -1302,9 +1302,9 @@ bool AlsaSoundDevice::writeCaptureMixerVolume (const TQString &channel, float &v
}
logError ( " AlsaSound::writeCaptureMixerVolume: " +
i18n ( " error while writing volume %1 to hwplug:%2,%3 " )
. tq arg( vol )
. tq arg( m_CaptureCard )
. tq arg( m_CaptureDevice ) ) ;
. arg( vol )
. arg( m_CaptureCard )
. arg( m_CaptureDevice ) ) ;
return false ;
}
@ -1325,9 +1325,9 @@ bool AlsaSoundDevice::writeCaptureMixerSwitch (const TQString &channel, bool cap
}
logError ( " AlsaSound::writeCaptureMixerSwitch: " +
i18n ( " error while setting capture switch %1 for hwplug:%2,%3 " )
. tq arg( channel )
. tq arg( m_CaptureCard )
. tq arg( m_CaptureDevice ) ) ;
. arg( channel )
. arg( m_CaptureCard )
. arg( m_CaptureDevice ) ) ;
return false ;
}
@ -1445,7 +1445,7 @@ void AlsaSoundDevice::setCaptureDevice(int card, int dev)
TQString AlsaSoundDevice : : getSoundStreamClientDescription ( ) const
{
return i18n ( " ALSA Sound Device %1 " ) . tq arg( PluginBase : : name ( ) ) ;
return i18n ( " ALSA Sound Device %1 " ) . arg( PluginBase : : name ( ) ) ;
}
@ -1520,9 +1520,9 @@ void AlsaSoundDevice::setCaptureMixerSettings(const TQMap<TQString, AlsaConfigMi
// if (m_captureThread) {
// AlsaCaptureEvent *e = static_cast<AlsaCaptureEvent*>(_e);
// TQString msg = i18n("ALSA Plugin, device plughw:%1,%2: %3")
// . tq arg(m_CaptureCard)
// . tq arg(m_CaptureDevice)
// . tq arg(e->message());
// . arg(m_CaptureCard)
// . arg(m_CaptureDevice)
// . arg(e->message());
// switch (_e->type()) {
// case CaptureError :
// logError(msg);