Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

Fix Lazy Loading#294

Merged
telephon merged 2 commits intomusikinformatik:developfrom
geikha:fix-lazy-loading
Jul 13, 2023
Merged

Fix Lazy Loading#294
telephon merged 2 commits intomusikinformatik:developfrom
geikha:fix-lazy-loading

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
ahihi pushed a commit to ahihi/SuperDirt that referenced this pull request Jan 8, 2025
return buffer even if onlyHeader
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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