Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!chalmers!mathrt0.math.chalmers.se!news From: d6maca@dtek.chalmers.se (Martin Carlberg) Newsgroups: comp.sys.mac.programmer Subject: Sound Manager doesn't sound? Message-ID: <1990Jul26.224121.8385@mathrt0.math.chalmers.se> Date: 26 Jul 90 22:41:21 GMT Sender: news@mathrt0.math.chalmers.se (Evald Nyhetsson) Organization: Chalmers University of Technology, Gothenburg, Sweden. Lines: 51 I want to generate sounds consisting of two simultaneous tones of different frequencies (the sounds generated by a touchtone telephone). Reading Inside Macintosh about the Sound Manager I find out that I would probably get the desired effect by using the wave table synthesizer, which can deliver up to four simultaneous tones. There is a Sound Manager command called freqCmd where IM says: "If no sound is playing, it causes the synthesizer to begin playing at the specified frequency for an indefinite duration." and "A frequency value is sent in the lower three bytes of param2, where the frequency desired is multiplied by 256." This is fine for me, I create two channels using the wave table synth, makes a sine wave table, and send one freqCmd to each channel, and sound doesn't stream out of my speaker. It's very quiet (well, there is a fan and a hard disk in my Mac). This is a piece of Pascal code that does not produce sound: PROGRAM Frequency; USES Sound; VAR channel: SndChannelPtr; firstCmd, secondCmd: SndCommand; FUNCTION SineWave: Ptr; EXTERNAL; { Makes nice waves } PROCEDURE BombOnError (result: OSErr); EXTERNAL; { Tests for error } BEGIN channel := NIL; BombOnError (SndNewChannel (channel, waveTableSynth, 0, NIL)); firstCmd.cmd := waveTableCmd; firstCmd.param1 := 512; firstCmd.param2 := LONGINT (SineWave); BombOnError (SndDoCommand (channel, firstCmd, TRUE)); { The following should start a continious sound } secondCmd.cmd := freqCmd; secondCmd.param1 := 0; secondCmd.param2 := 440 * 256; BombOnError (SndDoCommand (channel, secondCmd, TRUE)); WHILE (TRUE) DO; { Sound forever... } BombOnError (SndDisposeChannel (channel, TRUE)); END. It could use the old faithful Sound Driver, but I don't like to use something that has got a replacement. Anyone has a clue? Thanks in advance, - Martin Carlberg (d6maca@dtek.chalmers.se) - Chalmers University of Technology, Goteborg, Sweden