E2247 'TSpVoice::Voice' is not accessible

115 views Asked by At

This use to work on Windows 10, but now it doesn't, and I can't find how to correct the code to make it work.

void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
  ISpeechObjectTokenPtr token;
  ISpeechObjectTokensPtr tokens;
  tokens=SpVoice1->GetVoices(L"",L"");
  token=tokens->Item(ComboBox1->ItemIndex);
  SpVoice1->Voice=token;
}

Also errors (is not accessible) at:

SpVoice1->Volume
SpVoice->Rate

If I comment out the Voice, Rate, and Volume, it compiles and runs fine.

Windows 10 64-bit build 19041.867

1

There are 1 answers

0
Spider On

just had to make a few changes.

- SpVoice1->Volume=Vol->Position; //(Vol is the name of my trackbar)
+ SpPVoice1->set_Volume(Vol->Position);

- SpVoice1->Rate=Rate->Position;  //(Rate is the name of my trackbar)
+ SpVoice1->set_Rate(Rate->Position);

- SpVoice1->Voice=token;
+ SpVoice1->_set_Voice(token);