-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve loading a DLS file and searching for instruments in it #4
Conversation
Thank you very much for your contribution!. I just want to ask for some additional information. First of all, I want that every PR have an issue. It may be a request for enhancements or a request for bug fixes, or documentation about something, but the issue ticket should reflect a clear motivation for the changes. The pull request is not the place to explain the motivations, only the solution, or changes applied to achieve the goals stated by the issue. An example just have been added in the issue #5 and the PR #6 . By the way: XMF is a container format embedding SMF and DLS files in a single binary file. In this case, I would like to know:
Second: This project is a fork of the AOSP repository because I wanted to add a build system that makes it possible to use and distribute the library on any OS, which is something that probably Google is not interested to do. But I don't want to fork it in the sense of adding new functionality or fixing bugs without contributing to the upstream AOSP project. In this case, it would be better to send the pull request directly to the Google AOSP repo, and if they don't want to accept or do not react, then we can apply here the patches. We may apply here the changes anyway, of course. Finally: If the library code is changed, like in this case, then it would be nice to have unitary tests, just to confirm that in the future other future library changes are not breaking the functionality. Just imagine that Google changes something, and we want to pick those changes: what if they break something that we fixed here? This is exactly the situation why we want to contribute patches upstream in open source projects. |
I'm not clear what exactly should be in an issue and what in a pull request, so I'll write everything here for now. I'll address the second point first: The ability to load external DLS file (function EAS_LoadDLSCollection) was removed in AOSP, so I don't know how to demonstrate the issue there. Back to the first point: This isn't how I tested it originally, but the example program (
The actual path to .dls file should of course be used. I tested following DLS files:
I increased the limits to load 4 of 6 tested DLS files. And the last point: I don't have much experience with unitary tests, but how would you make a test for this ? |
Yes, it was removed by this commit af41595, which I've reverted.
I can't answer your questions, because I'm not affiliated with Google or AOSP. We may ask @philburk if he has some additional tips. The only thing I know is the AOSP contributing documentation and the Android tickets: examples. But they also begin the process with an issue ticket, as usual.
This is material for the issue ticket: the public header "eas.h" conditionally defines the function Lines 115 to 131 in 82ff2ab
This is material for an additional commit included in this pull request:
The changed example program should be included in a commit in this PR. Please let the DLS file to be an optional argument: sonivox/example/sonivoxrender.c Lines 247 to 251 in 82ff2ab
would become: while ((c = getopt (argc, argv, "hd:r:w:")) != -1) {
switch (c)
{
case 'h':
fprintf (stderr, "Usage: %s [-h] [-d file.dls] [-r 0..4] [-w 0..32765] file.mid ...\n"\
// ...
This list of successful and failing DLS files should be explained in the issue ticket.
No, the code should be self-explaining. If needed, you may add comments explaining something, and use named constants instead of "magic numbers".
That is correct. MIDI files do not have the obligation of conforming to GM, GS or XG. If MIDI files aren't prepared to be used with a DLS bank, the library should not make any effort to fix that.
Don't worry about it. It is nice to have that feature, but we may live without it. |
I can make a separate issue about this, but I don't know what's the correct or preferred solution, so I can't make a fix for it.
I can include the changed example program in a commit, but it depends on resolving the issue with DLS_SYNTHESIZER, so it will have to wait.
The way I see it, there are two principal uses for DLS files:
As it is now, the library can only work for the first use case. And for this use case your comment is correct - the library doesn't need to fix any problems. |
I said that the preferred solution is to remove |
A library doesn't do anything by itself, but needs a program linking the library that performs whatever is necessary to fulfill the use cases. I don't believe that the library should worry about your second use case, when the programs using the library can perform MIDI bank changes. This is a rule of software design called separation of policy and mechanism.
I am not convinced yet to accept the changes you propose. And this PR right now is incomplete, so it can't be merged. |
The problem with this theory is that the program doesn't know which banks/instruments are in the DLS file, but the library does. So the program can't do bank changes based on this information, but the library can. So the question remains. Should the library be usable for the second use case or not ? |
The program may know that information, if the developer is slightly smart. My VMPK application extracts the list of banks and programs from DLS and SF2 files, and builds INS text files (Cakewalk instruments definitions) using that information. Another program that performs a similar process (for SF2 files) is Qtractor. It is not so difficult.
My point remains. The library IS already usable for both use cases. |
The updated commit resolves issue #11. |
The embedded samples aren't very good, so I wanted to load a DLS file (using function EAS_LoadDLSCollection) to improve the quality, but some of the DLS file that I test weren't loaded and when a DLS file was loaded then the synthesizer was still using the embedded samples instead of samples from the DLS file.
So I made some changes to improve it: