Jump to content

Recommended Posts


I am working with a DLL, which returns an array of pointers to structures like the following:


typedef struct {
            const char *name;
    const char *languages;
    const char *identifier;
    unsigned char gender;
    unsigned char age;
    unsigned char variant;
    unsigned char xx1;
    int score;
    void *spare;



I found this thread on the forum, but I'm not sure if it's the same thing I need to do:


In this link


Maybe it is very simple, because the element [0] of the array that creates DLLCall() is of type "array" and contains the elements, which can be accessed normally; but the truth is that I have never worked with the function of a DLL, which returns an array, so I have no idea how to access each element of the array.


Thanks to whoever gives me a hint


Link to post
Share on other sites

Hello. It would be great if you provide library documentation. I think something like this should work.

Local $PtrReturned=DllCall("ptr","dll","function")[0]

Local $paVoices=DllStructCreate("ptr[150]",$PtrReturned)
Local $pVoice=0
Local $iIndex=1
Local $tCast=0

While True
If Not $pVoice Then ExitLoop
ConsoleWrite("Ptr: " & $pVoice & @CRLF)



Link to post
Share on other sites
Posted (edited)
1 hour ago, Danyfirex said:

It would be great if you provide library documentation.

As well as provide your own indentation, @Jonny37  :)

Edited by JockoDundee

Code hard, but don’t hard code...

Link to post
Share on other sites

Thank you very much, I will look at the code and see if it works for me.

I haven't put the DLL documentation, because it doesn't really say much more than what I put.

But anyway, here is the documentation that appears in the header file:




        // voice table
        typedef struct {
                 const char *name;      // a given name for this voice. UTF8 string.
         const char *languages;       // list of pairs of (byte) priority + (string) language (and dialect qualifier)
         const char *identifier;      // the filename for this voice within espeak-ng-data/voices
         unsigned char gender;  // 0=none 1=male, 2=female,
         unsigned char age;     // 0=not specified, or age in years
         unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties
         unsigned char xx1;     // for internal use
         int score;       // for internal use
         void *spare;     // for internal use
        } espeak_VOICE;

        /* Note: The espeak_VOICE structure is used for two purposes:
          1.  To return the details of the available voices.
          2.  As a parameter to  espeak_SetVoiceByProperties() in order to specify selection criteria.

           In (1), the "languages" field consists of a list of (UTF8) language names for which this voice may be used, each language name in the list is terminated by a zero byte and is also preceded by a single byte which gives a "priority" number.  The list of languages is terminated by an additional zero byte.

           A language name consists of a language code, optionally followed by one or more qualifier (dialect) names separated by hyphens (eg. "en-uk").  A voice might, for example, have languages "en-uk" and "en".  Even without "en" listed, voice would still be selected for the "en" language (because "en-uk" is related) but at a lower priority.

           The priority byte indicates how the voice is preferred for the language. A low number indicates a more preferred voice, a higher number indicates a less preferred voice.

           In (2), the "languages" field consists simply of a single (UTF8) language name, with no preceding priority byte.



        ESPEAK_API const espeak_VOICE ** espeak_ListVoices(espeak_VOICE *voice_spec);
        /* Reads the voice files from espeak-ng-data/voices and creates an array of espeak_VOICE pointers.
           The list is terminated by a NULL pointer

           If voice_spec is NULL then all voices are listed.
           If voice spec is given, then only the voices which are compatible with the voice_spec
           are listed, and they are listed in preference order.




Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...