Skip to content

Instantly share code, notes, and snippets.

@furushei
Created December 10, 2017 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furushei/3851be75d1b7a4efcd2d87370a8ec39f to your computer and use it in GitHub Desktop.
Save furushei/3851be75d1b7a4efcd2d87370a8ec39f to your computer and use it in GitHub Desktop.
import System;
import System.IO;
import System.Media;
import Microsoft.JScript;
var args = Environment.GetCommandLineArgs();
if (args.length < 2) {
Console.WriteLine("ファイル名は必須です");
Environment.Exit(1);
}
var fileName = args[1];
var player = new System.Media.SoundPlayer();
player.SoundLocation = fileName;
try {
player.Load();
player.PlaySync();
} catch (e) {
var ex = Throw.JScriptThrow(e);
Console.WriteLine(ex);
Environment.Exit(1);
}
@furushei
Copy link
Author

furushei commented Dec 10, 2017

概要

WindowsでWAVEファイルを再生するコマンド。

使い方

> wplay ファイル名

ビルド

次のコマンドでコンパイルするとwplay.exeが生成される。ただしx.xxxxxはバージョンによって変わる。
> C:\Windows\Microsoft.NET\Framework\v4.x.xxxxx\jsc.exe wplay.js

コンパイルに用いるjsc.exeはWindowsに標準で含まれていると思われる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment