elliott@itsgw.rpi.edu (Jim Elliott) (06/20/89)
I have just started to play with the Sound Manager because I think it has a lot of exciting potential. However, as seems to be the case with all my forays into Mac exploration so far, I no sooner start working with something than I run into snags. What I want to do is open a channel using the sampling synthesizer, and then be able to use format 2 'snd ' resources to change the sample being used, and other format 2 'snd ' resources (or just NoteCmd calls) to play lots of fun sounds. Inside Mac says that this is exactly what I should be able to do. However, things do not seem to be behaving as advertised. I initialize the channel thus: result = SndNewChannel(&chan_1, 5, 0, NULL); This returns a result code indicating success. Then, I load my sampled sound resource: synth = GetNamedResource (soundListRsrc, "\pFlute Mid"); Here is the format of that resource: (pasted from ResEdit and commented) (resource header) 00: 0002 (format 2) 02: 0000 (reference count) 04: 0001 (one sound command to follow) (sound command) 06: 8050 0000 0000000E (SoundCmd; offset points to table below) (sampled sound data table--taken from a Studio Session instrument) 0E: 00000000 (Pointer to data; follows immediately) 12: 00003694 (Number of samples in the sound, in bytes) 16: 2B780000 (Sample rate, in some strange format) 1A: 000027E6 (start of repeat loop) 1E: 000030C9 (end of repeat loop) 22: 003C (BaseNote) 24: 80807F7E7B7B8185878788878989837F82807877..... (sound samples) Okay, this resource loads in fine... Then, I try to install this instrument sound into my channel, thus: result = SndPlay(chan_1, synth, FALSE); In theory, the SoundCommand in the resource should silently cause that sampled waveform to become the instrument used by future NoteCmds using that channel. What actually happens is that this command causes the sample to be immediately played out the speaker at its base sample rate. And, in subsequent NoteCmds sent to the channel, I get no sound at all. What am I doing wrong? Also, does anyone know what format is used to define the sample rate? In IM, $56EE8BA4 means "22K samples per second". Oh. Right... And the value of $2B780000 that I use came from SoundEdit, so I imagine that it is trustable, but I still would not be able to come up with the values myself. Thanks in advance for any help you may be able to provide! ----- Jim Elliott "A more subtly incorrect theory" elliott@netserv2.its.rpi.edu
mnkonar@manyjars.SRC.Honeywell.COM (Murat N. Konar) (06/20/89)
In article <5574@rpi.edu> elliott@itsgw.rpi.edu (Jim Elliott) writes: > > >What I want to do is open a channel using the sampling synthesizer, >and then be able to use format 2 'snd ' resources to change the sample >being used, and other format 2 'snd ' resources (or just NoteCmd >calls) to play lots of fun sounds. > >Inside Mac says that this is exactly what I should be able to do. First mistake. The sound manager chapter in IM has been superceded by a replacement chapter. It should be available from sumex.aim (at least that's where I think I got my copy). The new chapter apologizes for the sorry state of the IM version and is really much clearer. ____________________________________________________________________ Have a day. :^| Murat N. Konar Honeywell Systems & Research Center, Camden, MN mnkonar@SRC.honeywell.com (internet) {umn-cs,ems,bthpyd}!srcsip!mnkonar(UUCP)