Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!elroy!dhw68k!bytebug From: bytebug@dhw68k.cts.com (Roger L. Long) Newsgroups: comp.sys.mac.programmer Subject: playing snd 2 resources Message-ID: <11092@dhw68k.cts.com> Date: 1 Sep 88 04:42:42 GMT Reply-To: bytebug@dhw68k.cts.com (Roger L. Long) Organization: Wolfskill residence; Anaheim, CA (USA) Lines: 62 I've been through the IM-V chapter on the Sound Manager with a fine-toothed comb, and my supposedly simple quest to have my Mac II play a sound that's been digitized and is in a 'snd ' type 2 resource has me stumped. Here's some code (Think-C) that doesn't work: #include "SoundMgr.h" #define nil 0L main() { Handle effect; SndChannelPtr channel; SndCommand sound; effect = GetResource('snd ', 10000); if (effect == nil) panic("can't GetResource"); HLock(effect); channel = nil; if (SndNewChannel(&channel, 5, initSRate22k, nil) != noErr) panic("can't SndNewChannel"); if (SndPlay(channel, effect, TRUE) != noErr) panic("can't SndPlay"); sound.cmd = noteCmd; sound.param1 = 1000; sound.param2 = 0xFF000037; if (SndDoCommand(channel, &sound, TRUE) != noErr) panic("can't SndDoCommand"); if (SndDisposeChannel(channel, FALSE) != noErr) panic("can't SndDisposeChannel"); HUnlock(effect); ReleaseResource(effect); } Now, my interpretation of IM-V is that I have the sound digitized in a snd-2 resource, and that I load it with SndPlay and then I play a note to get it to come out at whatever frequency and duration. However, it never gets that far. I always get a "can't SndPlay" output, with the error code of "badFormat" returned. I've single-stepped through the SndPlay trap, and what it "looks" like happens is that SndPlay looks at the 'snd' resource type and won't play anything but snd-1 resources. So, what's the story? How do I play a digitized sound, if I'm not supposed to use SndPlay? I have a bunch of other Sound Manager questions that I'll defer for the moment. If anyone would like to volunteer as a Sound Manager expert, I'd appreciate the help. If anyone can send me some code that works with the Sound Manager, I'd appreciate looking at that as well. At this point I'm frustrated enough by all of the things that I *have* tried that I'll appreciate *anything*. Thanks. -- Roger L. Long dhw68k!bytebug