How to use the function GetStorageFileName for adding training files to registry?
Asked Answered
S

1

2

I am using sapi 5.4 and I am able to retain the audio for training but for adding it to registry entries as given in this Acoustic training using SAPI 5.3 Speech API I am not able to understand the arguments to be used for ISpObjectToken::GetStorageFileName can somebody help me out with it?

Scow answered 7/7, 2014 at 11:49 Comment(0)
S
3

ISpObjectToken::GetStorageFileName isn't the best documented API in the world. Luckily, I have some worked examples to help improve the documentation.

clsidCaller

Set this if you need the file name associated with the object token. For training, this should be CLSID_NULL. (If you're updating engine-related data, then it would be the CLSID of the engine.)

pszValueName

The name of the registry subkey to store the filename in. For training, this should be L"TrainingAudio-<locale>", where locale should be the 4 digit locale ID for the engine.

pszFileNameSpecifier

The name of the file to be created.

If this starts with "X:\" or "\" it is assumed to be a full path.

Otherwise it is assumed to be relative to the special folder ID given in the nFolder parameter.

If pszFileNameSpecifier ends with a '\', or is NULL a unique file name will be created.

If the name contains a %d the %d is replaced by a number to give a unique file name.

For training, you should specify something like L"TrainingAudio\\TR_%d.wav".

nFolder

A CSIDL value that identifies the folder whose path is to be retrieved. The user can force the creation of a folder by combining the folder's CSIDL with CSIDL_FLAG_CREATE. If pszFileNameSpecifier is NULL or "\", nFolder must have a specified CSIDL folder combined with CSIDL_FLAG_CREATE if the user wants to force to create the file.

For training, this should be CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE.

ppszFilePath

Address of a pointer to the null-terminated string that receives the file path information. Use CoTaskMemFree to release the string when done.

Stableman answered 7/7, 2014 at 21:50 Comment(1)
I just want to point out that CSIDL_LOCAL_APPDATA = 28, and CSIDL_FLAG_CREATE = 32768, for anyone programming in c#.Elasmobranch

© 2022 - 2024 — McMap. All rights reserved.