Re: Apple DLS only audible on first few instruments
Re: Apple DLS only audible on first few instruments
- Subject: Re: Apple DLS only audible on first few instruments
- From: Daniel Jalkut <email@hidden>
- Date: Mon, 2 Jun 2003 13:08:55 -0700
Hi Chris - thanks for responding! I was really excited by your theory,
but I did some testing and I don't think that's it. Below is how I get
the instrument ID from the corresponding index. I confirmed that it
returns ids with the high bit set as I described. On Piano 1d, it
returns a high bit like you described (0x10001 or something).
- (MusicDeviceInstrumentID) instrumentIDForIndex:(short)index
{
OSStatus anyError;
UInt32 size = sizeof(MusicDeviceInstrumentID);
MusicDeviceInstrumentID instrumentID;
// Get the InstrumentID for this index
anyError = AudioUnitGetProperty([self nativeMusicDevice],
kMusicDeviceProperty_InstrumentNumber, kAudioUnitScope_Global, index,
&instrumentID, &size);
if (anyError != noErr)
{
NSLog(@"RSMusicDevice: instrumentIDForIndex failed to get instrument
at desired index.");
instrumentID = 0;
}
return instrumentID;
}
Also, if you're interested, this is my "play the note" code. I know my
objective wrappers make it a little hard to "vouch for" the validity of
some variables, but suffice to say that everything works except when I
switch the instrument ID:
- (NoteInstanceID)
startNoteWithInstrument:(RSMusicInstrument*)theInstrument
atPitch:(float)pitch withVelocity:(float)velocity
onNoteGroup:(MusicDeviceGroupID) groupID
{
NoteInstanceID returnedInstance = NULL;
MusicDeviceNoteParams3 noteParams = {2, {pitch, velocity, 0}};
ComponentResult noteErr;
noteErr = MusicDeviceStartNote([self nativeMusicDevice],
[theInstrument instrumentID], groupID, &returnedInstance, 0,
(MusicDeviceNoteParams *) ¬eParams);
if (noteErr != noErr)
{
NSLog(@"RSMusicDevice failed to start note - err %ld", noteErr);
}
return returnedInstance;
}
The only parameter I'm a little fuzzy about is the
"inOffsetSampleFrame". If that needs to be non-zero for some
instruments, it could be my problem.
Thanks again for your response!
Daniel
On Monday, June 2, 2003, at 12:37 PM, Christopher Corbell wrote:
>
On Monday, June 2, 2003, at 12:21 PM, Daniel Jalkut wrote:
>
>
> Does anybody have any suggestions as to why an Apple DLS synth hooked
>
> up to the default audio output would work GREAT with "Piano1", "Piano
>
> 1d", "Piano 2", and "Piano 3", but remain silent at Honkytonk and
>
> everything (I've tried) beyond? I am only passing instrument IDs that
>
> I received from AudioUnitGetProperty on legal indices for the device.
>
>
>
> I've traced it down to my call to MusicDeviceStartNote. Here, if I am
>
> trying to play Honkytonk, the instrument ID is 0x80003, and no sound
>
> is
>
> produced. If I change JUST the instrument ID to 0x80002 (Piano 3),
>
> then the note is played as expected.
>
[....]
>
> Thanks for any help!
>
> Daniel
>
>
This is probably an invalid ID issue. If you post a little code it
>
may be easier
>
to determine. I do not see high-byte values for non-GS ID's in my code
>
-
>
Honky Tonk is just 0x3.
>
>
GS instruments like Piano 1d have ID's with high bytes set, but they
>
look like
>
0x19999
>
0x100004
>
0x100005
>
(etc.).
>
>
Perhaps this is a simple signed/unsigned issue?
>
- Christopher
>
==============================
>
iPiano
>
Music software for Mac OS X
>
http://www.machotshot.com/iPiano
>
==============================
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.