How to modify the A2B Analyzer SDK for your use case?

Version 3

    This document is meant to complement the A2B Analyzer SDK User Guide.

     

    Step 1. Running the sample application

    Set environment variables before running the sample application.

    >> export ANLZR_SDK_ROOT_DIR=/c/Users/ralwar/Documents/test/a2b-analyzer-sdk-win64_2.0.4

    Ensure that you use forward slashes even on Windows PC. You can check if the environment variables were updated or not using the echo command.

    >> echo $ANLZR_SDK_ROOT_DIR

     

    If this returns the correct path to your SDK installation directory, you are good to go.


    Now enter the working directory for the sample application.

    >> cd $ANLZR_SDK_ROOT_DIR

    >> cd examples/a2b-analyzer-app

     

    Build the sample application

    >> make DEBUG=1 ANLZR_LINK_STATICALLY=1 ANLZR_OS=win64 local

    Ensure that you do not have any errors here due to missing build tools. Once the sample application is built, you can go ahead and execute it from the same environment.

    >> ./build/win64/debug/install/usr/local/bin/anlzr-app.exe

    Skip the following step if you don’t see error.

    If you see error saying “Failed to set up and initialize the A2B Analyzer”, its likely that you have the A2B Analyzer Application or some other instance holding on to your A2B Analyzer. Close that other instance and retry running the application.

    You can also run with options as follows:

    >> ./build/win64/debug/install/usr/local/bin/anlzr-app.exe [-h] [-b bdd_bin_file] [-d secs][-i uri] [-o path] [-s uri] [-S hw_ser_num] [-v]

    To see the options available run with ‘–h’. ‘–vvv’ shows you more detailed discovery process. If there are errors this would provide you much more details.

     

     

    Step 2: Modify the sample application

     

    1. Ensure that master register settings are configured correctly

    If you are using A2B Analyzer as master, setting I2SGCFG = 0x02 and I2SCFG = 0x77 is mandatory to ensure that A2B Analyzer works as intended. This setting is available in the Network Builder under Nodes > Master Node > TDM Cfg.

     

    2. Export your custom network configuration file to the SDK directory

      1. Using the A2B Analyzer Application, create a network configuration file for the network which you want to discover with the SDK.
      2. Once the network is created, use the A2B Analyzer Application – Node Simulator to validate that the network configuration is correct.
      3. Export the network configuration created (from the Network Builder tab) and save your network to a C Header.
      4. Save this file in the src/ directory of the example.
      5. Rename this as bdd.c to replace the existing bdd.c file.

     

    3. Disable slave plugins

    The sample program makes use of slave plugins which are I2C peripheral configuration messages. These are intended for activating the audio CODEC on the EVAL-AD24xx-WBZ/WGZ boards. If your slave node is NOT an EVAL-AD24xx-WBZ/WGZ board, then you’ll have to disable this. To disable plugins, uncomment #undef APP_LINK_STATIC_SLAVE_PLUGINS and comment #define APP_LINK_STATIC_SLAVE_PLUGINS in anlzr-app.c

    Line 74 // #define APP_LINK_STATIC_SLAVE_PLUGINS
    Line 75 #undef APP_LINK_STATIC_SLAVE_PLUGINS

     

    4. Set the values for number of sources, sinks and number of channels correctly

    This can be done be done by defining following parameters to its appropriate values:

    #define APP_MAX_NUM_SOURCES
    #define APP_MAX_NUM_SINKS
    #define APP_DEFAULT_NUM_CHANNELS

    Commentary on the values to be used above – the number of sources should equal the sinks. The number of channels is the total number of channels in your network. For e.g. you have 8 ch salve and you want to send 8ch audio to it using the A2B Analyzer, you can set sources and sinks as 8 and number of channels as 1. Alternatively, if you are using stereo sources, you can set sources and sinks as 2 and number of channels 4.

     

    5. Set app_Options to setup sources and sinks

    Depending on what you want to send to the slave node you can select from a variety of options to source audio. The audio sources could be tone://1000 (Plays a 1kHz sine tone),  file://<path-to-wav> (plays from a wav file)

     

    6. Set Peripheral configuration in case your slave needs one:

    Before streaming audio some slave nodes (devices connected to A2B slave node) need to be configured to play audio. This would essentially be through I2C slave writes. You can use the following template for these writes.

    int i2cAddrDSP  = 0x39;

    int mynode = 0;

    subaddr0 [0] = 0x40; subaddr0 [1] = 0x00;

    result = a2b_i2cPeriphWrite ( stackDcb.ctx, mynode, i2cAddrDSP, 2, subaddr0 );

    if ( ANLZR_FAILED(result) ) {

        app_logError("Failed : err=0x%X\n", result);

    }

    Once changes are made please refer back to the SDK user guide to build and run the application. Ensure that you do a clean build each time.