command_responder.h 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. ==============================================================================*/
  12. // Provides an interface to take an action based on an audio command.
  13. #ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_
  14. #define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_
  15. #include "tensorflow/lite/c/common.h"
  16. #include "tensorflow/lite/micro/micro_error_reporter.h"
  17. // Called every time the results of an audio recognition run are available. The
  18. // human-readable name of any recognized command is in the `found_command`
  19. // argument, `score` has the numerical confidence, and `is_new_command` is set
  20. // if the previous command was different to this one.
  21. void RespondToCommand(tflite::ErrorReporter* error_reporter,
  22. int32_t current_time, const char* found_command,
  23. uint8_t score, bool is_new_command);
  24. #endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_