assert_spec x86 # Xmllint throws errors on inline chuck code proc check_xml_with_schema {xml_file} { } # # Build # set build_components { core init app/chuck drivers/audio drivers/timer } source ${genode_dir}/repos/base/run/platform_drv.inc append_platform_drv_build_components lappend_if [have_spec ps2] build_components drivers/input/spec/ps2 lappend_if [have_spec sdl] build_components drivers/framebuffer/spec/sdl build $build_components create_boot_directory # # Config # append config { } append_platform_drv_config append_if [have_spec ps2] config { } append_if [have_spec sdl] config { } append config { // name: mouse-fm.ck // desc: uses first X/Y axes of a mouse to control mf and index for FM // author: Spencer Salazar // which mouse 0 => int device; // get from command line if( me.args() ) me.arg(0) => Std.atoi => device; // modulator to carrier SinOsc m => SinOsc c => Envelope e => dac; // carrier frequency 220 => c.freq; // modulator frequency 550 => m.freq; // index of modulation 1000 => m.gain; // phase modulation is FM synthesis (sync is 2) 2 => c.sync; // attack 10::ms => e.duration; .5 => e.gain; // variables int base; float a0; float a1; float a2; int count; // start things set( base, a0, a1, a2 ); // hid objects Hid hi; HidMsg msg; // try if( !hi.openMouse( device ) ) me.exit(); <<< "mouse '" + hi.name() + "' ready...", "" >>>; // infinite time loop while( true ) { // wait on event hi => now; // loop over messages while( hi.recv( msg ) ) { if( msg.isMouseMotion() ) { msg.deltaX * .001 + a0 => a0; //else if( msg.which == 1 ) msg.fdata => a1; msg.deltaY * .001 + a1 => a1; set( base, a0, a1, a2 ); } else if( msg.isButtonDown() ) { msg.which => base; count++; if( count == 1 ) e.keyOn(); set( base, a0, a1, a2 ); } else if( msg.isButtonUp() ) { msg.which => base; count--; if( !count ) e.keyOff(); } } } // mapping function fun void set( int base, float v0, float v1, float v2 ) { // modulator frequency ( 500 + 5*base + ( 500 * v0) ) => m.freq; // carrier frequency ( 220 + (220 * v2) ) => c.freq; // index of modulation ( 1000 * (v1+1) ) => m.gain; <<< "carrier:", c.freq(), "modulator:", m.freq(), "index:", m.gain() >>>; } } install_config $config # # Boot modules # append boot_modules { core init ld.lib.so timer chuck libogg.lib.so libFLAC.lib.so libsndfile.lib.so libvorbis.lib.so pthread.lib.so stdcxx.lib.so libc.lib.so libm.lib.so } [audio_drv_binary] { } lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec sdl] boot_modules fb_sdl append_platform_drv_boot_modules build_boot_image $boot_modules append qemu_args " -nographic -soundhw es1370 " run_genode_until forever