Results 1 to 10 of 10

Thread: help needed to write a render class

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default help needed to write a render class

    Hi to all,
    unfortunately I'm having some problems in writing a Qt class to render an audio wave, so I decide to pay some expert ( that I'm not ) to help me.

    I hope to get some feedback.
    Regards,
    Franco
    Franco Amato

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: help needed to write a render class

    What is your question please?

  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: help needed to write a render class

    Quote Originally Posted by tbscope View Post
    What is your question please?
    My question is: can someone help me in writing such class?
    I'll pay something for that help.
    Franco Amato

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: help needed to write a render class

    Check out these programs:
    http://qt-apps.org/index.php?xcontentmode=4220

    I'm sure there's something there that displays a waveform.
    Try to take a look at the source code on how they did it.

  5. #5
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: help needed to write a render class

    Quote Originally Posted by tbscope View Post
    Check out these programs:
    http://qt-apps.org/index.php?xcontentmode=4220

    I'm sure there's something there that displays a waveform.
    Try to take a look at the source code on how they did it.

    Dear tbscope,
    I already draw a waveform ( is not so hard ).
    The help I need is to:
    1. convert my wave widget from QWidget to QAbstractScrollArea ( from wysota )
    2. improve the render algorithm to speed up the render time


    From Johan thelin: draw the whole waveform in sub pixmap and render only one at time ( using a separate thread I think ), but I have no idea on how to do it and unfortunately now I'm on another project.

    So I hope to get some help here.
    Franco Amato

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: help needed to write a render class

    You should have mentioned that at the beginning.

    Anyway, post your code so others can give their opinion.

  7. #7
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: help needed to write a render class

    Quote Originally Posted by tbscope View Post
    You should have mentioned that at the beginning.
    Sorry if I I have not been clear.

    Anyway, post your code so others can give their opinion.
    Which code must I post? It's large and I'm not sure wysota will be happy ;-)
    Meanwhile now my render class inherits from QWidget. I have to change the parent to QAbstractScrollArea as now It doesn't work well.

    I can post the render routine.

    I have to cut the code and post only the relevant part.
    Franco Amato

  8. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: help needed to write a render class

    Post the relevant parts, like the widget that displays the waveform.
    You can attach them.

  9. #9
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: help needed to write a render class

    Quote Originally Posted by tbscope View Post
    Post the relevant parts, like the widget that displays the waveform.
    You can attach them.
    Ok I'm attaching wavedisplay.h and wavedisplay.cpp.
    You can see that it inherits from QWidget that's not the correct way ( thanx wysota ), I have to change it to QAbstractScrollArea because in the render I would keep some text at a fixed position whyle the whole wave is scrolled when playing. And I also would move the whole wave moving the scrollbar position without repainting every time.

    The relevant routines are:
    WaveDisplay::setWave( SoundData* w )
    WaveDisplay:aintEvent( QPaintEvent* pe )
    WaveDisplay::updateWave()
    WaveDisplay::resizeEvent( QResizeEvent * re )
    WaveDisplay::drawStandardPCM16( QPainter& painter, int numSamples )

    When I calculate the wave ( see drawStandardPCM16 ) I put the result in a QPixmap that I use as cache ( see updateWave ) then in the paintEvent basically I draw the cache context.
    I call updateWave only when the wave changes ( for example in the resizeEvent or when zooming ), if not I draw the cache content.
    The problem is that my sounds are very large ( 1 hour of sound 16 bits mono ) and it take loooong time to update/render the wave.
    So I would write some smart algorithm to draw the huge wave in parts, maybe depending of the scrollbar position ( I think in a separate thread).

    This is the help I have.
    I hope to get some answer, If more informations are needed I can share the code.

    Regards,
    Franco
    Attached Files Attached Files
    Franco Amato

  10. #10
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: help needed to write a render class

    There is another issue in dividing the pixmap in parts and rendering only one at time.
    When I play the sound the wave should be shifted from right to left ( simulating the time that spends ).
    Doing so I should have infinite ( or many ) pixmaps to have a continuous effect and not a "discrete" effect.
    So my idea is to fill the full image in a thread and render fragment of it.
    So how can I do it?

    Bye
    Franco Amato

Similar Threads

  1. Replies: 6
    Last Post: 7th December 2010, 12:32
  2. Replies: 1
    Last Post: 3rd June 2010, 02:43
  3. Solution for render text in some low-level class
    By deedw in forum Qt Programming
    Replies: 0
    Last Post: 19th April 2010, 12:45
  4. QtableView Render to
    By jamesjara in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2009, 19:53
  5. Qwt 5 - render TeX text
    By ak in forum Qwt
    Replies: 2
    Last Post: 1st May 2007, 09:08

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.