Skip to content

Handling Naming Conflicts

Phil Schatzmann edited this page Mar 1, 2022 · 9 revisions

The current implementation provides plenty of constants for the recorded audio. E.g. const unsigned char million_mp3 is representing the recording for million. If you want to record your own million_mp3 you can avoid a conflict in the following way:

Using NO_AUDIO_EXAMPLES

If you define NO_AUDIO_EXAMPLES before including SimpleTTS the examples provided by the library are excluded

#define NO_AUDIO_EXAMPLES
#include "SimpleTTS.h"

Using A Prefix for your file names

If you name your file with a custom prefix e.g. mymillion_mp3 you can also avoid any collisions.

Using C++ Namespaces

You can put your audio constants into your own namespace:

namespace my_namespace {
  #include "all_my_audio_includes.h"

  AudioDictionaryEntry MyExampleAudioDictionaryValues[] = {
    {"BILLION", new MemoryStream(billion_mp3, billion_mp3_len)},
    {"DOT", new MemoryStream(dot_mp3, dot_mp3_len)},
     ...
  };
}

AudioDictionary dictionary(my_namespace::MyExampleAudioDictionaryValues);

This way you can be sure that you won't run into any naming conflicts e.g. if you add additional libraries...