[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: Problems with artsflow example
From:       "Jeff Tranter" <jefft () corel ! com>
Date:       2001-03-28 20:16:48
[Download RAW message or body]

Here is the code. It did work on a machine running KDE 2.0,
but not with a recent CVS.

On Wednesday 28 March 2001 15:11, Jeff Tranter wrote:
> The code example 14.3 from KDE 2.0 development uses a Synth_PLAY module,
> which writes directly to the sound card, so it will not work
> if the sound server is running. What changes would be needed
> to make it work with a Synth_AMAN_PLAY module?
>
> I also get an error with the example when using a Synth_PLAY module:
>
> file synth_play_impl.cc: line 184 (void
> Arts::Synth_PLAY_impl::calculateBlock(long unsigned int)): assertion
> failed: (format == 8 || format == 16 || format == 17)
>
> It did work a while ago. Any ideas?
> Code is attached (slightly modified from the book example).

-- 
Jeff Tranter  Project Leader, Linux Development, Corel Corporation

["artsflow.cpp" (text/x-c++)]

#include <arts/artsflow.h>
#include <arts/connect.h>

using namespace Arts;

int main()
{
    // create a MCOP dispatcher (always do this)
    Dispatcher dispatcher;

    Synth_FREQUENCY freq1, freq2;    // some objects
    Synth_WAVE_SIN sin1, sin2;
    Synth_MUL mul;
    Synth_ADD add;
    Synth_PLAY play;

    // setup a 440Hz sin and connect it to the add
    setValue(freq1, "frequency", 440.0);
    connect(freq1, "pos", sin1, "pos");
    connect(sin1, "outvalue", add, "invalue1");

    // setup a 880Hz sin and connect it to the add
    setValue(freq2, "frequency", 880.0);
    connect(freq2, "pos", sin2, "pos");
    connect(sin2, "outvalue", add, "invalue2");

    // multiply everything with 0.5 (=> no clipping)
    connect(add,"outvalue",mul,"invalue1");
    setValue(mul,"invalue2",0.5);
	
    // connect the output to the play module
    connect(mul,"outvalue",play,"invalue_left");
    connect(mul,"outvalue",play,"invalue_right");

    // start all modules
    freq1.start(); freq2.start(); sin1.start();
    sin2.start(); mul.start(); add.start(); play.start();

    dispatcher.run();
}

_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic