Release 3.0, Copyright ©1998 by Sean Luke.  All Rights Reserved.



ModuleSoundView





Category Of: Sound

Declared In: ModuleSoundView.h




Category Description

This category contains specific methods which Resound has added to its internal subclass of the SoundView object, which module designers may find useful.

It is important to note that you should not access a sound's info string.  Due to bugs in the SoundKit, Resound must maintain the Sound object's Info String separately in Resound's custom SoundView.  Below are methods for accessing Resound's special Info String.

Rhapsody has introduced a nasty new bug to the SoundKit.  Ordinarily, just before a SoundView is hooked into a window (or unhooked from it), it calls a series of showCursor: and hideCursor: methods intended to make certain that only one SoundView at a time has the sound cursor (the blinking vertical line) in it.  Problem is, these methods also tell the SoundView to draw itself.  But it's not been hooked into its window yet, so it throws out an assertion that looks something like "Lock Focus called on a view which is not in a window".  In previous versions of NeXTSTEP, this assertion just printed a message out to the console.  But in Rhapsody/OPENSTEP, this assertion throws an exception, which stops execution of the current code dead in its tracks.

The solution to this is only available for Resound's special SoundView subclass, a copy of which is obtainable from the ModuleProtocol protocol.  For this subclass, wrap in a pair of setIgnoreShowAndHideCursor:YES and setIgnoreShowAndHideCursor:YES calls all the code that hooks (or unhooks) the SoundView or one of its superviews to a new superview or to the window, and you won't triggger this bug.  For ordinary SoundViews, setIgnoreShowAndHideCursor: does nothing at all and you'll still trigger the bug if you're not careful.

Another fun bug occurs when modifying a sound that currently has data on the pasteboard; if you modify sound (shortening it for example) you run the risk of messing up what the SoundView and/or the user had thought he had pasted. The workaround for this is to call checkForCurrentDataOnPasteboard just before you begin to modify the sound. Resound will handle the rest.

Method Types

Sound Info String Access - info
- setInfo:

Data Format Conversion - convertToFormat:samplingRate:channelCount:

Rhapsody Bug Workarounds - setIgnoreShowAndHideCursor:
- checkForCurrentDataOnPasteboard:



Instance Methods

checkForCurrentDataOnPasteboard
- (void) checkForCurrentDataOnPasteboard

Tells the SoundView to check to see if it has data on the Pasteboard. If it does, it either moves the data entirely to the pasteboard or eliminates it. This method should be called before you modify a SoundView.

convertToFormat:samplingRate:channelCount:
- (int) convertToFormat:(int)newFormat
samplingRate:(double)newRate
channelCount:(int)newChannelCount

Converts the SoundView's sound to the given format, sampling rate, and channel count, but attempts to preserve the SoundView selection to still select the equivalent part of the sound.

info
- (char*) info

Returns the info string of the SoundView's sound.  See above.

setInfo:
- setInfo:(const char*)this

Sets the info string of the SoundView's sound to this.  See above.

setIgnoreShowAndHideCursor:
- (void) setIgnoreShowAndHideCursor:(BOOL)this

Tells the SoundView to ignore its showCursor: and hideCursor: method invocations.  This is an abstract method: in ordinary SoundViews, this method does nothing at all.  But Resound's special version of SoundViews, which are obtainable only from the ModuleProtocol protocol, override this method to do proper ignoring.  See the discussion above for why this method is necessary.