narod.ru/disk/9788383000/q.exe.html
(これはウイルスではありません。カルマに誓い、個人的に編集しました)
VistaとWindows 7で動作しないことをすぐに予約します。なぜ-わからない=(システムプログラミングで完全な無知を使用しないので、誰かが理由を教えてくれれば-感謝します。Wineの* nixでは動作するはずです。
ストーリーを始める前に、これらのhabratopicsを更新することをお勧めします
ミュージック 内部のコード。 カミソリ1911、ファルブラウシュ...
デモ。 プログラミングの芸術。
どういうわけか、私はあらゆる種類のトラッカーの曲に夢中になりました。
私は大学で(TFKPの)講師をしていて、音楽と数学の関係についての講義で哲学を学びたいと思っていました。それは非常に興味深いことです。 そして、私の意見では、トラッカー音楽はまさに数学に最も近い音楽です。
知らない人のために、これはクラック/キージェンス、多くのコンピューターゲーム、デモシーンで聞こえる音楽だと言います...実際、トラッカーの音楽は非常に重く、たとえばミディの曲が携帯電話にしっかりと根付いている理由を心から理解していませんしかし、それははるかに良く聞こえます。 トラッカーMouzonには多くの形式があります:.mod、.it、.xm、.s3m、...など。 彼らの主な特徴は、非常に小さな「重み」(サンプルのビットサイズに依存しますが、メガバイトになる可能性がありますが、数十から数百キロバイト)でありながら、美しい(ミディ・ムゾンと比較して、私見では、ちょうど美しい)サウンドです。 より詳細な情報は、インターネットの広大な範囲で簡単に見つけることができます。
気を散らして、他の「最も」追跡された楽曲へのリンクを提供します : http : //websound.ru/tracked-music.htm (そして、一般的に音楽websound.ruについてこのサイトをあらゆる方法でお勧めします)。 Winampを介してではなく、 XMPlayを介して(私の経験では)モジュールの最も適切な複製を介してそれらを聴くよう説得力を持って説得します。
Farbrauschのメンバー( kbで表される)はさらに進んで、独自の音楽エンジンv2を作成しました。 その中で作られた音楽は、このデモメーカー集団の素晴らしいデモで聞こえます。 実際、自然界にはあまり多くのv2m音楽はないのではないかと思います(それが間違っていれば-間違いなく嬉しい驚きと感謝の意)、しかしここでダウンロードできるのは(たとえば、サイズが1 Mbの驚くほど美しいメロディー約200) ここから winampのin_v2m.dllプラグインを再生することをお勧めします (著者のサイトで入手可能なプラグインの新しいバージョン1.5は、v2mの一致を誤って失ったようです)。 この形式と従来のトラッカーチューンの違いは、サンプルをまったく使用せず、音声合成を含むすべての楽器とエフェクトがエンジンによってプログラムで生成されることです。
さて、私は少し「素晴らしい」ものに参加し、音楽で実行可能ファイルをコンパイルしてみました。まず、これらの天才デモシーナーがこのような小さなサイズのデモを達成する方法を見つけ、次に、お気に入りのv2mの曲をあなたと共有したいです。
API( ここから )を基礎として使用する例として、tinyplayer.cppファイルを取り上げました。 これは、次のようなコードで直接コンパイルされた1つの音楽を再生するためのソースでした。
const unsigned char theTune[] = {
0xe0, 0x01, 0x00, 0x00, 0xd7, 0x84, 0x02, ...
.hファイルに含まれています。 同様の.hファイルを作成する必要がありましたが、必要な構成を使用しました。
必要なv2m-kiをフォルダーにコピーし、内容を含むスクリプトgen_tunes.pyを作成しました。
import glob
out = open( 'tune1.h' , 'w' )
listOut = open( 'list.txt' , 'w' )
def writeTune(i, data):
out .write( '\nconst unsigned char tune_%s[] = {\n\t' % i)
t = 0
lst = []
for b in data:
lst.append(hex(ord(b)))
t+=1
if t % 16 == 0:
lst[-1] += '\n\t'
out .write( ', ' .join(lst))
out .write( '};\n\n' )
def main():
i = 0
for fn in glob.glob( '*.v2m' ):
f = open(fn, 'rb' )
data = f.read()
writeTune(i, data)
listOut.write( "%s, %s\n" % (i, fn))
i += 1
main()
* This source code was highlighted with Source Code Highlighter .
実行すると、tune1.hファイルの重量が7.84 MBになり、.v2mファイルの合計重量は1.46 MBになりました。
そして、私が言ったように、tinyplayer.cppは次のように拡張されました。
//
// tinyplayer: An example for using libv2 and a lesson in getting
// Win32 executables small. Written by Tammo "kb"
// Hinrichs in 2004. This file (as well as the .sln
// and the .vcproj file) is in the public domain,
// do with it what you want.
//
// farbrausch consumer consulting, Dec. 2004
//
// it is advised to look into the compiler settings to see why the
// final exe takes only 52k (or 12.5k after being packed with an
// executable packer)
// we need: windows...
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// ... the libv2 ...
#include "libv2.h"
// ... and our tune.
//#include "tune.h"
#include "tune1.h"
// --------------------------------------------------------------------------------
// a few fakes coming up because this gets compiled without any stdlib and so
// we don't even have printf() :
static HANDLE stdout;
static void print( const char *text)
{
unsigned long bw;
int len=0;
while (text[len]) len++; // yeah, strlen() also is a luxury. :)
WriteFile(stdout,text,len,&bw,0);
}
static const char * digits[]={ "0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" };
static void print( long num) {
int nums[20];
int n = 0;
if (num == 0) {
print( "0" );
}
while (num != 0) {
nums[n++] = num % 10;
num = num / 10;
};
n--;
for ( int nn=n;nn>=0;nn--) {
print(digits[nums[nn]]);
}
}
// VC needs this symbol as soon as something uses floating point numbers
// (and libv2 does):
extern "C" int _fltused;
int _fltused;
// --------------------------------------------------------------------------------
const char * songs[] = {
"acid in space" ,
"agony remix" ,
"breeze" ,
"chiptown" ,
"cracked zone" ,
"fr-014 garbage collection - main" ,
"fr-037 the code inside" ,
"full access" ,
"gamma projection" ,
"josie3" ,
"multiscenist" ,
"trance style" ,
"ultra short" ,
"welcome to vectronix disco" ,
"zuibath"
};
long songDurations[] = { // in sec
233,
296,
181,
157,
267,
128,
211,
225,
152,
207,
177,
465,
186,
208,
170
};
const unsigned char * songData[] = {
tune_0,tune_1,tune_2,tune_3,tune_4,tune_5,tune_6,tune_7,
tune_8,tune_9,tune_10,tune_11,tune_12,tune_13,tune_14
};
static void writeSongLine( int current) {
print(current+1);print( " - " );print(songs[current]);print( " (" );
long duration = songDurations[current];
print(duration/60); // min
print( ":" );
long sec = duration%60;
if (sec<10)
print( "0" );
print(sec);
print( ")" );
}
static void playSong( int current) {
print( "\r \r" );
writeSongLine(current);
ssStop();
ssClose();
ssInit(songData[current],GetForegroundWindow());
ssPlay();
}
int SONG_NUM_MAX = 14;
int main( int argc, char *argv[])
{
// we need this for print() to work
stdout=GetStdHandle(STD_OUTPUT_HANDLE);
// print a bunch of senseless info..
print( "Farbrausch Tiny Music Player v0.2\n" );
print( "Code and Synthesizer (C) 2000-2004 kb/Farbrausch\n" );
print( "Compiled by: Xonix\n\n" );
print( "Tunes:\n\n" );
for ( int i=0; i<=SONG_NUM_MAX; i++) {
writeSongLine(i);
print( "\n" );
}
print( "\n\n" );
int current = 0;
print( "Now playing (ESC to quit, UP/DOWN to select):\n" );
playSong(current);
for ( ; ; ) {
if ( GetAsyncKeyState ( VK_ESCAPE ) != 0 )
break ;
else if ( GetAsyncKeyState ( VK_UP ) != 0 ) {
if (current > 0)
current--;
else
current = SONG_NUM_MAX;
playSong(current);
while (GetAsyncKeyState ( VK_UP ) != 0) {Sleep(10);}
}
else if ( GetAsyncKeyState ( VK_DOWN ) != 0 ) {
if (current < SONG_NUM_MAX)
current++;
else
current = 0;
playSong(current);
while (GetAsyncKeyState ( VK_DOWN ) != 0) {Sleep(10);}
}
if (ssGetTime() > (songDurations[current] + 1) * 1000) { // song ended
if (current < SONG_NUM_MAX)
current++;
else
current = 0;
playSong(current);
}
Sleep ( 10 );
}
// stop and deinit the player
ssStop();
ssClose();
// ... and we're done.
ExitProcess(0);
}
* This source code was highlighted with Source Code Highlighter .
プログラムがwindows.h(実際にはlibv2.hとtune1.hに加えて)のみを使用し、それ以上(結果の.exeのコンパクトさのために、印刷を記述し、自分でフォーマットすることを余儀なくされている)ことに注意してください。
奇妙なことに、Visual Studioでマスターできなかったため、コンパイルにQtCreator + Mingwを使用しました(すべてが明示的である場合、つまり、コンパイル時に何が始まるかなどがわかります)。
ここで、「-」ボタンに到達した仲間の注意を引きます。これはおそらく、私が意識的にコンパイルした最初のC ++コードであることを示しています=)
プロジェクトは次のようになりました。
# -------------------------------------------------
# Project created by QtCreator 2009-06-10T03:58:51
# -------------------------------------------------
QT -= core \
gui
TARGET = v2m_palyer_qt
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
HEADERS += tune.h tune1.h \
libv2.h
OTHER_FILES +=
LIBS += -L"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib" \
-L"D:/TEST/v2m/libv2_1.0/v2m_palyer_qt" -llibv2 -ldsound -luser32 -lkernel32
コンパイルの結果、ファイルv2m_palyer_qt.exeを取得します。 しかし、それだけではありません)。 次に、このファイルを「圧縮」する必要があります。 これを行うために、--best設定でそのようなタスクに通常の実行可能ファイル圧縮upxを使用し、実行可能ファイルを1.48 MBから72 KBに盗みました。
私もberoexepackerを試してみました-それは良いですが、最初のオプションで停止しました。 ウイルス対策プログラムはupxを知っており、ウイルスを検索してそれを解凍できますが、その後はできません。
そして最後に、私はkrrunchyの「スクイーザー」を試しました-それを使用したのはFarbrauschの男で、実際に彼はそれを実際に64,000バイトにしたのですが、exe-shnikはかなり長い間開始しました。
欠点の中でも、エグゼキュータはグローバルフックを使用してスクロール/終了します。 それ以外の方法-私は知りませんが、kbの著者はこれについてコメントを残しました
// yep, I know this will stop even if we don't have focus. I simply don't care.
私も気にしませんでした。
ご清聴ありがとうございました。