fixed compiler warnings

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1680 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-21 23:47:02 +00:00
parent 300baab2f1
commit 778293b31e
20 changed files with 113 additions and 50 deletions

View File

@@ -1,5 +1,61 @@
2008-09-21 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/plugin.cpp:
always return a dummy model in plugin::getChildModel() for not
crashing if something goes wrong
* include/controller_connection_dialog.h:
* src/gui/controller_connection_dialog.cpp:
automatically enable auto-detect LED when selecting a MIDI device
* include/remote_plugin.h:
* src/core/audio/audio_device.cpp:
* src/core/audio/audio_oss.cpp:
* src/core/drumsynth.cpp:
* src/core/main.cpp:
* src/core/mixer.cpp:
* src/core/sample_record_handle.cpp:
* src/core/track_container.cpp:
* src/gui/widgets/lcd_spinbox.cpp:
* plugins/bit_invader/bit_invader.cpp:
* plugins/lb302/lb302.cpp:
* plugins/midi_import/portsmf/allegrosmfwr.cpp:
* plugins/midi_import/portsmf/allegro.cpp:
* plugins/midi_import/midi_import.cpp:
* plugins/papu/gb_apu/Blip_Buffer.cpp:
* plugins/papu/gb_apu/Blip_Synth.h:
* plugins/papu/gb_apu/blargg_source.h:
* plugins/papu/gb_apu/Blip_Buffer.h:
* plugins/sf2_player/sf2_player.cpp:
fixed compiler warnings
* src/core/midi/midi_alsa_seq.cpp:
fixed subscription of output ports
* include/group_box.h:
* include/midi.h:
* include/midi_port.h:
* include/instrument_midi_io_view.h:
* src/core/midi/midi_port.cpp:
* src/gui/widgets/instrument_midi_io_view.cpp:
* data/themes/default/midi_in.png:
* data/themes/default/midi_out.png:
refactored MIDI tab in instrumentTrackWindow which now also allows
setting arbitrary fixed velocity and defining a program for MIDI output
* include/midi_mapper.h:
* src/core/midi/midi_mapper.cpp:
* data/midi-maps/gm.map:
* data/midi-maps/YamahaPSS790.map:
* data/midi-maps/YamahaPSR400.map:
* data/midi-maps/YamahaPSR500.map:
* data/midi-maps/YamahaQY10.map:
* data/midi-maps/README:
removed obsolete/unused support for MIDI maps
* CMakeLists.txt:
enable all compiler warnings per default
* include/audio_file_ogg.h:
* include/audio_file_device.h:
* src/gui/export_project_dialog.cpp:

View File

