SMF: fix breakage when instrument names contain spaces.

This commit is contained in:
Jonathan Moore Liles 2008-04-10 19:08:13 -05:00
parent 047a003df1
commit 4f186d9acb
1 changed files with 8 additions and 4 deletions

12
smf.C
View File

@ -805,24 +805,28 @@ smf::read_pattern_info ( pattern *p )
name_set = true; name_set = true;
break; break;
case smf::INSTRUMENT: case smf::INSTRUMENT:
// FIXME: decode mapping;
{ {
char *s = read_text(); char *s = read_text();
char pat[256]; char pat[256];
if ( 1 == sscanf( s, "Instrument: %s", pat ) ) if ( 1 == sscanf( s, "Instrument: %[^\n]", pat ) )
{ {
if ( ! p->mapping.open( Mapping::INSTRUMENT, pat ) ) if ( ! p->mapping.open( Mapping::INSTRUMENT, pat ) )
{
p->mapping.open( Mapping::SCALE, "Chromatic" );
WARNING( "could not find instrument \"%s\"", pat ); WARNING( "could not find instrument \"%s\"", pat );
} }
}
else else
if ( 1 == sscanf( s, "Scale: %s", pat ) ) if ( 1 == sscanf( s, "Scale: %[^\n]", pat ) )
{ {
if ( ! p->mapping.open( Mapping::SCALE, pat ) ) if ( ! p->mapping.open( Mapping::SCALE, pat ) )
{
p->mapping.open( Mapping::SCALE, "Chromatic" );
WARNING( "could not find scale \"%s\"", pat ); WARNING( "could not find scale \"%s\"", pat );
} }
}
break; break;
} }
case smf::PORT: case smf::PORT: