"init" should be preceded with alloc.
mySound := NSSound.alloc.initWithContentsOfFile_byReference(
NSStringUtf8('test.waw'), True); // should it be test.wav instead of .waw?
or a longer version
mySound := NSSound.alloc;
mySound := mySound.initWithContentsOfFile_byReference(
NSStringUtf8('test.waw'), True); // should it be test.wav instead of .waw?
mySound.play;
keep in mind that you HAVE to use the result of initXXX method as the actual object.
This is ObjC allocation/initialization rule.
Keep in mind that calling "alloc" requires you to use either "autorelease" or an explicit "release" at some point.
"autorelease" will deallocate the object as soon as it not need by Cocoa. (generally that means at the end of the current system event handling)
"release" will "deallocate" the object when you call it.
Yet, since all Cocoa object are Cocoa-reference counted, the term "deallocation" should not be taken literally. It's "deallocated" only from your own code perspective.