-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
013949e
commit d46a9bf
Showing
7 changed files
with
100 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
live-text-view/src/main/java/com/jeffg/live_text_view/LiveTextViewTTS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.jeffg.live_text_view; | ||
|
||
import android.media.AudioAttributes; | ||
import android.speech.tts.TextToSpeech; | ||
import android.speech.tts.Voice; | ||
|
||
import java.util.Locale; | ||
|
||
public class LiveTextViewTTS { | ||
|
||
Float pitch; | ||
Locale language; | ||
Float speechRate; | ||
Voice voice; | ||
AudioAttributes audioAttributes; | ||
|
||
public LiveTextViewTTS() { | ||
|
||
} | ||
|
||
public LiveTextViewTTS setBuilder(Builder builder) { | ||
this.pitch = builder.pitch; | ||
this.language = builder.language; | ||
this.speechRate = builder.speechRate; | ||
this.voice = builder.voice; | ||
this.audioAttributes = builder.audioAttributes; | ||
return this; | ||
} | ||
|
||
|
||
|
||
class Builder { | ||
Float pitch; | ||
Locale language; | ||
Float speechRate; | ||
Voice voice; | ||
AudioAttributes audioAttributes; | ||
|
||
public Builder setPitch(float pitch) { | ||
this.pitch = pitch; | ||
return this; | ||
} | ||
|
||
public Builder setLanguage(Locale language) { | ||
this.language = language; | ||
return this; | ||
} | ||
|
||
public Builder setSpeechRate(float speechRate) { | ||
this.speechRate = speechRate; | ||
return this; | ||
} | ||
|
||
public Builder setVoice(Voice voice) { | ||
this.voice = voice; | ||
return this; | ||
} | ||
|
||
public Builder setAudioAttributes(AudioAttributes audioAttributes) { | ||
this.audioAttributes = audioAttributes; | ||
return this; | ||
} | ||
|
||
public LiveTextViewTTS build() { | ||
return new LiveTextViewTTS().setBuilder(this); | ||
} | ||
|
||
} | ||
|
||
} |