AudioKit / AudioKitUI

Controls and Visualization for AudioKit apps
MIT License
187 stars 52 forks source link

Isseu when reset fileURL in MIDITrackView #74

Open airakivela opened 8 months ago

airakivela commented 8 months ago

macOS Version(s) Used to Build

macOS 13 Ventura

Xcode Version(s)

Xcode 14

Description

HI. Thanks for this wonderful Package.. I am developing MIDI mixing applictions now. When I clcik import button to fetch midi file, this midi file tracks has been displayed in MIDITrackView. And then I click this button again to fetch other midi file, MIDITrackView displayes first imported midi file and second file at the same time.. But after then when I do above process again (but this time, I select first midi file), MIDITrackView displays only first midi file tracks as I expected.. What waht the reason?? Thanks for your support.

Crash Logs, Screenshots or Other Attachments (if applicable)

No response

emurray2 commented 8 months ago

Hi, thanks for your feedback. This is likely due to the current implementation of MIDITrackView and the view not redrawing when a new file is loaded. I'm not sure why it chooses to draw the first file again, but any screenshots/code you might be able to provide would be appreciated.

I'm currently working on a new implementation of this, and any of the steps to reproduce this issue will be considered and tested during development of the new implementation.

airakivela commented 8 months ago

Hi. @emurray2 Thanks for your reply.. We can initiate MIDITrackView with file url (optional). So I thought if we set this url as nil, we can clear and set url with new one.. But it did not work as expected.. Seems like it works some times but almost did not work.. (Looks like as if append...) I will add video here. Thanks.

https://github.com/AudioKit/AudioKitUI/assets/107959926/9603d6c4-828b-4d28-9640-39aeeefc9d8c

emurray2 commented 8 months ago

Hi. @emurray2 Thanks for your reply.. We can initiate MIDITrackView with file url (optional). So I thought if we set this url as nil, we can clear and set url with new one.. But it did not work as expected.. Seems like it works some times but almost did not work.. (Looks like as if append...) I will add video here. Thanks. Screen.Recording.2023-10-14.at.12.24.18.AM.mov

That makes sense, I appreciate you sharing this video. I saw when you loaded the first file it did have more tracks from the other loaded file than I expected. I suspect the issue is I didn't implement a state-management system to help the track clear when the file is either changed or set to nil. I'll play around with it a bit, see if I can replicate this and rectify it as best I can in the current implementation.