Wohlstand / libOPNMIDI

A Software MIDI Synthesizer library with OPN2 (YM2612) emulator
GNU Lesser General Public License v3.0
96 stars 6 forks source link

Fix a few things and unit test #18

Closed jpcima closed 6 years ago

jpcima commented 6 years ago

1.

I reject the activenotes unit test as invalid. :smile:

In that test the members {note, active} of NoteInfo are not initialized. Before, I made these initialized at the level of ChooseDevice. To arrange things better and make the unit test pass, I set them up in the constructor of the channel. Please note about Ch.resize(n +16): it's not necessary to pass a second argument. It's probably better not to, for the sake of C++ version 11 and up.

2.

I modified the user map. First, for the sake of code organization, implementations go in .cpp. I did not modify any of the existing implementation. However I added the copy methods. These are required because copying a LocationData into another will have an ill effect of copying the list's head pointers into the other. The pointers from different cell storages will mix, with the effects you can probably guess. The copy method will reproduce the list of the other into its own storage. I add the asserts here and there to fortify code checks against potential errors.

jpcima commented 6 years ago

PS: about this unit test framework, holy crap Compiling the test case puts some crazy strain on my computer RAM. (up to 1GB RAM) It will swap the computer to death. I just have 4GB and it's already full because of Web browser + Clang code assistance tools. I need to find more RAM sticks to put in this old thing.

Wohlstand commented 6 years ago

VLC no more crashing, Yeah! :smile: Gotta to build this to my phone...

Wohlstand commented 6 years ago

Damn, seems another crash happen on the phone: _2018-04-22_19-30-57 Happen on applySetup() after bank loading. Yeah, applySetup() is calling multiple times: first time on initialization, second time on setup change, on bank reload, and on MIDI file load.

default

jpcima commented 6 years ago

Does anything happen if you change:

ch.resize(opn.NumChannels, OpnChannel());

to

ch.resize(opn.NumChannels);

jpcima commented 6 years ago

@Wohlstand

Yeah it triggers the assertion because a null list is assigned to another. In fact change this:

    // if(users == users_first) {
    if(users == users_first && users) {