Expose model sample rate in API

This commit is contained in:
Reuben Morais 2019-10-10 21:45:33 +02:00
parent 315a67bf69
commit 0241f725cd
2 changed files with 16 additions and 0 deletions

View File

@ -292,6 +292,12 @@ DS_CreateModel(const char* aModelPath,
return DS_ERR_OK; return DS_ERR_OK;
} }
int
DS_GetModelSampleRate(ModelState* aCtx)
{
return aCtx->sample_rate_;
}
void void
DS_FreeModel(ModelState* ctx) DS_FreeModel(ModelState* ctx)
{ {

View File

@ -92,6 +92,16 @@ int DS_CreateModel(const char* aModelPath,
unsigned int aBeamWidth, unsigned int aBeamWidth,
ModelState** retval); ModelState** retval);
/**
* @brief Return the sample rate expected by a model.
*
* @param aCtx A ModelState pointer created with {@link DS_CreateModel}.
*
* @return Sample rate expected by the model for its input.
*/
DEEPSPEECH_EXPORT
int DS_GetModelSampleRate(ModelState* aCtx);
/** /**
* @brief Frees associated resources and destroys model object. * @brief Frees associated resources and destroys model object.
*/ */