From fc38ce4d96c77b0405e1c884f967b6583ac7efb0 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 4 Mar 2009 18:40:10 +0100 Subject: [PATCH] MidiImport: show an information message if no default soundfont has been set (closes #2660545) Backported from e4a6fde320bac5f972b752975421c741aab7209e (master) --- plugins/midi_import/midi_import.cpp | 60 +++++++---------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index 964503403..11a9e60c5 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -1,7 +1,7 @@ /* * midi_import.cpp - support for importing MIDI-files * - * Copyright (c) 2005-2008 Tobias Doerffel + * Copyright (c) 2005-2009 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "midi_import.h" @@ -92,6 +93,18 @@ bool midiImport::tryImport( trackContainer * _tc ) { return( FALSE ); } + if( engine::hasGUI() && + configManager::inst()->defaultSoundfont().isEmpty() ) + { + QMessageBox::information( engine::getMainWindow(), + tr( "Setup incomplete" ), + tr( "You do not have set up a default soundfont in " + "the settings dialog (Edit->Settings). " + "Therefore no sound will be played back after " + "importing this MIDI file. You should download " + "a General MIDI soundfont, specify it in " + "settings dialog and try again." ) ); + } switch( readID() ) { @@ -471,51 +484,6 @@ bool midiImport::readSMF( trackContainer * _tc ) } return true; - - - /* - // the curren position is immediately after the "MThd" id - int header_len = readInt( 4 ); - if( header_len < 6 ) - { -invalid_format: - printf( "midiImport::readSMF(): invalid file format\n" ); - return( FALSE ); - } - - int type = readInt( 2 ); - if( type != 0 && type != 1 ) - { - printf( "midiImport::readSMF(): type %d format is not " - "supported\n", type ); - return( FALSE ); - } - - int num_tracks = readInt( 2 ); - if( num_tracks < 1 || num_tracks > 1000 ) - { - printf( "midiImport::readSMF(): invalid number of tracks (%d)\n", - num_tracks ); - num_tracks = 0; - return( FALSE ); - } - -#ifdef LMMS_DEBUG - printf( "tracks: %d\n", num_tracks ); -#endif - - m_timingDivision = readInt( 2 ); - if( m_timingDivision < 0 ) - { - goto invalid_format; - } -#ifdef LMMS_DEBUG - printf( "time-division: %d\n", m_timingDivision ); -#endif - - - */ - }