Results 1 to 7 of 7

Thread: ML Capabilities

  1. #1

    ML Capabilities

    Dear Fabrice
    I am writng a program that captures all the capabilities of OpenML ML.
    but when i write the folowing lines i receive a RUN-TIME error.
    ...
    MLpv* JackType = mlPvFind( JackCap, ML_JACK_TYPE_INT32 );
    printf( "Type of this jack is %s\n" ,(char *)(JackType -> value.int32));
    ...
    notice that the jack is available-this is the input or output jack.
    also the following lines create a RUN-TIME error:
    ...
    MLpv* Version = mlPvFind( deviceCap, ML_DEVICE_VERSION_INT32 );
    printf("Version of this physical device is:%s\n",Version > value.int32 );
    ...
    notice that many of the capabilities are work good.as an examples when i write the following code there is no error.
    ...
    MLpv* DeviceName = mlPvFind( deviceCap, ML_NAME_BYTE_ARRAY);
    printf( "\nThe name for device %i is %s\n", i, DeviceName ->value.pByte );
    ...

    I'm looking forward to hear your instructions.
    Best regards
    ...Ehsan

    [ July 20, 2004: Message edited by: ehsan2004 ]

  2. #2
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: ML Capabilities

    Dear Ehsan,

    in an MLpv list, 'value.int32' is an MLint32. You can not print it as a string. You must print it as an int -- use '%d' rather than '%s' in your printf.

    Notice that the examples that do work use 'value.pByte'. This is a 'char*', so you *can* use '%s'. See the ML header files for the details on the MLpv structure.

  3. #3

    Re: ML Capabilities

    Hello Fabrice
    My problem solved.thus,each type of jack has an index.as an example i think that ML_JACK_TYPE_AUDIO has index 0. but now a question about ML_PRESET_MSG_ARRAY that is part of the path logical device capabilities.I don't know that how i can use from this feature in my program-i don't know that how i can see the "param" feature of each MLpv object that is received using the ML_PRESET_MSG_ARRAY.can you write a code for me to does that.

    another problem is about the following lines that produce a run-time error.
    MLpv* JackFeatures = mlPvFind( JackCap, ML_JACK_FEATURES_BYTE_ARRAY );
    printf( "Jack features: %d\n" ,(char *)(JackFeatures -> value.pByte));

    Notice that it also happens when i use from %d, %f or %i without using the (char*).

    ...Ehsan

  4. #4
    Member
    Join Date
    Jul 2003
    Location
    Montreal
    Posts
    75

    Re: ML Capabilities

    A 'value.pByte' is a 'char*'. You do not need to explicitly cast it. However, you also may *not* print it out with '%d'. You must use '%s'.

    Note that you should also check if the specified capability was found -- if it wasn't found, the function will return a NULL pointer, and you will get an error trying to dereference it.

  5. #5

    Re: ML Capabilities

    Hi
    for the following jack capabilities, i receive a run-time error. note that for other jack capabilities such as ML_JACK_PATH_IDS_INT64_ARRAY, i don't receive a run-time error. please suggest me.

    MLpv* JackOptionParamIds = mlPvFind( JackCap, ML_OPEN_OPTION_IDS_INT64_ARRAY );
    printf( "Number of optional PARAMs in this jack: %llx \n", JackOptionParamIds->length );

    MLpv* JackResolution = mlPvFind( JackCap, ML_JACK_COMPONENT_SIZE_INT32 );
    printf( "Maximum number of bits of resolution per component for the signal through this jack: %d\n",JackResolution -> value.int32);


    MLpv* JackFeatures = mlPvFind( JackCap, ML_JACK_FEATURES_BYTE_ARRAY );
    printf( "Jack features: %s\n" ,JackFeatures -> value.pByte);

  6. #6

    Re: ML Capabilities

    In responsing to my question, Fabrice wrote that:

    I've looked through the message thread on the Forum -- am I correct that the
    problem here is the failure of the 'mlPvFind' calls?

    As I mentioned before, Ehsan, you should *always* check the return value of the
    mlPvFind(), to make sure it isn't a NULL pointer. It is possible that the
    property you are querying is not supported by that particular device/jack -- in
    which case mlPvFind will return NULL. Thus, before using the pointer, you must
    check it.

    Could you please add that code to your test program and see what happens?

    ...Fabrice

    [ October 14, 2004: Message edited by: ehsan_kamrani ]

  7. #7

    Re: ML Capabilities

    ok. these features are not supported on my system.with the following code, as an example, i don't receive any run-time error:

    JackOptionParamIds = mlPvFind( JackCap, ML_OPEN_OPTION_IDS_INT64_ARRAY );
    if( JackOptionParamIds )
    {
    printf( "Number of optional PARAMs in this jack: %llx \n", JackOptionParamIds->length );
    }

Similar Threads

  1. Replies: 0
    Last Post: 04-28-2011, 07:25 AM
  2. OpenML Capabilities:Do you like to recieve the files?
    By ehsan2004 in forum OpenML Coding & Technical Issues
    Replies: 3
    Last Post: 05-31-2005, 11:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •