|
|
|
@ -248,8 +248,8 @@ bool AlsaSoundDevice::prepareCapture(SoundStreamID id, const TQString &channel)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::releasePlayback(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.contains(id)) {
|
|
|
|
|
if (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id)) {
|
|
|
|
|
stopPlayback(id);
|
|
|
|
|
}
|
|
|
|
|
m_PlaybackStreams.remove(id);
|
|
|
|
@ -260,7 +260,7 @@ bool AlsaSoundDevice::releasePlayback(SoundStreamID id)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::releaseCapture(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && m_CaptureStreams.tqcontains(id)) {
|
|
|
|
|
if (id.isValid() && m_CaptureStreams.contains(id)) {
|
|
|
|
|
if (m_CaptureStreamID == id) {
|
|
|
|
|
stopCapture(id);
|
|
|
|
|
}
|
|
|
|
@ -284,7 +284,7 @@ bool AlsaSoundDevice::supportsCapture() const
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::startPlayback(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.tqcontains(id) && m_EnablePlayback) {
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.contains(id) && m_EnablePlayback) {
|
|
|
|
|
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
|
|
|
|
@ -295,7 +295,7 @@ bool AlsaSoundDevice::startPlayback(SoundStreamID id)
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!m_PassivePlaybackStreams.tqcontains(id))
|
|
|
|
|
if (!m_PassivePlaybackStreams.contains(id))
|
|
|
|
|
m_PassivePlaybackStreams.append(id);
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
@ -326,12 +326,12 @@ bool AlsaSoundDevice::pausePlayback(SoundStreamID /*id*/)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::stopPlayback(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (id.isValid() && m_PlaybackStreams.contains(id)) {
|
|
|
|
|
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
|
|
|
|
|
if (!cfg.m_ActiveMode) {
|
|
|
|
|
if (m_PassivePlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (m_PassivePlaybackStreams.contains(id)) {
|
|
|
|
|
/* float tmp = 0;
|
|
|
|
|
writePlaybackMixerVolume(cfg.m_Channel, tmp, true);*/
|
|
|
|
|
m_PassivePlaybackStreams.remove(id);
|
|
|
|
@ -351,7 +351,7 @@ bool AlsaSoundDevice::stopPlayback(SoundStreamID id)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::isPlaybackRunning(SoundStreamID id, bool &b) const
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (id.isValid() && m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id)) {
|
|
|
|
|
b = true;
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
@ -364,7 +364,7 @@ bool AlsaSoundDevice::startCaptureWithFormat(SoundStreamID id,
|
|
|
|
|
SoundFormat &real_format,
|
|
|
|
|
bool force_format)
|
|
|
|
|
{
|
|
|
|
|
if (m_CaptureStreams.tqcontains(id) && m_EnableCapture) {
|
|
|
|
|
if (m_CaptureStreams.contains(id) && m_EnableCapture) {
|
|
|
|
|
|
|
|
|
|
if (m_CaptureStreamID != id) {
|
|
|
|
|
m_CapturePos = 0;
|
|
|
|
@ -454,7 +454,7 @@ bool AlsaSoundDevice::isCaptureRunning(SoundStreamID id, bool &b, SoundFormat &s
|
|
|
|
|
bool AlsaSoundDevice::noticeSoundStreamClosed(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
bool found = false;
|
|
|
|
|
if (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id)) {
|
|
|
|
|
if (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id)) {
|
|
|
|
|
stopPlayback(id);
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
@ -471,13 +471,13 @@ bool AlsaSoundDevice::noticeSoundStreamClosed(SoundStreamID id)
|
|
|
|
|
bool AlsaSoundDevice::noticeSoundStreamRedirected(SoundStreamID oldID, SoundStreamID newID)
|
|
|
|
|
{
|
|
|
|
|
bool found = false;
|
|
|
|
|
if (m_PlaybackStreams.tqcontains(oldID)) {
|
|
|
|
|
if (m_PlaybackStreams.contains(oldID)) {
|
|
|
|
|
m_PlaybackStreams.insert(newID, m_PlaybackStreams[oldID]);
|
|
|
|
|
if (newID != oldID)
|
|
|
|
|
m_PlaybackStreams.remove(oldID);
|
|
|
|
|
found = true;
|
|
|
|
|
}
|
|
|
|
|
if (m_CaptureStreams.tqcontains(oldID)) {
|
|
|
|
|
if (m_CaptureStreams.contains(oldID)) {
|
|
|
|
|
m_CaptureStreams.insert(newID, m_CaptureStreams[oldID]);
|
|
|
|
|
if (newID != oldID)
|
|
|
|
|
m_CaptureStreams.remove(oldID);
|
|
|
|
@ -488,7 +488,7 @@ bool AlsaSoundDevice::noticeSoundStreamRedirected(SoundStreamID oldID, SoundStre
|
|
|
|
|
m_PlaybackStreamID = newID;
|
|
|
|
|
if (m_CaptureStreamID == oldID)
|
|
|
|
|
m_CaptureStreamID = newID;
|
|
|
|
|
if (m_PassivePlaybackStreams.tqcontains(oldID)) {
|
|
|
|
|
if (m_PassivePlaybackStreams.contains(oldID)) {
|
|
|
|
|
m_PassivePlaybackStreams.remove(oldID);
|
|
|
|
|
m_PassivePlaybackStreams.append(newID);
|
|
|
|
|
}
|
|
|
|
@ -1088,7 +1088,7 @@ const TQStringList &AlsaSoundDevice::getCaptureChannels() const
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::setPlaybackVolume(SoundStreamID id, float volume)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id))) {
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id))) {
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
|
|
|
|
|
if (rint(100*volume) != rint(100*cfg.m_Volume)) {
|
|
|
|
@ -1120,7 +1120,7 @@ bool AlsaSoundDevice::setCaptureVolume(SoundStreamID id, float volume)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::getPlaybackVolume(SoundStreamID id, float &volume) const
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id))) {
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id))) {
|
|
|
|
|
const SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
volume = cfg.m_Volume;
|
|
|
|
|
return true;
|
|
|
|
@ -1144,7 +1144,7 @@ void AlsaSoundDevice::checkMixerVolume(SoundStreamID id)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid()) {
|
|
|
|
|
|
|
|
|
|
if (m_hPlaybackMixer && m_PassivePlaybackStreams.tqcontains(id) || m_PlaybackStreamID == id) {
|
|
|
|
|
if (m_hPlaybackMixer && m_PassivePlaybackStreams.contains(id) || m_PlaybackStreamID == id) {
|
|
|
|
|
snd_mixer_handle_events(m_hPlaybackMixer);
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
|
|
|
|
@ -1164,7 +1164,7 @@ void AlsaSoundDevice::checkMixerVolume(SoundStreamID id)
|
|
|
|
|
snd_mixer_handle_events(m_hCaptureMixer);
|
|
|
|
|
SoundStreamConfig &cfg = m_CaptureStreams[id];
|
|
|
|
|
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(cfg.m_Channel)) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(cfg.m_Channel)) {
|
|
|
|
|
float v = readCaptureMixerVolume(cfg.m_Channel);
|
|
|
|
|
if (rint(100*cfg.m_Volume) != rint(100*v)) {
|
|
|
|
|
cfg.m_Volume = v;
|
|
|
|
@ -1181,7 +1181,7 @@ float AlsaSoundDevice::readPlaybackMixerVolume(const TQString &channel, bool &mu
|
|
|
|
|
if (!m_hPlaybackMixer)
|
|
|
|
|
return 0; // without error
|
|
|
|
|
|
|
|
|
|
if (m_PlaybackChannels2ID.tqcontains(channel) && m_hPlaybackMixer) {
|
|
|
|
|
if (m_PlaybackChannels2ID.contains(channel) && m_hPlaybackMixer) {
|
|
|
|
|
AlsaMixerElement sid = m_PlaybackChannels2ID[channel];
|
|
|
|
|
snd_mixer_elem_t *elem = snd_mixer_find_selem(m_hPlaybackMixer, sid);
|
|
|
|
|
if (elem) {
|
|
|
|
@ -1215,7 +1215,7 @@ float AlsaSoundDevice::readCaptureMixerVolume(const TQString &channel) const
|
|
|
|
|
if (!m_hCaptureMixer)
|
|
|
|
|
return 0; // without error
|
|
|
|
|
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(channel) && m_hCaptureMixer) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(channel) && m_hCaptureMixer) {
|
|
|
|
|
AlsaMixerElement sid = m_CaptureChannels2ID[channel];
|
|
|
|
|
snd_mixer_elem_t *elem = snd_mixer_find_selem(m_hCaptureMixer, sid);
|
|
|
|
|
if (elem) {
|
|
|
|
@ -1248,7 +1248,7 @@ bool AlsaSoundDevice::writePlaybackMixerVolume (const TQString &channel, float &
|
|
|
|
|
if (!m_hPlaybackMixer)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (m_PlaybackChannels2ID.tqcontains(channel) && m_hPlaybackMixer) {
|
|
|
|
|
if (m_PlaybackChannels2ID.contains(channel) && m_hPlaybackMixer) {
|
|
|
|
|
AlsaMixerElement sid = m_PlaybackChannels2ID[channel];
|
|
|
|
|
snd_mixer_elem_t *elem = snd_mixer_find_selem(m_hPlaybackMixer, sid);
|
|
|
|
|
if (elem) {
|
|
|
|
@ -1284,7 +1284,7 @@ bool AlsaSoundDevice::writeCaptureMixerVolume (const TQString &channel, float &v
|
|
|
|
|
if (!m_hCaptureMixer)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(channel) && m_hCaptureMixer) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(channel) && m_hCaptureMixer) {
|
|
|
|
|
AlsaMixerElement sid = m_CaptureChannels2ID[channel];
|
|
|
|
|
snd_mixer_elem_t *elem = snd_mixer_find_selem(m_hCaptureMixer, sid);
|
|
|
|
|
if (elem) {
|
|
|
|
@ -1314,7 +1314,7 @@ bool AlsaSoundDevice::writeCaptureMixerSwitch (const TQString &channel, bool cap
|
|
|
|
|
if (!m_hCaptureMixer)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.tqcontains(channel) && m_hCaptureMixer) {
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.contains(channel) && m_hCaptureMixer) {
|
|
|
|
|
AlsaMixerElement sid = m_CaptureChannelsSwitch2ID[channel];
|
|
|
|
|
snd_mixer_elem_t *elem = snd_mixer_find_selem(m_hCaptureMixer, sid);
|
|
|
|
|
if (elem) {
|
|
|
|
@ -1337,7 +1337,7 @@ void AlsaSoundDevice::selectCaptureChannel (const TQString &channel)
|
|
|
|
|
writeCaptureMixerSwitch(channel, true);
|
|
|
|
|
|
|
|
|
|
const TQString ADC = "ADC";
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(ADC)) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(ADC)) {
|
|
|
|
|
float v = readCaptureMixerVolume(ADC);
|
|
|
|
|
if (rint(v*100) == 0) {
|
|
|
|
|
float tmp_vol = 1.0;
|
|
|
|
@ -1345,7 +1345,7 @@ void AlsaSoundDevice::selectCaptureChannel (const TQString &channel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const TQString Digital = "Digital";
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(Digital)) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(Digital)) {
|
|
|
|
|
float v = readCaptureMixerVolume(Digital);
|
|
|
|
|
if (rint(v*100) == 0) {
|
|
|
|
|
float tmp_vol = 1.0;
|
|
|
|
@ -1353,12 +1353,12 @@ void AlsaSoundDevice::selectCaptureChannel (const TQString &channel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const TQString WAVE = "Wave";
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(WAVE)) {
|
|
|
|
|
if (m_CaptureChannels2ID.contains(WAVE)) {
|
|
|
|
|
float x = 0;
|
|
|
|
|
writeCaptureMixerVolume(WAVE, x);
|
|
|
|
|
}
|
|
|
|
|
const TQString Capture = "Capture";
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.tqcontains(Capture)) {
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.contains(Capture)) {
|
|
|
|
|
writeCaptureMixerSwitch(Capture, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1366,9 +1366,9 @@ void AlsaSoundDevice::selectCaptureChannel (const TQString &channel)
|
|
|
|
|
const AlsaConfigMixerSetting &s = *it;
|
|
|
|
|
if (s.m_card == m_CaptureCard && s.m_use) {
|
|
|
|
|
float vol = s.m_volume;
|
|
|
|
|
if (m_CaptureChannels2ID.tqcontains(s.m_name))
|
|
|
|
|
if (m_CaptureChannels2ID.contains(s.m_name))
|
|
|
|
|
writeCaptureMixerVolume(s.m_name, vol);
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.tqcontains(s.m_name))
|
|
|
|
|
if (m_CaptureChannelsSwitch2ID.contains(s.m_name))
|
|
|
|
|
writeCaptureMixerSwitch(s.m_name, s.m_active);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1451,7 +1451,7 @@ TQString AlsaSoundDevice::getSoundStreamClientDescription() const
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::mute (SoundStreamID id, bool mute)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id))) {
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id))) {
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
if (mute != cfg.m_Muted) {
|
|
|
|
|
if (writePlaybackMixerVolume(cfg.m_Channel, cfg.m_Volume, cfg.m_Muted = mute)) {
|
|
|
|
@ -1465,7 +1465,7 @@ bool AlsaSoundDevice::mute (SoundStreamID id, bool mute)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::unmute (SoundStreamID id, bool unmute)
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id))) {
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id))) {
|
|
|
|
|
SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
bool mute = !unmute;
|
|
|
|
|
if (mute != cfg.m_Muted) {
|
|
|
|
@ -1480,7 +1480,7 @@ bool AlsaSoundDevice::unmute (SoundStreamID id, bool unmute)
|
|
|
|
|
|
|
|
|
|
bool AlsaSoundDevice::isMuted(SoundStreamID id, bool &m) const
|
|
|
|
|
{
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.tqcontains(id))) {
|
|
|
|
|
if (id.isValid() && (m_PlaybackStreamID == id || m_PassivePlaybackStreams.contains(id))) {
|
|
|
|
|
const SoundStreamConfig &cfg = m_PlaybackStreams[id];
|
|
|
|
|
m = cfg.m_Muted;
|
|
|
|
|
return true;
|
|
|
|
|