TouchCollectorConfiguration

According to the help files, the TouchCollectorConfiguration.TouchInput.SamplingDistance is set to sample per micro second. However it seems that what ever number I place in the parameter I get a System Argument Out of Range Exception.

[url]Microsoft Learn: Build skills that open doors in your career

Dale

Please show a snippet of your code.

Me too!! I tried to speed things up as well by changing sampling frequency… Only one or two values worked… I ended up using the default values in the GHI demo and I’ve left it there.

Cheers Ian


 Touch.Initialize(myApp);  // Initialize Touch Screen Handler
            TouchCollectorConfiguration.CollectionMethod = CollectionMethod.Native;
            TouchCollectorConfiguration.CollectionMode = CollectionMode.InkOnly;
            TouchCollectorConfiguration.SetTouchInput(TouchCollectorConfiguration.TouchInput.TouchMoveFrequency, 0, 0, 0);
            TouchCollectorConfiguration.SetTouchInput(TouchCollectorConfiguration.TouchInput.SamplingDistance, 2, 0, 0);

Theres not much to this, the sampling distance should take an int(). And as I said the documentation states in microseconds. No matter what value is entered I get an argument our of range exception. My main problem is the touch response is really slow.

Dale

You are trying to set sampling frequency to 500 000 samples per second in your code.

Here is the snippet from the MF source code. It is a SamplingFrequency property of the TouchCollector. It uses SetTouchInput internally and will give you the idea of what is expected.

So basically if you want 50 samples per second, you have to set param1 in SetTouchInput to 1000000/50=20000. One sample every 20000 microseconds


        /// <summary>
        /// Sampling rate per second. Setting 50 will result 50 touch samples in a second.
        /// </summary>
        public static int SamplingFrequency
        {
            get
            {
                int param1 = 0;
                int param2 = 0;
                int param3 = 0;

                GetTouchInput(TouchInput.SamplingDistance, ref param1, ref param2, ref param3);

                if (param1 <= 0)
                    return 0;

                return (1000000 / param1);
            }

            set
            {
                int param1 = 0;
                int param2 = 0;
                int param3 = 0;

                /// Negative or zero is not acceptable frequency.
                if (value <= 0)
                    throw new ArgumentException();

                param1 = 1000000 / value;

                /// param1 == 0 means more than one sample is requested per microsecond,
                /// which is not attainable.
                if (param1 <= 0)
                    throw new ArgumentException();

                SetTouchInput(TouchInput.SamplingDistance, param1, param2, param3);
            }
        }

Cheers,
Valentin

I looked further in the code and the valid range is:

From:
20000 [italic](50 samples per second)[/italic]
To:
5000 [italic](200 samples per second)[/italic]

Thanks for the information. Still really slow touch responses.

Dale

Try something more than 20000. I got the values from the porting kit. The GHI implementation might use a different range.

Cheers,
Valentin

Valentin… So you’re saying to speed things up, read less samples! ie… 50 samples is better that 200 samples.

Cheers Ian

Collecting less will keep system less busy and might improve responsiveness.

Thanks for all the help. Not much difference in responsiviness. Will have a chat with GHI.

Dale

Have a word with Thomas (skewworks) The guy’s at pyxis use their own touch collection

Cheers Ian

As long as you’re using WPF you’re going to see horrid responsiveness; of if you’re using TinyCore get rid of it.

If you’re not using TinyCore and you’re still sluggish to respond perhaps something else is taxing your system. If you care to try InputManager.cs from pyxis ([url]http://www.skewworks.com/products/pyxis%202[/url]) should be pretty easy to drop into your application.