Closed miguel-negrao closed 12 years ago
Typo: \diskSoundfile should be \diskSoundFile
( x = DiskSndFile(Platform.resourceDir +/+ "sounds/a11wlk01.wav"); y = U(\diskSoundFile,[\soundFile, x]); UChain(y, \output).gui )
bench{ y.prepare(s) } time to run: 0.00044149399991511 seconds.
bench{ y.start(s) } time to run: 0.00052955599994675 seconds.
I think it was trying to load a \diskSoundfile udef from disk, finding \diskSoundFile instead (apparently case-insensitive), but every time the U was prepared it found that the name of it's udef didn't correspond with its key, therefore loaded it again. This is the only way to explain this strange behaviour. We should probably make some kind of error detection mechanism for this, as it might drive people wild (like it did me and you :-) )
Ouch... you mean it can't distinguish between a file named diskSoundfile.scd and diskSoundFile.scd ?? That's a nasty bug.
but what should it do? Should we ignore case, and correct the defName to the actual case of the loaded def? Or should we be strict, and let it post a "not found" message in this case?
I think we should be strict and say it's not found.
hmm, not so easy. The case insensitivity seems to be system wide. Not sure how to check if a file really exists..
File.exists( Udef.createDefFilePath( Udef.defsFolders[0], \bufSoundFile) ) -> true File.exists( Udef.createDefFilePath( Udef.defsFolders[0], \bufSoundfile) ) -> also true File.exists( Udef.createDefFilePath( Udef.defsFolders[0], \bufSoundfil) ) -> false
Ok, I pushed a fix for this. It is a bit hacky but it works. Also check the comments. Now it will break when you try to use a non-existing udef.
Perhaps a better solution still would be to allow U's with no udef, but give warnings about them in the post window. But it's quite some work to figure out on what places we'd need to change things for that. So for now; it just breaks. The chances of this happening via gui are minimal, it's only a code thing.
ok, at least it doesn't cause misterious issues. We'll fix it for good when we "upgrade" to 3.5. I've also commited the fix to the prepare thing and the new specs.
( x = DiskSndFile(Platform.resourceDir +/+ "sounds/a11wlk01.wav"); y = U(\diskSoundfile,[\soundFile, x]); UChain(y, \output).gui )
bench{ y.prepare(s) } time to run: 0.42901564400017 seconds.
bench{ y.start(s) } time to run: 0.87287230099992 seconds. 0.87287230099992 late 0.688585972 late 0.688585972
Specifying the target cuts the time in half: bench{ y.start(s) } time to run: 0.43069267400006 seconds. 0.43069267400006 late 0.244571431