Results 1 to 8 of 8

Thread: Unable to play audio from memory.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Unable to play audio from memory.

    Hi!

    I want to load a sound from memory and play it but I don't heard anything.

    Here is the code :

    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QMediaPlayer>
    3. #include <QBuffer>
    4. #include <QIODevice>
    5. int main(int argc, char *argv[])
    6. {
    7. QCoreApplication a(argc, argv);
    8. unsigned short samples[1000000];
    9. for (unsigned int i = 0; i < sizeof(samples) / sizeof(float); i++) {
    10. samples[i] = 1000;
    11. }
    12. QByteArray byteArray((const char*) samples,sizeof(samples));
    13. QBuffer mediaStream(&byteArray);
    14. QMediaPlayer mp;
    15. mp.setMedia(QMediaContent(),&mediaStream);
    16. mp.play();
    17. return a.exec();
    18. }
    To copy to clipboard, switch view to plain text mode 

    Here is the error message :
    Qt Code:
    1. GStreamer; Unable to pause - ""
    2. Error : "No URI set"
    To copy to clipboard, switch view to plain text mode 
    Last edited by LaurentDuroisin; 28th January 2016 at 10:15.

Similar Threads

  1. How to record and play audio on N8
    By doubleti in forum Newbie
    Replies: 0
    Last Post: 1st December 2011, 11:46
  2. play audio file
    By hema in forum Qt Quick
    Replies: 1
    Last Post: 11th August 2011, 05:27
  3. how to play audio file in qml
    By hema in forum Newbie
    Replies: 0
    Last Post: 10th August 2011, 10:57
  4. Unable to play audio outside Qt creator
    By somnathbanik in forum Newbie
    Replies: 0
    Last Post: 9th November 2010, 06:47
  5. play audio url
    By tungvc in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 11:04

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.