Hi,
i wrote a bugfix for bug #47 today. The trouble appeared in
getTickForPosition.
Or to be more precious, in the following line:
pos = pos % nPatternGroups;
This raised an error if nPatternGroups was 0. I fixed it by adding "if(
nPatternGroups == 0 ) return -1; ".
It would be cool if someone with a deeper knowledge of this function can
review the change.
Thanks,
Sebastian
long Hydrogen::getTickForPosition( int pos )
{
int nPatternGroups = m_pSong->get_pattern_group_vector()->size();
if( nPatternGroups == 0 ) return -1;
if ( pos >= nPatternGroups ) {
if ( m_pSong->is_loop_enabled() ) {
pos = pos % nPatternGroups;
} else {
_WARNINGLOG( QString( "patternPos > nPatternGroups. pos:"
" %1, nPatternGroups: %2")
.arg( pos )
.arg( nPatternGroups ) );
return -1;
}
}
std::vector<PatternList*> *pColumns =
m_pSong->get_pattern_group_vector();
long totalTick = 0;
int nPatternSize;
Pattern *pPattern = NULL;
for ( int i = 0; i < pos; ++i ) {
PatternList *pColumn = ( *pColumns )[ i ];
// prendo solo il primo. I pattern nel gruppo devono avere la
// stessa lunghezza
pPattern = pColumn->get( 0 );
if ( pPattern ) {
nPatternSize = pPattern->get_lenght();
} else {
nPatternSize = MAX_NOTES;
}
totalTick += nPatternSize;
}
return totalTick;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel