Results 1 to 2 of 2

Thread: Set Volume Level on Embedded Linux with Qt 4.8

  1. #1
    Join Date
    Jun 2019
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Set Volume Level on Embedded Linux with Qt 4.8

    Hi,

    i am trying to set Volume Level using Phonon Library and VolumeSlider widget.
    it works and changes the current volume level but after closing form and play a sound file, nothing changes in volume level.

    here my code:

    //on constructor of form:

    mediaObject = new Phonon::MediaObject(this);
    mediaObject->setCurrentSource(Phonon::MediaSource("/home/root/aaa.wav"));
    audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);

    Phonon::Path path = Phonon::createPath(mediaObject, audioOutput);

    connect(audioOutput,SIGNAL(volumeChanged(qreal)),t his,SLOT(volumeChanged(qreal)));

    volumeSlider = new Phonon::VolumeSlider;
    volumeSlider->setAudioOutput(audioOutput);
    ui->verticalLayoutSound->addWidget(volumeSlider,1,Qt::AlignCenter);
    volumeSlider->setGeometry(0,0,200,30);
    volumeSlider->setOrientation(Qt::Orientation::Vertical);
    volumeSlider->setMouseTracking(true);
    volumeSlider->setUpdatesEnabled(true);
    volumeSlider->show();

    //and slot:

    void formDiagnostic::volumeChanged(qreal newLevel)
    {
    qreal volumeLevel = audioOutput->volume();
    qDebug() << "Volume Changed To:" << volumeLevel;//this works
    }

    thanx in advance..

  2. #2
    Join Date
    Jun 2019
    Posts
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Set Volume Level on Embedded Linux with Qt 4.8

    i solved the problem parsing command with QProcess.
    i used my sound device commands.
    "amixer get PCM" to get the sound level information
    "amixer set PCM 100%" to set the level information.

Similar Threads

  1. Replies: 2
    Last Post: 18th November 2015, 14:57
  2. Volume Slider changes nothing in terms of volume
    By zgulser in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2012, 16:55
  3. Replies: 5
    Last Post: 25th April 2012, 12:34
  4. Multiple apps using Qt/Embedded+Qtopia on Embedded Linux
    By drahardja in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 17th February 2008, 22:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.