File tree Expand file tree Collapse file tree
sdk/runanywhere-flutter/packages/runanywhere/lib/features/tts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ import 'dart:async';
88import 'dart:typed_data' ;
99
1010import 'package:flutter_tts/flutter_tts.dart' ;
11+ import 'package:runanywhere/core/protocols/component/component_configuration.dart' ;
12+ import 'package:runanywhere/foundation/error_types/sdk_error.dart' ;
1113
1214/// Configuration for TTS synthesis
13- class TTSConfiguration {
15+ class TTSConfiguration implements ComponentConfiguration {
1416 final String voice;
1517 final String language;
1618 final double speakingRate;
@@ -26,6 +28,27 @@ class TTSConfiguration {
2628 this .volume = 1.0 ,
2729 this .audioFormat = 'pcm' ,
2830 });
31+
32+ @override
33+ void validate () {
34+ if (! speakingRate.isFinite || speakingRate < 0.5 || speakingRate > 2.0 ) {
35+ throw SDKError .validationFailed (
36+ 'Speaking rate must be between 0.5 and 2.0' ,
37+ );
38+ }
39+
40+ if (! pitch.isFinite || pitch < 0.5 || pitch > 2.0 ) {
41+ throw SDKError .validationFailed (
42+ 'Pitch must be between 0.5 and 2.0' ,
43+ );
44+ }
45+
46+ if (! volume.isFinite || volume < 0.0 || volume > 1.0 ) {
47+ throw SDKError .validationFailed (
48+ 'Volume must be between 0.0 and 1.0' ,
49+ );
50+ }
51+ }
2952}
3053
3154/// Input for TTS synthesis
You can’t perform that action at this time.
0 commit comments