-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Showing
15 changed files
with
151 additions
and
40 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-back-button defaultHref="/"></ion-back-button> | ||
</ion-buttons> | ||
<ion-title> | ||
<span translate>Voice</span> | ||
</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<ion-list> | ||
<ion-item> | ||
<ion-select label="{{'Voice' | translate}}" [disabled]="!options.language || voices.length < 2" [(ngModel)]="options.voice" (ionChange)="update()" cancelText="{{'Cancel' | translate}}" okText="{{'OK' | translate}}"> | ||
<ion-select-option translate value="">Default</ion-select-option> | ||
<ion-select-option *ngFor="let v of voices" value="{{v.identifier}}">{{v.name}}</ion-select-option> | ||
</ion-select> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label class="ion-text-wrap" translate> | ||
Rate | ||
</ion-label> | ||
<!-- WebSpeech: 0.1..10--> | ||
<ion-range legacy="true" slot="end" [(ngModel)]="options.rate" (ionChange)="update()" min="200" max="1800"> | ||
</ion-range> | ||
<ion-buttons slot="end"> | ||
<ion-button fill="clear" (click)="resetRate()"> | ||
<ion-icon name="refresh-outline"></ion-icon> | ||
</ion-button> | ||
</ion-buttons> | ||
</ion-item> | ||
<ion-item> | ||
<ion-label class="ion-text-wrap" translate> | ||
Pitch | ||
</ion-label> | ||
<!-- WebSpeech: 0..2--> | ||
<ion-range legacy="true" slot="end" [(ngModel)]="options.pitch" (ionChange)="update()" min="200" max="1800"> | ||
</ion-range> | ||
<ion-buttons slot="end"> | ||
<ion-button fill="clear" (click)="resetPitch()"> | ||
<ion-icon name="refresh-outline"></ion-icon> | ||
</ion-button> | ||
</ion-buttons> | ||
</ion-item> | ||
<ion-item> | ||
<ion-button (click)="test()">Test</ion-button> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> |
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,55 @@ | ||
import { Component, OnDestroy } from '@angular/core'; | ||
|
||
import { TranslateService } from '@ngx-translate/core'; | ||
|
||
import { AppSettings, Options } from '../app-settings'; | ||
import { SpeechService } from '../services'; | ||
|
||
|
||
@Component({ | ||
templateUrl: 'voice.page.html' | ||
}) | ||
export class VoicePage implements OnDestroy { | ||
|
||
options = new Options(); | ||
|
||
voices = []; | ||
|
||
private subscription: any; | ||
|
||
constructor(private settings: AppSettings, private speech: SpeechService, private translate: TranslateService) {} | ||
|
||
ngOnInit() { | ||
this.subscription = this.settings.getOptions().subscribe(options => { | ||
this.options = options; | ||
this.updateVoices(); | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subscription.unsubscribe(); | ||
} | ||
|
||
resetRate() { | ||
this.options.rate = 1000; | ||
this.update(); | ||
} | ||
|
||
resetPitch() { | ||
this.options.pitch = 1000; | ||
this.update(); | ||
} | ||
|
||
async update() { | ||
return this.settings.setOptions(this.options); | ||
} | ||
|
||
async test() { | ||
const example = this.translate.instant("notifications.example"); | ||
this.speech.speak(example); | ||
} | ||
|
||
async updateVoices() { | ||
this.voices = await this.speech.getVoices(this.options.language); | ||
} | ||
} |
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
Oops, something went wrong.