receiver = ((ReferenceCountingDevice) device).getReceiverReferenceCounting();
} else {
receiver = device.getReceiver();
}
if (!(receiver instanceof MidiDeviceReceiver)) {
receiver = new MidiDeviceReceiverEnvelope(device, receiver);
}
return receiver;
}