Class MusicTone
- All Implemented Interfaces:
ControlRequest, Cloneable
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleSound frequency to play.doubleThe frequency at which this control will update. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Helper method to get this Control Request's AudioFrequency parameter converted to a unit type.Gets information about this control request.getName()Gets the name of this control request.sendRequest(CANBus network, int deviceHash) Sends the control request to the device.toString()withAudioFrequency(double newAudioFrequency) Modifies this Control Request's AudioFrequency parameter and returns itself for method-chaining and easier to use request API.withAudioFrequency(Frequency newAudioFrequency) Modifies this Control Request's AudioFrequency parameter and returns itself for method-chaining and easier to use request API.withUpdateFreqHz(double newUpdateFreqHz) Sets the frequency at which this control will update.withUpdateFreqHz(Frequency newUpdateFreqHz) Sets the frequency at which this control will update.
-
Field Details
-
AudioFrequency
public double AudioFrequencySound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.- Units: Hz
-
UpdateFreqHz
public double UpdateFreqHzThe frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
-
-
Constructor Details
-
MusicTone
public MusicTone(double AudioFrequency) Plays a single tone at the user specified frequency.- Parameters:
AudioFrequency- Sound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.
-
MusicTone
Plays a single tone at the user specified frequency.- Parameters:
AudioFrequency- Sound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.
-
-
Method Details
-
getName
Description copied from interface:ControlRequestGets the name of this control request.- Specified by:
getNamein interfaceControlRequest- Returns:
- Name of the control request
-
toString
-
sendRequest
Description copied from interface:ControlRequestSends the control request to the device. Users should callsetControl()on the device instead.- Specified by:
sendRequestin interfaceControlRequest- Parameters:
network- Device networkdeviceHash- Device hash- Returns:
- Status code of sending the request
-
getControlInfo
Gets information about this control request.- Specified by:
getControlInfoin interfaceControlRequest- Returns:
- Map of control parameter names and corresponding applied values
-
withAudioFrequency
Modifies this Control Request's AudioFrequency parameter and returns itself for method-chaining and easier to use request API.Sound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.
- Units: Hz
- Parameters:
newAudioFrequency- Parameter to modify- Returns:
- Itself
-
withAudioFrequency
Modifies this Control Request's AudioFrequency parameter and returns itself for method-chaining and easier to use request API.Sound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.
- Units: Hz
- Parameters:
newAudioFrequency- Parameter to modify- Returns:
- Itself
-
getAudioFrequencyMeasure
Helper method to get this Control Request's AudioFrequency parameter converted to a unit type. If not using the Java units library,AudioFrequencycan be accessed directly instead.Sound frequency to play. A value of zero will silence the device. The effective frequency range is 10-20000 Hz. Any nonzero frequency less than 10 Hz will be capped to 10 Hz. Any frequency above 20 kHz will be capped to 20 kHz.
- Units: Hz
- Returns:
- AudioFrequency
-
withUpdateFreqHz
Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
- Specified by:
withUpdateFreqHzin interfaceControlRequest- Parameters:
newUpdateFreqHz- Parameter to modify- Returns:
- Itself
-
withUpdateFreqHz
Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
- Specified by:
withUpdateFreqHzin interfaceControlRequest- Parameters:
newUpdateFreqHz- Parameter to modify- Returns:
- Itself
-
clone
-