clone45 / voxglitch

Modules for VCV Rack
GNU General Public License v3.0
98 stars 16 forks source link

Samples Out of Order on Mac & Linux #239

Open justindelay opened 1 month ago

justindelay commented 1 month ago

Hi, I appear to be running into the sample sort issue in Wav Bank. I have tried every combo of naming, changing date created/modified, etc. but can't seem to discern what the actual sort order logic is.

I get this problem consistently on Macs and on Linux running on a Raspberry Pi.

The problem is consistent across both Wav Bank and Wav Bank MC.

clone45 commented 1 month ago

Thanks Justin! I'll try to look at this soon, but I haven't been working on the modules for a while, and it might take some time before I can jump back in. - Bret

On Tue, May 28, 2024 at 1:16 PM justindelay @.***> wrote:

Hi, I appear to be running into the sample sort issue in Wav Bank. I have tried every combo of naming, changing date created/modified, etc. but can't seem to discern what the actual sort order logic is.

I get this problem consistently on Macs and on Linux running on a Raspberry Pi.

The problem is consistent across both Wav Bank and Wav Bank MC.

— Reply to this email directly, view it on GitHub https://github.com/clone45/voxglitch/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKPKM3KY2F4SHNLTOQT3UDZETQY3AVCNFSM6AAAAABINTMHVOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDCOBUGY3DGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

justindelay commented 1 month ago

I'm happy to help in any way I can. As far as I can tell, the sort order is arbitrary. I've used numbers, letters, and symbols to try to work out what order the module is loading samples in, and I am stumped.

clone45 commented 1 month ago

Thanks. I took a quick look at the code, and I don't see anything that jumps out at me. I added sorting specifically for mac. Sorry for the bug. I'll do my best! (Also, I'm looking for work if you know of any openings for a software developer, development manager, or product manager. :-)

void load_samples_from_path(std::string path) { // Clear out any old .wav files // Reminder: this->samples is a vector, and vectors have a .clear() menthod. this->samples.clear();

// Load all .wav files found in the folder specified by 'path'
this->rootDir = path;

std::vector<std::string> dirList = system::getEntries(path.c_str());

// Sort the vector.  This is in response to a user who's samples were

being // loaded out of order. I think it's a mac thing. sort(dirList.begin(), dirList.end()); // <======================================== sorting

// TODO: Decide on a maximum memory consumption allowed and abort if
// that amount of memory would be exhausted by loading all of the files
// in the folder.
for (auto entry : dirList)
{
  if (
    // Something happened in Rack 2 where the extension started to

include // the ".", so I decided to check for both versions, just in case. (rack::string::lowercase(system::getExtension(entry)) == "wav") || (rack::string::lowercase(system::getExtension(entry)) == ".wav") ) { // Create new multi-channel sample. This structure is defined in Common/sample_mc.hpp SampleMC new_sample;

    // Load the sample data from the disk
    new_sample.load(entry);

    // Reminder: .push_back is a method of vectors that pushes the

object // to the end of a list. this->samples.push_back(new_sample); } } }

On Tue, May 28, 2024 at 1:39 PM justindelay @.***> wrote:

I'm happy to help in any way I can. As far as I can tell, the sort order is arbitrary. I've used numbers, letters, and symbols to try to work out what order the module is loading samples in, and I am stumped.

— Reply to this email directly, view it on GitHub https://github.com/clone45/voxglitch/issues/239#issuecomment-2136066590, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKPKM3EIHIH4OW7ZYCKOOLZETTOTAVCNFSM6AAAAABINTMHVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZWGA3DMNJZGA . You are receiving this because you commented.Message ID: @.***>

justindelay commented 1 month ago

Thanks Bret, I truly appreciate it. I'll reach out directly.

justindelay commented 1 month ago
Screenshot 2024-05-28 at 3 55 43 PM
justindelay commented 1 month ago

And FWIW, I get the same odd sort order in the Sampler from Lomas.

justindelay commented 1 month ago

It looks like the Player module from cf is respecting the file sort order. Player from cf

Do we need to explicitly include "algorithm" when using sort?

Here is the specific code snippet:

    sort(fichier.begin(), fichier.end());  // Linux needs this to get files in right order
        for (int o=0;o<int(fichier.size()-1); o++) {
            if ((dir + "/" + fichier[o])==path) {
                sampnumber = o;
            }
        }
justindelay commented 1 month ago

PS- would be happy to discuss compensation on this and tell you more about what I'm up to. Can we connect via email?

clone45 commented 1 month ago

Sure! Feel free to reach out to me at @.*** I'd love to hear what you're up to!

On Wed, May 29, 2024 at 2:29 PM justindelay @.***> wrote:

PS- would be happy to discuss compensation on this and tell you more about what I'm up to. Can we connect via email?

— Reply to this email directly, view it on GitHub https://github.com/clone45/voxglitch/issues/239#issuecomment-2138293545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKPKM3DUOXHJYB7DJUTGNDZEZCB7AVCNFSM6AAAAABINTMHVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGI4TGNJUGU . You are receiving this because you commented.Message ID: @.***>

justindelay commented 1 month ago

I dropped you a line on LinkedIn, looks like we can't share emails via GitHub.