「mac対応しないとか今時ねーよ」みたいなことをtypesterが言うので、調べた。
C#がいいかなぁ
What is Mono?
Mono provides the necessary software to develop and run .NET client and server applications on Linux, Solaris, Mac OS X, Windows, and Unix
今年の3月にでたMono 1.9で
# System.Media implemented.
というのもGJ
試す
debian lennyならaptパッケージがある
System.Windows.Forms使うなら
libmono-winforms2.0-cil もお忘れなく。
まずはc#でhelloworld
[csharp]
santrini% cat helloworld.cs
using System;
using System.Windows.Forms;
public class HelloWorld : Form
{
static public void Main ()
{
Application.Run (new HelloWorld ());
}
public HelloWorld ()
{
Text = “Hello Mono World”;
}
}
santrini% gmcs helloworld.cs -r:System.Windows.Forms.dll
santrini% export DISPLAY=localhost:51.0; mono helloworld.exe
[/csharp]
こんな
音の再生はこんな
WindowsのVisual C# 2008 Express EditionのテンプレートからつくったWindowsフォームアプリケーション。
[csharp]santrini% cat Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace sound
{
static class Program
{
///
///
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
santrini% cat Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace sound
{
public partial class Form1 : Form
{
public Form1()
{
WavPlayer player = new WavPlayer();
//player.play(“/home/mo/tmp/csharp/sound/1.wav”);
player.play(“/home/mo/tmp/csharp/sound/1.mp3″);
}
}
}
santrini% cat WavPlayer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Media;
namespace sound
{
class WavPlayer
{
public WavPlayer()
{
}
public void play(string wavfile)
{
SoundPlayer player = new SoundPlayer(wavfile);
player.Play();
}
}
}
santrini% gmcs Program.cs Form1.cs WavPlayer.cs -r:System.Windows.Forms.dll
santrini% export DISPLAY=localhost:51.0; mono Program.exe
[/csharp]
これはありだなぁ