DLS program change bug?
DLS program change bug?
- Subject: DLS program change bug?
- From: Andrew Sorensen <email@hidden>
- Date: Sun, 2 Oct 2005 18:08:22 +1000
Hi,
If I create multiple independant DLS AU's I would expect that sending
a program change to channel 0 of each DLS AU would be independent.
It appears that the first DLS AU created is independent and works as
expected but then all subsequent DLS AU's share the same program-
change values. I've attached a contrived example so you can all tell
me where I've made my fatal mistake :)
The first three notes (played on a single DLS using separate
channels) play as expected - Violin, Glock then Sitar. The second
three notes (each played on a separate DLS all using channel 0) play
Violin, Sitar, Sitar (i.e. no Glock). Adding more DLS AUs continues
this trend.
Cheers,
Andrew.
#include <iostream>
#include <AudioToolbox/AudioToolbox.h>
#include "CAComponent.h"
int main (int argc, char * const argv[]) {
AUGraph graph;
AUNode outputNode, mixerNode, dlsNodeA, dlsNodeB, dlsNodeC;
AudioUnit dlsA, dlsB, dlsC;
//Setup Graph
NewAUGraph(&graph);
CAComponent output('auou','ahal','appl');
AUGraphNewNode(graph,&(output.Desc()),0,NULL,&outputNode);
AUGraphOpen(graph);
AUGraphInitialize(graph);
AUGraphStart(graph);
//New NODES
CAComponent dls('aumu','dls ','appl');
AUGraphNewNode(graph,&(dls.Desc()),0,NULL,&dlsNodeA);
AUGraphGetNodeInfo(graph,dlsNodeA,NULL,NULL,NULL,&dlsA);
AUGraphNewNode(graph,&(dls.Desc()),0,NULL,&dlsNodeB);
AUGraphGetNodeInfo(graph,dlsNodeB,NULL,NULL,NULL,&dlsB);
AUGraphNewNode(graph,&(dls.Desc()),0,NULL,&dlsNodeC);
AUGraphGetNodeInfo(graph,dlsNodeC,NULL,NULL,NULL,&dlsC);
CAComponent mixer('aumx','smxr','appl');
AUGraphNewNode(graph,&(mixer.Desc()),0,NULL,&mixerNode);
//Connect NODES
AUGraphConnectNodeInput(graph,mixerNode,0,outputNode,0);
AUGraphConnectNodeInput(graph,dlsNodeA,0,mixerNode,0);
AUGraphConnectNodeInput(graph,dlsNodeB,0,mixerNode,1);
AUGraphConnectNodeInput(graph,dlsNodeC,0,mixerNode,2);
//Update Graph
AUGraphUpdate(graph,NULL);
//send program changes and notes
//only to DLS A using 3 different channels
MusicDeviceMIDIEvent(dlsA, 0xC0, 40, 0, 0);
MusicDeviceMIDIEvent(dlsA, 0xC1, 9, 0, 0);
MusicDeviceMIDIEvent(dlsA, 0xC2, 104, 0, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x90, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x80, 60, 0, 0);
MusicDeviceMIDIEvent(dlsA, 0x91, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x81, 60, 0, 0);
MusicDeviceMIDIEvent(dlsA, 0x92, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x82, 60, 0, 0);
//send program changes and notes
//to each DLS on channel 0
MusicDeviceMIDIEvent(dlsA, 0xC0, 40, 0, 0);
MusicDeviceMIDIEvent(dlsB, 0xC0, 9, 0, 0);
MusicDeviceMIDIEvent(dlsC, 0xC0, 104, 0, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x90, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsA, 0x80, 60, 0, 0);
MusicDeviceMIDIEvent(dlsB, 0x90, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsB, 0x80, 60, 0, 0);
MusicDeviceMIDIEvent(dlsC, 0x90, 60, 80, 0);
sleep(1);
MusicDeviceMIDIEvent(dlsC, 0x80, 60, 0, 0);
return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden