Currently i am working in text to speech application, Using FliteTTS to develop this and its working fine.
Class FliteTTS
-(void)speakText
{
[audiplayer Play];
}
-(void)stopTalking
{
[audioPlayer stop];
[audioPlayer release];
}
Class B
-(void)TouchToPlay
{
[self runFlite:ScriptDetails.text]; // Play audioplyer in FliteTTS
}
-(void)StopPlaying
{
FliteTTS *flit = [[FliteTTS alloc]init];
[flit stopTalking];
}
Then i tried to stop audioplayer from Class B to FliteTTS class, but its not stopped, How to stopped this? please help me.
Thanks in Advance
Here:
You are making new instance of your FliteTTS class and this is not the instance which is playing your audio so its not making it stop, you can try making your FliteTTS class as singleton so that it will return you a single instance through out the project,this will give you the access to play/stop or do any other controlling action from any class you want.