Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Custom Macro Controls
Macros: Ctrls, Ctrl0-3, Btn0-7
(See also Custom Controls Command Summary.)
The Custom Controls dialog provides up to 4 value-edit controls (Ctrl0 to Ctrl3) and up to 8 buttons (Btn0 to Btn7), which your macros can use to provide "live" manual control over custom Daqarta operations.
The general layout of the dialog is shown below, with default titles that show the macro names of the controls (like Ctrl0); your macro will typically assign descriptive labels, as discussed in the Custom Controls Command Summary. Note that Btn4 through Btn7 are shown here, but they are not shown by default unless you actually assign them for use.
To use Custom Controls, you need two separate macros. The setup macro uses specialized commands to set the labels, styles, ranges, and initial values of the controls and buttons. (See the Command Summary for details.) Then it invokes a Controls handler macro similar to an Invoked Macro Loop, only using Ctrls instead of a loop count:
_My_Controls will run each time there is a change in any of the Ctrl0-3 or Btn0-7 controls. There is no specific number of iterations; the loop exits only when the Custom Controls dialog is manually closed by the user.
_My_Controls can detect which control changed by looking at the Ctrls variable, which returns a unique event number for each of the controls. Events 0-3 signal Ctrl0-3 changes, while events 4-11 signal Btn0-7 changes.
As a simple example of the utility of Custom Controls, consider the Beats_Demo Monaural and Binaural Beats mini-app macro included with Daqarta. This operates the Generator controls to create two sine waves of differing frequency. The "beat" frequency you hear is the difference between these two tones.
Beats_Demo has separate controls for Center Frequency (Ctrl0) and Difference Frequency (Ctrl1), such that operating either one takes care of the math to insure that both underlying Tone Frequencies track properly:
L.0.ToneFreq=Ctrl0 - Ctrl1 / 2 R.0.ToneFreq=Ctrl0 + Ctrl1 / 2
In addition, these Custom Controls have sliders to make exploration easier.
So, for example, if Ctrl0 Center Frequency is set to 200 Hz and Ctrl1 Difference Frequency is 1 Hz (defaults), the two Tone Frequencies are 199.5 and 200.5 Hz. Raising the Difference Frequency to 2.5 Hz gives Tone Frequencies of 198.75 and 201.25 Hz.
Of course, you don't need Custom Controls just to create beat frequencies, but it would be cumbersome to manually adjust the two Tone Freqency controls to maintain the same center frequency while changing the difference frequency, or to keep the same difference frequency while changing the center.
Beats_Demo also uses Custom Control buttons to switch from binaural beats (a separate tone to each ear, for headphone use) to conventional monaural beats, and to switch monaural beats from both ears to one ear only. In each case, a single button click here changes multiple Generator button states.
Besides reducing the number of manual operations, the Custom Controls approach allows descriptive control labels that make usage clearer. The control ranges can be set to show units relevant to the user, which are transparently converted to any needed internal variable values.
Custom Controls can use Multitasking Macros to provide real-time background processing for live displays of custom-processed input and/or output data, as demonstrated in the included Channel Difference, Lissajous (X vs. Y), Chart Recorder, and FFT Filter macro mini-apps.
See also Macro Overview
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2023 by Interstellar Research
All rights reserved