|
|
1.1 ! root 1: {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\ftech Symbol;\f3\fmodern Courier;} ! 2: \paperw12000 ! 3: \paperh9000 ! 4: \margl120 ! 5: \margr120 ! 6: {\colortbl;\red0\green0\blue0;} ! 7: \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b\i0\ulnone\fs36\fc0\cf0 SoundEditor ! 8: \b0\fs24 \ ! 9: \ ! 10: ! 11: \fs28 This programming example illustrates how easy it is to use the three SoundKit classes � Sound, SoundView, and SoundMeter. Multiple sounds can be open at the same time, with full cut, copy and paste functionality, using the mouse to select portions of the sound waveform. A control panel, consisting of a SoundMeter and Play, Stop, Pause, and Record Buttons, operates on whichever sound is in the current key window. \ ! 12: \ ! 13: The ! 14: \b SoundDocument ! 15: \b0 class manages a single window containing a ! 16: \b ScrollingSound ! 17: \b0 , which is simply a subclass of ScrollView that contains a SoundView. The ScrollingSound is contained in SoundDocument.nib, which is loaded for each new window. As with most of the NeXT programming examples, it's as instructive to explore the .nib files as to read the source code. Note that this .nib file's owner is of class SoundDocument. \ ! 18: \ ! 19: The ! 20: \b SoundController ! 21: \b0 class manages communication between the SoundDocuments and the rest of the interface (the menus and the control panel). Every time the user requests a new window with the New or Open... commands, the SoundController creates a new instance of SoundDocument. SoundDocument in its ! 22: \b init ! 23: \b0 method then loads in a new SoundDocument.nib, which displays the window with the ScrollingSound. To create the SoundMeter in the control panel, we created a custom view, dragged the icon of /usr/include/soundkit/SoundMeter.h from Workspace into IB's Classes suitcase, and used the Inspector to change the view's class.\ ! 24: \ ! 25: You can use this simple example as a basis for many useful extensions � for example, zooming, mixing, filtering, changing sound format, etc. If you're interested in a more full-function editor, there is at least one commercial product (SoundWorks ! 26: \f1 � ! 27: \f0 from Metaresearch), as well as some public-domain editors available with source code on the Internet archive servers.\ ! 28: \ ! 29: ! 30: \b\fs32\fc1\cf1 Changes for Release 3.0 ! 31: \fs36 \ ! 32: \ ! 33: ! 34: \b0\fs28\fc0\cf0 Features have been added to illustrate use of the new Audio Transform Compression (ATC) format, various new supported format conversions, and miscellaneous new API in the Sound Kit. \ ! 35: \ ! 36: A ! 37: \b SaveTo ! 38: \b0 panel has been added which supports \ ! 39: \ ! 40: (1) changing the data format on save to linear, mu-law, or ATC compressed, \ ! 41: (2) converting mono to stereo, or stereo to mono, and \ ! 42: (3) converting sampling rates among the three commonly used on NeXT computers. \ ! 43: \ ! 44: Many other format and sampling-rate conversions are now supported by the Sound object's upgraded ! 45: \b convertToFormat: ! 46: \b0 ... method (see the Sound release notes and on-line documentation for details); the cases illustrated here are only the most generally useful. Compression and decompression are carried out using the DSP, so they operate faster than real time for all standard sampling rates. Sampling-rate conversion does not use the DSP, so it is typically slower than real time.\ ! 47: \ ! 48: In the ! 49: \b SoundDocument ! 50: \b0 class, if the soundfile format cannot be displayed by SoundView, (e.g. because it is compressed), the format is converted to LINEAR_16 on input. This is detected by the SoundView object returning ! 51: \b nil ! 52: \b0 in response to its ! 53: \b setSound: ! 54: \b0 method when the sound is not displayable. (Empty sounds are defined as displayable in this context. To be undisplayable, the sound must contain data in a format not supported by SoundView.) \ ! 55: \ ! 56: The new SoundView ! 57: \b ! 58: \b0 method ! 59: \b isPlayable ! 60: \b0 is illustrated. When the play button is pressed, the current sound is send the isPlayable message. If the method returns nil, the system beep is played instead of attempting to play the sound.\ ! 61: ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.