Skip to content
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

Fix Lazy Loading #294

Merged
merged 2 commits into from Jul 13, 2023
Merged

Fix Lazy Loading #294

merged 2 commits into from Jul 13, 2023

Conversation

geikha
Copy link
Contributor

@geikha geikha commented Jul 8, 2023

Fixes #290

This was SO hard to catch...

Basically lazy loading wouldn't work properly because the custom readWithInfo method added to Buffer wasn't explicitly returning the buffer itself when onlyHeader (which is set according to doNotReadYet) was set to true. It was returning nil, which would result on the buffer not being added to the buffers IdentityDictionary.

readWithInfo { |startFrame = 0, argNumFrames = -1, onlyHeader = false, onComplete|
		...
		^if(failed) {
			...
		} {
			if(onlyHeader.not) {
				if(argNumFrames > 0) { numFrames = argNumFrames };
				this.allocRead(path, startFrame, numFrames, completionMessage: { |b|
					onComplete.value(b)
				});
			} { this; } // this wasn't here before
		}
	}

Tested on my Windows 10 machine.

@telephon telephon self-assigned this Jul 13, 2023
just formatting
@telephon telephon merged commit d5be37d into musikinformatik:develop Jul 13, 2023
@geikha geikha deleted the fix-lazy-loading branch July 13, 2023 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lazy Sample Loading doesn't find any samples (Windows 11/SuperCollider 3.12.1)
2 participants