Adding on to the previous mail, replacing the code in the for loop with the following also causes the corruption:<br><br> for( int i = 0; i < BANDS; i++ )<br> {<br> const float f_val = 2;<br> QString val = QString("%1").arg( f_val, 5, 'f', 1 );<br>
values += " " + val;<br> }<br> const char *psz_values = values.toAscii().constData();<br><br> <a href="http://i.imgur.com/gD8dc.png">http://i.imgur.com/gD8dc.png</a> -- the 2nd string is still corrupted<br>
<br><div class="gmail_quote">On Fri, Jun 17, 2011 at 2:43 AM, akash mehrotra <span dir="ltr"><<a href="mailto:mehrotra.akash@gmail.com">mehrotra.akash@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm trying to access the equalizer from the luahttp interface as a part of my GSoC project.<br>For this, I'm accessing the equalizer-bands string and parsing the gain values from that string in the interface code.<br>
<br>However, the string is corrupted/truncated sometimes when the equalizer is modified using the Qt interface.<br>The linked screen shot ( <a href="http://i.imgur.com/qeCT7.png" target="_blank">http://i.imgur.com/qeCT7.png</a> )displays the string and its hex value when the string is modified through the Qt interface (from extended_panels.cpp)<br>
<br>I'm using this code to print the string(the part indented to the extreme left is the code I added for printing out the string) from modules/gui/qt4/components/extended_panels.cpp :<br><br>void Equalizer::setCoreBands()<br>
{<br> /**\todo smoothing */<br><br> QString values;<br> for( int i = 0; i < BANDS; i++ )<br> {<br> const float f_val = (float)( bands[i]->value() ) / 10 - 20;<br> QString val = QString("%1").arg( f_val, 5, 'f', 1 );<br>
printf("%d\n",bands[i]->value()/10-20);<br> band_texts[i]->setText( band_frequencies[i] + "\n" + val + "dB" );<br> values += " " + val;<br> }<br> const char *psz_values = values.toAscii().constData();<br>
<br> aout_instance_t *p_aout = THEMIM->getAout();<br> if( p_aout )<br> {<br> //delCallbacks( p_aout );<br> var_SetString( p_aout, "equalizer-bands", psz_values );<br>int i=0;<br>while(psz_values[i]!='\0' && i<=100)<br>
printf("%02x",psz_values[i++]);<br>printf("\n%s\n",psz_values);<br> //addCallbacks( p_aout );<br> vlc_object_release( p_aout );<br> }<br>}<br><br><br><br><br>Is this fixable, or should I workaround this assuming that the values of the last 3 bands may not always be available.<br>
<br><br>
</blockquote></div><br>