ncassetta / NiCMidi

A MIDI C++ library with objects for reading, writing, playing, editing and recording midi files
GNU Lesser General Public License v3.0
2 stars 1 forks source link

Compiler warning for recorder.ccp:448 #5

Closed goofy2k closed 2 years ago

goofy2k commented 2 years ago

warning: comparison is always false due to limited range of data type [-Wtype-limits] if (ch1 == ch2 || ch2 == -1)

Also (maybe related): I cannot set channel to -1 1 (or 255) in bool SetTrackRecChannel(unsigned int trk_num, char chan);

This is probably NOT the cause of my problem with failure of insertion in the track (or detection that a message is IN the track).

ncassetta commented 2 years ago

My compiler (gcc) doesn't give me that warning. Try to cast -1 to a char or to use 0xff instead. See also my answer on the other issue

goofy2k commented 2 years ago

OK. This was just to let you know.

goofy2k commented 2 years ago

I don't see your other answer....

ncassetta commented 2 years ago

I answered just now. Your warning COULD be the cause of your problem: if the conditional at line 448 fails line 450 is not executed and the message is not inserted into the track. You could try to substitute line 448 with if (true) and see if it works

goofy2k commented 2 years ago

I noticed that it works even without changing this line.

The "error" fact that DumpAllTracksAtrr(sequencer.GetMultitrack(),verbose) does not report the recorded events. When I use DumpMidiTrackWithPauses(trk, 1) the events are reported.

Op za 18 dec. 2021 20:47 schreef Nicola Cassetta @.***>:

I answered just now. Your warning COULD be the cause of your problem: if the conditional at line 448 fails line 450 is not executed and the message is not inserted into the track. You could try to substitute line 448 with if (true) and see if it works

— Reply to this email directly, view it on GitHub https://github.com/ncassetta/NiCMidi/issues/5#issuecomment-997275970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGII3TXBAZQKYBTPDTF6WOLURTQLLANCNFSM5KKW4R4Q . You are receiving this because you authored the thread.Message ID: @.***>

goofy2k commented 2 years ago

This issue is probably not related to issue #6. It is just a compiler warning that may lead to unwanted behaviour when the channels have other settings than mine. I will investigate it once again and try your suggested repair.