Package com.tino1b2be.dtmf
Class DtmfConfig.Advanced
java.lang.Object
com.tino1b2be.dtmf.DtmfConfig.Advanced
- Enclosing class:
- DtmfConfig
Fluent builder for
DtmfConfig, exposing every knob and the
wider [4000, 192000] sample-rate domain.
Every setter validates its argument in the same way the canonical
constructor does, so misuse surfaces at the setter call site rather
than at build(). The sample-rate range check and the twist
relationship check are enforced in build().
Setters return this for chaining. Instances are not
thread-safe; build one per caller.
-
Method Summary
Modifier and TypeMethodDescriptionanalysisBlockSize(int samples) Set the analysis block size explicitly.build()Materialize an immutableDtmfConfigfrom the values set on this builder.Set the channel mode.confirmationFrames(int frames) Set the number of consecutive analysis blocks required to confirm a tone.detectionThreshold(double t) Set the detection-confidence threshold.forwardTwistDb(double db) Set the forward-twist tolerance in dB.Set the minimum inter-tone gap duration.Set the minimum tone duration.reverseTwistDb(double db) Set the reverse-twist tolerance in dB.sampleRate(int hz) Set the sample rate.Set the window function.
-
Method Details
-
sampleRate
Set the sample rate.- Parameters:
hz- integer sample rate in Hz; must be in[4000, 192000]- Returns:
this- Throws:
IllegalArgumentException- ifhzis outside[4000, 192000]
-
analysisBlockSize
Set the analysis block size explicitly. If never called, the block size is derived atbuild()time fromBlockSizer.blockSizeFor(sampleRate).- Parameters:
samples- block size in samples; must be> 0- Returns:
this- Throws:
IllegalArgumentException- ifsamples <= 0
-
minimumToneDuration
Set the minimum tone duration. Must be ≥ 10 ms (Requirement 8.8).- Parameters:
d- minimum tone duration; non-null- Returns:
this- Throws:
NullPointerException- ifdisnullIllegalArgumentException- ifd < 10 ms
-
minimumGapDuration
Set the minimum inter-tone gap duration. Must be non-negative.- Parameters:
d- minimum gap duration; non-null- Returns:
this- Throws:
NullPointerException- ifdisnullIllegalArgumentException- ifdis negative
-
detectionThreshold
Set the detection-confidence threshold. Must be in[0.0, 1.0].- Parameters:
t- detection threshold- Returns:
this- Throws:
IllegalArgumentException- iftisNaNor outside[0, 1]
-
channelMode
Set the channel mode.- Parameters:
m- channel mode; non-null- Returns:
this- Throws:
NullPointerException- ifmisnull
-
windowFunction
Set the window function.- Parameters:
w- window function; non-null- Returns:
this- Throws:
NullPointerException- ifwisnull
-
forwardTwistDb
Set the forward-twist tolerance in dB. Must be finite and strictly greater than the reverse-twist value atbuild()time.- Parameters:
db- forward-twist tolerance in dB- Returns:
this- Throws:
IllegalArgumentException- ifdbis not finite
-
reverseTwistDb
Set the reverse-twist tolerance in dB. Must be finite and strictly less than the forward-twist value atbuild()time.- Parameters:
db- reverse-twist tolerance in dB- Returns:
this- Throws:
IllegalArgumentException- ifdbis not finite
-
confirmationFrames
Set the number of consecutive analysis blocks required to confirm a tone. Must be>= 1.- Parameters:
frames- confirmation-frame count- Returns:
this- Throws:
IllegalArgumentException- ifframes < 1
-
build
Materialize an immutableDtmfConfigfrom the values set on this builder. IfanalysisBlockSize(int)has not been called, the block size is derived viaBlockSizer.blockSizeFor(sampleRate)so the effective bin width lands in[40, 60]Hz.- Returns:
- the new
DtmfConfig - Throws:
IllegalArgumentException- if any inter-field constraint is violated (e.g. forward ≤ reverse)
-