@@ -348,7 +348,7 @@ public:
private:
static inline int fastMemCpy( void * _dest, const void * _src,
static inline void fastMemCpy( void * _dest, const void * _src,
const int _len )
{
// calling memcpy() for just an integer is obsolete overhead
@@ -563,7 +563,7 @@ public:
return m;
}
inline bool fetchAndProcessAllMessages( void )
inline void fetchAndProcessAllMessages( void )
{
while( messagesLeft() )
{
@@ -810,7 +810,7 @@ void remotePluginBase::sendMessage( const message & _m )
m_out->writeInt( _m.id );
m_out->writeInt( _m.data.size() );
int j = 0;
for( int i = 0; i < _m.data.size(); ++i )
for( unsigned int i = 0; i < _m.data.size(); ++i )
{
m_out->writeString( _m.data[i] );
j += _m.data[i].size();

View File

@@ -70,12 +70,12 @@ plugin::descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor =
bSynth::bSynth( float * _shape, int _length, notePlayHandle * _nph, bool _interpolation,
float _factor, const sample_rate_t _sample_rate ) :
sample_length( _length ),
nph( _nph ),
interpolation( _interpolation),
sample_rate( _sample_rate ),
sample_index( 0 ),
sample_realindex( 0 )
sample_realindex( 0 ),
nph( _nph ),
sample_length( _length ),
sample_rate( _sample_rate ),
interpolation( _interpolation)
{
sample_shape = new float[sample_length];
for (int i=0; i < _length; i++)

View File

@@ -525,7 +525,7 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
sample_cnt++;
vcf_envpos++;
int decay_frames = 128;
//int decay_frames = 128;
// update vco
vco_c += vco_inc;
@@ -718,7 +718,7 @@ void lb302Synth::initNote( lb302Note *n)
void lb302Synth::playNote( notePlayHandle * _n, bool,
sampleFrame * _working_buffer )
{
fpp_t framesPerPeriod = engine::getMixer()->framesPerPeriod();
//fpp_t framesPerPeriod = engine::getMixer()->framesPerPeriod();
if( _n->isArpeggioBaseNote() )
{

View File

@@ -339,8 +339,9 @@ bool midiImport::readSMF( trackContainer * _tc )
if( evt->chan == -1 )
{
printf("MISSING GLOBAL THINGY\n");
printf(" %d %d %f %s\n", evt->chan,
evt->get_type_code(), evt->time, evt->get_attribute() );
printf(" %d %d %f %s\n", (int) evt->chan,
evt->get_type_code(), evt->time,
evt->get_attribute() );
// Global stuff
}
else if( evt->is_note() && evt->chan < 256 )
@@ -445,7 +446,7 @@ bool midiImport::readSMF( trackContainer * _tc )
}
}
else {
printf("Unhandled update: %d %d %f %s\n", evt->chan,
printf("Unhandled update: %d %d %f %s\n", (int) evt->chan,
evt->get_type_code(), evt->time, evt->get_attribute() );
}
}

View File

@@ -29,7 +29,7 @@ using namespace std;
// 4311 is type cast ponter to long warning
// 4996 is warning against strcpy
// 4267 is size_t to long warning
#pragma warning(disable: 4311 4996 4267)
//#pragma warning(disable: 4311 4996 4267)
Alg_atoms symbol_table;
Serial_buffer Alg_track::ser_buf; // declare the static variable
@@ -121,7 +121,7 @@ void Alg_parameter::show()
printf("%s:%s", attr_name(), s);
break;
case 'i':
printf("%s:%d", attr_name(), i);
printf("%s:%d", attr_name(), (int) i);
break;
case 'l':
printf("%s:%s", attr_name(), (l ? "t" : "f"));
@@ -601,7 +601,7 @@ void Alg_note::show()
{
printf("Alg_note: time %g, chan %d, dur %g, key %d, "
"pitch %g, loud %g, attributes ",
time, chan, dur, key, pitch, loud);
time, (int) chan, dur, (int) key, pitch, loud);
Alg_parameters_ptr parms = parameters;
while (parms) {
parms->parm.show();
@@ -668,8 +668,9 @@ Alg_event_ptr Alg_events::uninsert(long index)
{
assert(0 <= index && index < len);
Alg_event_ptr event = events[index];
printf("memmove: %x from %x (%d)\n", events + index, events + index + 1,
sizeof(Alg_event_ptr) * (len - index - 1));
printf("memmove: %x from %x (%d)\n", (int) ( events + index ),
(int) ( events + index + 1 ),
(int)( sizeof(Alg_event_ptr) * (len - index - 1) ) );
memmove(events + index, events + index + 1,
sizeof(Alg_event_ptr) * (len - index - 1));
len--;
@@ -1741,7 +1742,7 @@ void Alg_track::paste(double t, Alg_event_list *seq)
assert(get_type() == 't');
// seq can be an Alg_event_list, an Alg_track, or an Alg_seq
// if it is an Alg_event_list, units_are_seconds must match
bool prev_units_are_seconds;
bool prev_units_are_seconds = false;
if (seq->get_type() == 'e') {
assert(seq->get_owner()->get_units_are_seconds() == units_are_seconds);
} else { // make it match
@@ -2193,8 +2194,8 @@ void Alg_tracks::reset()
// all track events are incorporated into the seq,
// so all we need to delete are the arrays of pointers
for (int i = 0; i < len; i++) {
printf("deleting track at %d (%x, this %x) = %x\n", i, &(tracks[i]),
this, tracks[i]);
printf("deleting track at %d (%x, this %x) = %x\n", i, (int) &(tracks[i]),
(int) this, (int) tracks[i]);
delete tracks[i];
}
if (tracks) delete [] tracks;
@@ -2817,7 +2818,7 @@ Alg_event_ptr Alg_seq::iteration_next()
long cur; // a track index
// find lowest next time of any track:
double next = 1000000.0;
int i, track;
int i, track = 0;
for (i = 0; i < track_list.length(); i++) {
Alg_track &tr = track_list[i];
cur = current[i];
@@ -2853,7 +2854,7 @@ void Alg_seq::merge_tracks()
long notes_index = 0;
Alg_event_ptr event;
while (event = iteration_next()) {
while (( event = iteration_next() )) {
notes[notes_index++] = event;
}
track_list.reset(); // don't need them any more

View File

@@ -353,7 +353,7 @@ void Alg_smf_write::write_update(Alg_update_ptr update)
int len = strlen(s);
char smpteoffset[5];
if (len < 24) return; // not long enough, must be bad format
int fps;
int fps = 0;
if (s[0] == '2') {
if (s[1] == '4') fps = 0;
else if (s[1] == '5') fps = 1;

View File

@@ -119,7 +119,7 @@ long Blip_Buffer::count_samples( blip_time_t t ) const
blip_time_t Blip_Buffer::count_clocks( long count ) const
{
if ( count > buffer_size_ )
if ( count > (long) buffer_size_ )
count = buffer_size_;
return ((count << BLIP_BUFFER_ACCURACY) - offset_ + (factor_ - 1)) / factor_;

View File

@@ -229,13 +229,13 @@ inline long Blip_Buffer::sample_rate() const {
inline void Blip_Buffer::end_frame( blip_time_t t ) {
offset_ += t * factor_;
assert(( "Blip_Buffer::end_frame(): Frame went past end of buffer",
samples_avail() <= (long) buffer_size_ ));
/* assert(( "Blip_Buffer::end_frame(): Frame went past end of buffer",
samples_avail() <= (long) buffer_size_ ));*/
}
inline void Blip_Buffer::remove_silence( long count ) {
assert(( "Blip_Buffer::remove_silence(): Tried to remove more samples than available",
count <= samples_avail() ));
/* assert(( "Blip_Buffer::remove_silence(): Tried to remove more samples than available",
count <= samples_avail() ));*/
offset_ -= blip_resampled_time_t (count) << BLIP_BUFFER_ACCURACY;
}

View File

@@ -143,8 +143,8 @@ inline void Blip_Synth<quality,range>::offset_resampled( blip_resampled_time_t t
typedef blip_pair_t_ pair_t;
unsigned sample_index = (time >> BLIP_BUFFER_ACCURACY) & ~1;
assert(( "Blip_Synth/Blip_wave: Went past end of buffer",
sample_index < blip_buf->buffer_size_ ));
/* assert(( "Blip_Synth/Blip_wave: Went past end of buffer",
sample_index < blip_buf->buffer_size_ ));*/
enum { const_offset = Blip_Buffer::widest_impulse_ / 2 - width / 2 };
pair_t* buf = (pair_t*) &blip_buf->buffer_ [const_offset + sample_index];

View File

@@ -16,7 +16,7 @@
// module. A failed requirement indicates a bug outside the module.
// void require( bool expr );
#undef require
#define require( expr ) assert(( "unmet requirement", expr ))
#define require( expr ) assert((/* "unmet requirement",*/ expr ))
// Like printf() except output goes to debug log file. Might be defined to do
// nothing (not even evaluate its arguments).

View File

@@ -22,6 +22,7 @@
*
*/
#include <QtCore/QDebug>
#include <QtCore/QTextStream>
#include <QtGui/QLayout>
#include <QtGui/QLabel>
@@ -267,6 +268,8 @@ automatableModel * sf2Instrument::getChildModel( const QString & _modelName )
{
return &m_patchNum;
}
qCritical() << "requested unknown model " << _modelName;
return NULL;
}

View File

@@ -35,11 +35,11 @@
audioDevice::audioDevice( const ch_cnt_t _channels, mixer * _mixer ) :
m_supportsCapture( false ),
m_sampleRate( _mixer->processingSampleRate() ),
m_channels( _channels ),
m_mixer( _mixer ),
m_buffer( new surroundSampleFrame[getMixer()->framesPerPeriod()] ),
m_supportsCapture( false )
m_buffer( new surroundSampleFrame[getMixer()->framesPerPeriod()] )
{
int error;
if( ( m_srcState = src_new(

View File

@@ -314,7 +314,10 @@ void audioOSS::run( void )
int bytes = convertToS16( temp, frames,
getMixer()->masterGain(), outbuf,
m_convertEndian );
write( m_audioFD, outbuf, bytes );
if( write( m_audioFD, outbuf, bytes ) != bytes )
{
break;
}
}
delete[] temp;

View File

@@ -121,7 +121,7 @@ void DrumSynth::GetEnv(int env, const char *sec, const char *key, const char *in
char en[256], s[8];
int i=0, o=0, ep=0;
GetPrivateProfileString(sec, key, "0,0 100,0", en, sizeof(en), ini);
en[256]=0; //be safe!
en[255]=0; //be safe!
while(en[i]!=0)
{
@@ -261,17 +261,16 @@ int DrumSynth::GetDSFileSamples(const char *dsfile, int16_t *&wave, int channels
char sec[32];
char ver[32];
char comment[256];
char percent[16];
int commentLen=0;
//generation
long Length, pos=0, tpos=0, tplus, totmp, t, i, j;
long Length, tpos=0, tplus, totmp, t, i, j;
float x[3] = {0.f, 0.f, 0.f};
float MasterTune, randmax, randmax2;
int MainFilter, HighPass;
long NON, NT, TON, DiON, TDroop=0, DStep;
float a, b=0.f, c=0.f, d=0.f, g, TT=0.f, TTT=0.f, TL, NL, F1, F2, Fsync;
float a, b=0.f, c=0.f, d=0.f, g, TT=0.f, TL, NL, F1, F2, Fsync;
float TphiStart=0.f, Tphi, TDroopRate, ddF, DAtten, DGain;
long BON, BON2, BFStep, BFStep2, botmp;

View File

@@ -87,10 +87,10 @@ int main( int argc, char * * argv )
for( int i = 1; i < argc; ++i )
{
if( argc > i && ( QString( argv[i] ) == "--render" ||
if( argc > i && ( ( QString( argv[i] ) == "--render" ||
QString( argv[i] ) == "-r" ) ||
( QString( argv[i] ) == "--help" ||
QString( argv[i] ) == "-h" ) )
QString( argv[i] ) == "-h" ) ) )
{
core_only = TRUE;
break;

View File

@@ -276,6 +276,8 @@ private:
mixer::mixer( void ) :
m_framesPerPeriod( DEFAULT_BUFFER_SIZE ),
m_workingBuf( NULL ),
m_inputBufferRead( 0 ),
m_inputBufferWrite( 1 ),
m_readBuf( NULL ),
m_writeBuf( NULL ),
m_cpuLoad( 0 ),
@@ -288,9 +290,7 @@ mixer::mixer( void ) :
m_masterGain( 1.0f ),
m_audioDev( NULL ),
m_oldAudioDev( NULL ),
m_globalMutex( QMutex::Recursive ),
m_inputBufferRead( 0 ),
m_inputBufferWrite( 1 )
m_globalMutex( QMutex::Recursive )
{
for( int i = 0; i < 2; ++i )
{

View File

@@ -37,11 +37,11 @@
sampleRecordHandle::sampleRecordHandle( sampleTCO * _tco ) :
playHandle( SamplePlayHandle ),
m_framesRecorded( 0 ),
m_minLength( _tco->length() ),
m_track( _tco->getTrack() ),
m_bbTrack( NULL ),
m_tco( _tco ),
m_framesRecorded( 0 ),
m_minLength( _tco->length() )
m_tco( _tco )
{
}

View File

@@ -37,8 +37,8 @@
trackContainer::trackContainer( void ) :
model( NULL ),
journallingObject(),
m_tracks(),
m_tracksMutex()
m_tracksMutex(),
m_tracks()
{
}

View File

@@ -114,7 +114,7 @@ void lcdSpinBox::paintEvent( QPaintEvent * _me )
QRect cellRect( 0, 0, m_cellWidth, m_cellHeight );
int margin = 1; // QStyle::PM_DefaultFrameWidth;
int lcdWidth = m_cellWidth * m_numDigits + (margin*m_marginWidth)*2;
//int lcdWidth = m_cellWidth * m_numDigits + (margin*m_marginWidth)*2;
// p.translate( width() / 2 - lcdWidth / 2, 0 );
p.save();