Add MidiTest sample
Creating branch until required API fixes are published
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<SampleMetadata>
|
||||
<ID>70773a1c-14fd-41f2-aa48-98e7a114a078</ID>
|
||||
<IsFullApplication>false</IsFullApplication>
|
||||
<Level>Intermediate</Level>
|
||||
<Tags>Media</Tags>
|
||||
<Gallery>false</Gallery>
|
||||
</SampleMetadata>
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MidiTest", "MidiTest\MidiTest.csproj", "{D4E56645-1607-4A77-9BA6-6A2671360482}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
Release|iPhone = Release|iPhone
|
||||
Ad-Hoc|iPhone = Ad-Hoc|iPhone
|
||||
AppStore|iPhone = AppStore|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.AppStore|iPhone.Build.0 = AppStore|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{D4E56645-1607-4A77-9BA6-6A2671360482}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = MidiTest\MidiTest.csproj
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.UIKit;
|
||||
|
||||
namespace MidiTest
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register ("AppDelegate")]
|
||||
public partial class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
public override UIWindow Window {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
var audiotest = new AudioTest ();
|
||||
audiotest.MidiTest ();
|
||||
return true;
|
||||
}
|
||||
// This method is invoked when the application is about to move from active to inactive state.
|
||||
// OpenGL applications should use this method to pause.
|
||||
public override void OnResignActivation (UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method should be used to release shared resources and it should store the application state.
|
||||
// If your application supports background exection this method is called instead of WillTerminate
|
||||
// when the user quits.
|
||||
public override void DidEnterBackground (UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method is called as part of the transiton from background to active state.
|
||||
public override void WillEnterForeground (UIApplication application)
|
||||
{
|
||||
}
|
||||
// This method is called when the application is about to terminate. Save data, if needed.
|
||||
public override void WillTerminate (UIApplication application)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
using System;
|
||||
using MonoTouch.AudioUnit;
|
||||
using MonoTouch.CoreMidi;
|
||||
using MonoTouch.AudioToolbox;
|
||||
using MonoTouch.Foundation;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using MonoTouch.CoreFoundation;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MidiTest
|
||||
{
|
||||
public class AudioTest
|
||||
{
|
||||
AUGraph processingGraph;
|
||||
AudioUnit samplerUnit;
|
||||
AudioUnit ioUnit;
|
||||
|
||||
MidiClient virtualMidi;
|
||||
MidiEndpoint virtualEndpoint;
|
||||
|
||||
public AudioTest ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool createAUGraph ()
|
||||
{
|
||||
int samplerNode, ioNode;
|
||||
|
||||
var cd = new AudioComponentDescription () {
|
||||
ComponentManufacturer = AudioComponentManufacturerType.Apple
|
||||
};
|
||||
|
||||
processingGraph = new AUGraph ();
|
||||
|
||||
cd.ComponentType = AudioComponentType.MusicDevice;
|
||||
cd.ComponentSubType = (int)AudioTypeMusicDevice.Sampler;
|
||||
|
||||
samplerNode = processingGraph.AddNode (cd);
|
||||
|
||||
cd.ComponentType = AudioComponentType.Output;
|
||||
cd.ComponentSubType = (int)AudioTypeOutput.Remote;
|
||||
|
||||
ioNode = processingGraph.AddNode (cd);
|
||||
|
||||
processingGraph.Open ();
|
||||
|
||||
processingGraph.ConnnectNodeInput (samplerNode, 0, ioNode, 0);
|
||||
|
||||
samplerUnit = processingGraph.GetNodeInfo (samplerNode);
|
||||
|
||||
ioUnit = processingGraph.GetNodeInfo (ioNode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void configureAndStartAudioProcessingGraph (AUGraph graph)
|
||||
{
|
||||
if (graph == null)
|
||||
return;
|
||||
|
||||
var error = graph.Initialize ();
|
||||
if (error != AUGraphError.OK)
|
||||
throw new Exception ("Unable to initialize AUGraph object. Error code: " + error);
|
||||
|
||||
error = graph.Start ();
|
||||
if (error != AUGraphError.OK)
|
||||
throw new Exception ("Unable to start audio processing graph. Error code: " + error);
|
||||
}
|
||||
|
||||
void MIDIMessageReceived (object sender, MidiPacketsEventArgs e)
|
||||
{
|
||||
var packets = e.Packets;
|
||||
|
||||
for (int i = 0; i < packets.Length; i++) {
|
||||
var packet = packets [i];
|
||||
byte[] data = new byte[packet.Length];
|
||||
Marshal.Copy (packet.Bytes, data, 0, packet.Length);
|
||||
var midiStatus = data [0];
|
||||
var midiCommand = midiStatus >> 4;
|
||||
|
||||
if (midiCommand == 0x09) {
|
||||
var note = data [1] & 0x7F;
|
||||
var velocity = data [2] & 0x7F;
|
||||
|
||||
int noteNumber = ((int)note) % 12;
|
||||
string noteType;
|
||||
switch (noteNumber) {
|
||||
case 0:
|
||||
noteType = "C";
|
||||
break;
|
||||
case 1:
|
||||
noteType = "C#";
|
||||
break;
|
||||
case 2:
|
||||
noteType = "D";
|
||||
break;
|
||||
case 3:
|
||||
noteType = "D#";
|
||||
break;
|
||||
case 4:
|
||||
noteType = "E";
|
||||
break;
|
||||
case 5:
|
||||
noteType = "F";
|
||||
break;
|
||||
case 6:
|
||||
noteType = "F#";
|
||||
break;
|
||||
case 7:
|
||||
noteType = "G";
|
||||
break;
|
||||
case 8:
|
||||
noteType = "G#";
|
||||
break;
|
||||
case 9:
|
||||
noteType = "A";
|
||||
break;
|
||||
case 10:
|
||||
noteType = "Bb";
|
||||
break;
|
||||
case 11:
|
||||
noteType = "B";
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
Console.WriteLine ("{0}: {1}", noteType, noteNumber);
|
||||
|
||||
samplerUnit.MusicDeviceMIDIEvent ((uint)midiStatus, (uint)note, (uint)velocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AudioUnitStatus loadFromDLSOrSoundFont (CFUrl bankUrl, int presetNumber)
|
||||
{
|
||||
var instrumentData = new SamplerInstrumentData (bankUrl, InstrumentType.SF2Preset) {
|
||||
PresetID = (byte)presetNumber,
|
||||
BankMSB = SamplerInstrumentData.DefaultMelodicBankMSB,
|
||||
BankLSB = SamplerInstrumentData.DefaultBankLSB
|
||||
};
|
||||
|
||||
var result = samplerUnit.LoadInstrument (instrumentData, AudioUnitScopeType.Global, 0);
|
||||
if (result != AudioUnitStatus.NoError)
|
||||
Console.WriteLine (result.ToString ());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void MidiTest ()
|
||||
{
|
||||
createAUGraph ();
|
||||
configureAndStartAudioProcessingGraph (processingGraph);
|
||||
|
||||
virtualMidi = new MidiClient ("VirtualClient");
|
||||
virtualMidi.IOError += (object sender, IOErrorEventArgs e) => {
|
||||
Console.WriteLine ("IO Error, messageId={0}", e.ErrorCode);
|
||||
};
|
||||
|
||||
virtualMidi.PropertyChanged += (object sender, ObjectPropertyChangedEventArgs e) => {
|
||||
Console.WriteLine ("Property changed: " + e.MidiObject + ", " + e.PropertyName);
|
||||
};
|
||||
|
||||
MidiError error;
|
||||
virtualEndpoint = virtualMidi.CreateVirtualDestination ("Virtual Destination", out error);
|
||||
|
||||
if (error != MidiError.Ok)
|
||||
throw new Exception ("Error creating virtual destination: " + error);
|
||||
virtualEndpoint.MessageReceived += MIDIMessageReceived;
|
||||
|
||||
var sequence = new MusicSequence ();
|
||||
|
||||
var midiFilePath = NSBundle.MainBundle.PathForResource ("simpletest", "mid");
|
||||
var midiFileurl = NSUrl.FromFilename (midiFilePath);
|
||||
|
||||
sequence.LoadFile (midiFileurl, MusicSequenceFileTypeID.Midi);
|
||||
|
||||
var player = new MusicPlayer ();
|
||||
|
||||
sequence.SetMidiEndpoint (virtualEndpoint);
|
||||
|
||||
var presetUrl = CFUrl.FromFile (NSBundle.MainBundle.PathForResource ("Gorts_Filters", "SF2"));
|
||||
|
||||
loadFromDLSOrSoundFont (presetUrl, 10);
|
||||
|
||||
player.MusicSequence = sequence;
|
||||
player.Preroll ();
|
||||
player.Start ();
|
||||
|
||||
MusicTrack track;
|
||||
track = sequence.GetTrack (1);
|
||||
var length = track.TrackLength;
|
||||
|
||||
while (true) {
|
||||
Thread.Sleep (TimeSpan.FromSeconds (3));
|
||||
double now = player.Time;
|
||||
if (now > length)
|
||||
break;
|
||||
}
|
||||
|
||||
player.Stop ();
|
||||
sequence.Dispose ();
|
||||
player.Dispose ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>MidiTest</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.your-company.MidiTest</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>MainStoryboard_iPhone</string>
|
||||
<key>UIMainStoryboardFile~ipad</key>
|
||||
<string>MainStoryboard_iPad</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.UIKit;
|
||||
|
||||
namespace MidiTest
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main (string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "AppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main (args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--class Prefix:identifier View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="MidiTestViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="20" width="768" height="1004" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackOpaque" />
|
||||
<simulatedOrientationMetrics key="orientation" />
|
||||
<simulatedScreenMetrics key="destination" />
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--class Prefix:identifier View Controller-->
|
||||
<scene sceneID="ufC-wZ-h7g">
|
||||
<objects>
|
||||
<viewController id="vXZ-lx-hvc" customClass="MidiTestViewController" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="568" />
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar" />
|
||||
<simulatedOrientationMetrics key="orientation" />
|
||||
<simulatedScreenMetrics key="destination" type="retina4" />
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D4E56645-1607-4A77-9BA6-6A2671360482}</ProjectGuid>
|
||||
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MidiTest</RootNamespace>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
<AssemblyName>MidiTest</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<BuildIpa>true</BuildIpa>
|
||||
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\AppStore</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__IOS__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<CodesignProvision>Automatic:AppStore</CodesignProvision>
|
||||
<CodesignKey>iPhone Distribution</CodesignKey>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="monotouch" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\Default-568h%402x.png" />
|
||||
<BundleResource Include="Resources\simpletest.mid" />
|
||||
<BundleResource Include="Resources\Gorts_Filters.sf2" />
|
||||
<BundleResource Include="Resources\Icon%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-60%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-72.png" />
|
||||
<BundleResource Include="Resources\Icon-72%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-76.png" />
|
||||
<BundleResource Include="Resources\Icon-76%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-Small-40%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-Small-40.png" />
|
||||
<BundleResource Include="Resources\Icon-Small-50%402x.png" />
|
||||
<BundleResource Include="Resources\Icon-Small-50.png" />
|
||||
<BundleResource Include="Resources\Icon-Small%402x.png" />
|
||||
<BundleResource Include="Resources\Default%402x.png" />
|
||||
<BundleResource Include="Resources\Default-Portrait.png" />
|
||||
<BundleResource Include="Resources\Default-Landscape.png" />
|
||||
<BundleResource Include="Resources\Default-Portrait%402x.png" />
|
||||
<BundleResource Include="Resources\Default-Landscape%402x.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="MidiTestViewController.cs" />
|
||||
<Compile Include="MidiTestViewController.designer.cs">
|
||||
<DependentUpon>MidiTestViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="AudioTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="MainStoryboard_iPhone.storyboard" />
|
||||
<InterfaceDefinition Include="MainStoryboard_iPad.storyboard" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.UIKit;
|
||||
|
||||
namespace MidiTest
|
||||
{
|
||||
public partial class MidiTestViewController : UIViewController
|
||||
{
|
||||
static bool UserInterfaceIdiomIsPhone {
|
||||
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
|
||||
}
|
||||
|
||||
public MidiTestViewController (IntPtr handle) : base (handle)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DidReceiveMemoryWarning ()
|
||||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
base.DidReceiveMemoryWarning ();
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
#region View lifecycle
|
||||
|
||||
public override void ViewDidLoad ()
|
||||
{
|
||||
base.ViewDidLoad ();
|
||||
|
||||
// Perform any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
public override void ViewWillAppear (bool animated)
|
||||
{
|
||||
base.ViewWillAppear (animated);
|
||||
}
|
||||
|
||||
public override void ViewDidAppear (bool animated)
|
||||
{
|
||||
base.ViewDidAppear (animated);
|
||||
}
|
||||
|
||||
public override void ViewWillDisappear (bool animated)
|
||||
{
|
||||
base.ViewWillDisappear (animated);
|
||||
}
|
||||
|
||||
public override void ViewDidDisappear (bool animated)
|
||||
{
|
||||
base.ViewDidDisappear (animated);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// This file has been generated automatically by MonoDevelop to store outlets and
|
||||
// actions made in the Xcode designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using MonoTouch.Foundation;
|
||||
|
||||
namespace MidiTest
|
||||
{
|
||||
[Register ("MidiTestViewController")]
|
||||
partial class MidiTestViewController
|
||||
{
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 8.7 KiB |
После Ширина: | Высота: | Размер: 10 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 10 KiB |
После Ширина: | Высота: | Размер: 30 KiB |
После Ширина: | Высота: | Размер: 8.2 KiB |
После Ширина: | Высота: | Размер: 1.7 KiB |
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 2.0 KiB |
После Ширина: | Высота: | Размер: 1.2 KiB |
После Ширина: | Высота: | Размер: 2.2 KiB |
После Ширина: | Высота: | Размер: 729 B |
После Ширина: | Высота: | Размер: 1.2 KiB |
После Ширина: | Высота: | Размер: 860 B |
После Ширина: | Высота: | Размер: 1.5 KiB |
После Ширина: | Высота: | Размер: 955 B |
После Ширина: | Высота: | Размер: 1.6 KiB |
|
@ -0,0 +1,11 @@
|
|||
Midi Test
|
||||
===============
|
||||
|
||||
This sample illustrates how to use CoreAudio to load and play a MIDI sequence from a file, and uses an AUGraph to play the notes with an instrument effect. A Virtual Endpoint is also created to interecept and display the MIDI messages as it runs. The sample is a port the 'MIDI Driven Animation using CoreMIDI in Objective C' [sample code](http://www.deluge.co/?q=midi-driven-animation-core-audio-objective-c) by Ben Smiley.
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
Original by Ben Smiley - http://www.deluge.co/?q=midi-driven-animation-core-audio-objective-c
|
||||
|
||||
Ported by Timothy Risi
|