home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!caen!dmno
- From: dmno@math.lsa.umich.edu (Lo Shih)
- Subject: recording from DSP problems
- Message-ID: <SbV=wG=@engin.umich.edu>
- Date: Fri, 18 Dec 92 23:10:27 EST
- Organization: University of Michigan, Mathematics Department, Ann Arbor
- Sender: Lo Shih and Chris Miller, {lfo}{ff}
- Distribution: comp.sys.next.programmer
- Keywords: DSP, Sound, record, IB, AppKit
- Nntp-Posting-Host: winterpark.math.lsa.umich.edu
- Lines: 79
-
- We are building a Sound App and we're having problems recording
- from the DSP. We're using a MetaResearch Digital Ears to sample
- our sound into the Next standard Sound structure.
-
- We know that the Digital Ears works because we can issue a "sndrecord -d"
- command from the terminal with success.
-
- We're setting the data format of our Sound to SND_FORMAT_DSP_DATA_16
- when recording and changing the data format to SND_FORMAT_LINEAR_16
- when playing (which is recommended by the GeneralRef/AppKit docs).
- We know that we've filled the Sound struct with some data. We get a
- logical value for duration sampleCount and dataSize.
-
- However, when we send the sound a play message, nothing is played
- and an error code "18" is returned. We put some of our code at the
- end of this article.
-
- Please help us if you can.
- - Lo Shih
- - Chris Miller
-
-
-
-
-
-
- our code:
-
- - record:sender
- {
- /*
- * If ready, initialize the sound struct and record
- */
- if ([theSound status] == NX_SoundStopped) {
- [self setSoundSize];
-
- sndError = [theSound record];
- [self printError];
- }
-
- return self;
- }
-
- - setSoundSize
- {
- /*
- * if the NXRadio is on MIC then record from microphone
- * otherwise record from the DSP
- */
- if ([micRadio state]) {
- [theSound setDataSize:(int)9000000
- dataFormat:(int)SND_FORMAT_MULAW_8
- samplingRate:(int)SND_RATE_CODEC
- channelCount:(int)1
- infoSize:(int)4];
- }
- else {
- [theSound setDataSize:(int)9000000
- dataFormat:(int)SND_FORMAT_DSP_DATA_16
- samplingRate:(int)SND_RATE_HIGH
- channelCount:(int)2
- infoSize:(int)4];
- }
- }
-
- - play:sender
- {
- if (([theSound status] == NX_SoundStopped) ||
- ([theSound status] == NX_SoundPlayingPaused)) {
- if (![theSound isPlayable]) {
- [theSound convertToFormat:(int)SND_FORMAT_LINEAR_16];
- }
- sndError = [theSound play];
- [self printError];
- }
-
- return self;
- }
-
-