예제 #1
0
        void LoadInstrument(InstrumentInfo info)
        {
            var preset = info.Preset;

            var soundFontPath = NSBundle.MainBundle.PathForResource("ChoriumRevA", "sf2");
            var soundFontUrl  = CFUrl.FromFile(soundFontPath);

            samplerUnit.LoadInstrument(new SamplerInstrumentData(soundFontUrl, InstrumentType.SF2Preset)
            {
                BankLSB  = SamplerInstrumentData.DefaultBankLSB,
                BankMSB  = info.BankMSB,
                PresetID = (byte)preset,
            });
        }
예제 #2
0
        public Instrument(InstrumentInfo info, int channel, AUGraph graph, int ioNode)
        {
            Info = info;

            var samplerNode = graph.AddNode(AudioComponentDescription.CreateMusicDevice(AudioTypeMusicDevice.Sampler));

            graph.ConnnectNodeInput(samplerNode, 0, ioNode, (uint)channel);

            samplerUnit = graph.GetNodeInfo(samplerNode);
            samplerUnit.SetMaximumFramesPerSlice(4096, AudioUnitScopeType.Global, 0);

            this.channel = channel;

            LoadInstrument(info);
        }