Quantcast
Viewing all articles
Browse latest Browse all 4921

SDK • Re: Using variable text is posible ?

Give it a try, but I guess the compiler will say 'no'.

I would propose to use a third variable enum State as an indicator what the data are (not tested):

Code:

enum State { SILENCE, NOSILENCE};struct Wav{    unsigned char* wav ; // perhaps you want to use uint8_t instead    unsigned int wav_len;// perhaps you want to use uint32_t or size_t instead    enum State state;} audio_wav;If (flag=0){     audio_wav.wav = sil11k_s8_wav;    audio_wav.wav_len = sil11k_s8_wav_len ;    audio_wav.state = State::SILENCE;} else {     audio_wav.wav = nullptr;    audio_wav.wav_len = 0;;    audio_wav.state = State::NOSILENCE;}
Then in your code you do not check for a specific value of wav, but can use the enum and exactly know what the data are.

Statistics: Posted by ghp — Mon Apr 01, 2024 2:44 pm



Viewing all articles
Browse latest Browse all 4921

Trending Articles