{"id":4699,"date":"2019-06-17T03:00:12","date_gmt":"2019-06-17T01:00:12","guid":{"rendered":"https:\/\/demdlx704as001.ad.harman.com\/index.php\/section\/live-streaming-of-state-variable-or-state-memory\/"},"modified":"2024-05-13T08:39:43","modified_gmt":"2024-05-13T06:39:43","slug":"live-streaming-of-state-variable-or-state-memory","status":"publish","type":"post","link":"https:\/\/audioworx.transfunnel.co\/old\/?p=4699","title":{"rendered":"Live streaming of state variable or state memory"},"content":{"rendered":"<p>To enable live streaming for a particular state variable, below steps needs to be performed by the audio object.<\/p>\n<p>1. The XML section of the state variable has to be updated to convey that state variable is streamable to GTT. The optional variable after the bit converter has to be set to true to enable the state variable streaming.<br \/>\nThe code snippet from <strong><em>CTemplate::getXmlObjectTemplate<\/em><\/strong> function conveys to GTT that the state variable \u201cState1Value\u201d is enabled for streaming by setting the optional variable after bit converter to true.<br \/>\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4697\" src=\"https:\/\/audioworx.transfunnel.co\/old\/wp-content\/uploads\/2019\/06\/074.jpg\" alt=\"\" width=\"513\" height=\"281\" \/><\/p>\n<p>2. For uploading data from framework to GTT, the following public functions have to overridden or implemented:<\/p>\n<ul>\n<li>CAudioObject::getStateMemForLiveStreamingPtr<\/li>\n<li>CAudioObject::getDataFormatForLiveStreamingPtr<\/li>\n<\/ul>\n<table style=\"border-collapse: collapse; width: 100%; height: 1621px;\" border=\"1\">\n<tbody>\n<tr style=\"height: 1040px;\">\n<td style=\"width: 100%; height: 1040px;\">\n<p><span style=\"font-size: 12pt;\"><span style=\"text-decoration: underline;\"><strong>CAudioObject::getStateMemForLiveStreamingPtr ()<\/strong><\/span> take in 4 arguments representing <strong><em>streamIndext, subBlockId<\/em><\/strong>, pointer to hold memory address of the state variable <em><strong>(stateMem)<\/strong><\/em> and the number of the bytes to be streamed<em><strong> (len)<\/strong>.<\/em><\/span><\/p>\n<p><span style=\"font-size: 12pt;\">The <strong><em>streamIndext<\/em><\/strong> and <em><strong>subBlockId<\/strong><\/em> are passed into the audio object to enable the calculation of which channel of the state variable to be streamed. Based on the calculation done, the audio object has to update the variables <em><strong>stateMem<\/strong><\/em> and <em><strong>len.<\/strong><\/em><\/span><\/p>\n<p><span style=\"font-size: 12pt;\">The code snippet from <strong><em>CTemplate::getStateMemForLiveStreamingPtr<\/em><\/strong> shows the example implementation. In this example code, subblock is not used for state variable and hence <strong><em>subBlockId<\/em><\/strong> has to be always zero. The first state variable (with streamIndex 0) is mute which is not enabled for streaming in XML file. The state variables (streamIndext\u00a01 to 6) is enabled for streaming in XML file and stateMem and len is updated.<br \/>\n<img decoding=\"async\" class=\"alignnone wp-image-8247\" src=\"https:\/\/audioworx.transfunnel.co\/old\/wp-content\/uploads\/2019\/06\/statemem.jpg\" alt=\"\" width=\"719\" height=\"712\" \/><br \/>\nThe <span class=\"emph\">len<\/span> argument of the function getStateMemForLiveStreamingPtr conveys that how many bytes are going to be streamed. If only one float value is going to be streamed then value for <span class=\"emph\">len<\/span> is 4. If <strong>n<\/strong> number of float values need to be streamed, then variable <span class=\"emph\">len<\/span> has to be 4 times <strong>n<\/strong>. Also, audio object has to make sure that <span class=\"emph\">len<\/span> number of bytes are allocated for the state variable and the starting address is assigned to<span class=\"emph\"> stateMem<\/span> variable.<br \/>\n<\/span><\/td>\n<\/tr>\n<tr style=\"height: 581px;\">\n<td style=\"width: 100%; height: 581px;\">\n<p><span style=\"font-size: 12pt;\"><span style=\"text-decoration: underline;\"><strong>CAudioObject::getDataFormatForLiveStreamingPtr()<\/strong><\/span> take in 2 arguments representing <strong>streamIndext<\/strong> and <strong>subBlockId<\/strong>.<\/span><\/p>\n<p><span style=\"font-size: 12pt;\">The <strong>streamIndext<\/strong> and <strong>subBlockId<\/strong> are passed into the audio object to return the data format of the state variable to be streamed.<\/span><\/p>\n<p><span style=\"font-size: 12pt;\">The code snippet from <strong>CTemplate::getDataFormatForLiveStreamingPtr<\/strong> shows the example implementation. In this example code, subblock is not used for state variable and hence<strong> subBlockId<\/strong> has to be always zero. The first state variable (with <strong>streamIndex<\/strong> 0) is mute which is not enabled for streaming in XML file. The state variables (<strong>streamIndext<\/strong> 1 to 6) is enabled for streaming in XML file and the corresponding data format is returned from this function.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-8248\" src=\"https:\/\/audioworx.transfunnel.co\/old\/wp-content\/uploads\/2019\/06\/statemem1.jpg\" alt=\"\" width=\"882\" height=\"432\" \/><br \/>\n<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>3. Data from framework to GTT is sent based on the value <span class=\"emph\">commands per second<\/span> of the state variable which is sent from GTT.<\/p>\n<p>The framework does the below calculation to decide on which call it needs to send data to GTT.<\/p>\n<ul>\n<li>Number of blocks per second = SampleRate \/ BlockLength<\/li>\n<li><strong>Blocks per message<\/strong> = Number of blocks per second \/<strong> commands per second<\/strong><\/li>\n<\/ul>\n<p>The amount of data to be send is based on the below calculation.<\/p>\n<ul>\n<li><strong>Bytes per messag<\/strong>e = Header size + len<br \/>\nwhere<\/p>\n<ul>\n<li>Header size is 5.<\/li>\n<li>len is in bytes.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The framework sends Bytes per message amount of data to GTT for every Blocks per message.<\/p>\n<p><strong>Example #1:<\/strong><br \/>\nSampleRate = 48000, BlockLength = 64, len = 4 and commands per second = 10<\/p>\n<p>Number of blocks per second = 48000 \/ 64 = 750<br \/>\nBlocks per message = 750 \/ 10 = 75<br \/>\nBytes per message = 5 + 4 = 9<br \/>\nThe framework sends 9 bytes of data to GTT for every 75th block.<br \/>\nBytes per second = (9 * 10) bytes per sec = 90 bytes per sec<\/p>\n<p><strong>Example #2:<\/strong><br \/>\nSampleRate = 48000, BlockLength = 64, len = 128 and commands per second = 6<\/p>\n<p>Number of blocks per second = 48000 \/ 64 = 750<br \/>\nBlocks per message = 750 \/ 6 = 125<br \/>\nBytes per message = 5 + 128 = 133<br \/>\nThe framework sends 133 bytes of data to GTT for every 125th block.<br \/>\nBytes per second = (133 * 6) bytes per sec = 798 bytes per sec<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To enable live streaming for a particular state variable, below steps needs to be performed by the audio object. 1. The XML section of the state variable has to be updated to convey that state variable is streamable to GTT. The optional variable after the bit converter has to be set to true to enable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","footnotes":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[]},"categories":[353],"tags":[],"coauthors":[165],"_links":{"self":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/4699"}],"collection":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4699"}],"version-history":[{"count":13,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/4699\/revisions"}],"predecessor-version":[{"id":28040,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/4699\/revisions\/28040"}],"wp:attachment":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4699"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcoauthors&post=4699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}