Initial Commit
This commit is contained in:
479
seal-hack/examples/check.c
Normal file
479
seal-hack/examples/check.c
Normal file
@@ -0,0 +1,479 @@
|
||||
/* check.c - misc. routines from the reference guide */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifndef linux
|
||||
#include <conio.h>
|
||||
#endif
|
||||
#include <audio.h>
|
||||
|
||||
|
||||
/* enable filtering */
|
||||
#define FILTER
|
||||
|
||||
|
||||
/* soy paranoico! */
|
||||
#define Assert(x) AssertFailed((x),#x,__LINE__,__FILE__)
|
||||
|
||||
void AssertFailed(UINT rc, LPSTR lpszExpr, int nLine, LPSTR lpszFileName)
|
||||
{
|
||||
CHAR szText[128];
|
||||
|
||||
if (rc != AUDIO_ERROR_NONE) {
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
fprintf(stderr, "ASSERT(%s:%d): %s\nERROR: %s\n",
|
||||
lpszFileName, nLine, lpszExpr, szText);
|
||||
ACloseAudio();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* APingAudio, AGetAudioDevCaps */
|
||||
VOID DetectAudioDevice(VOID)
|
||||
{
|
||||
AUDIOCAPS caps;
|
||||
UINT nDeviceId;
|
||||
if (APingAudio(&nDeviceId) != AUDIO_ERROR_NONE)
|
||||
printf("no audio found\n");
|
||||
else {
|
||||
AGetAudioDevCaps(nDeviceId, &caps);
|
||||
printf("%s device found\n", caps.szProductName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AGetAudioDevCaps, AGetAudioNumDevs */
|
||||
VOID PrintAudioDevs(VOID)
|
||||
{
|
||||
AUDIOCAPS caps;
|
||||
UINT nDeviceId;
|
||||
for (nDeviceId = 0; nDeviceId < AGetAudioNumDevs(); nDeviceId++) {
|
||||
Assert(AGetAudioDevCaps(nDeviceId, &caps));
|
||||
printf("nDeviceId=%d wProductId=%d szProductName=%s\n",
|
||||
nDeviceId, caps.wProductId, caps.szProductName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AOpenAudio, AGetErrorText */
|
||||
VOID InitializeAudio(VOID)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
CHAR szText[128];
|
||||
UINT rc;
|
||||
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
#ifdef FILTER
|
||||
info.wFormat |= AUDIO_FORMAT_FILTER;
|
||||
#endif
|
||||
info.nSampleRate = 44100;
|
||||
if ((rc = AOpenAudio(&info)) != AUDIO_ERROR_NONE) {
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
printf("ERROR: %s\n", szText);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Audio device initialized at %d bits %s %u Hz\n",
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ?
|
||||
"stereo" : "mono", info.nSampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ASetAudioTimerProc, ASetAudioTimerRate */
|
||||
volatile UINT nTickCounter = 0;
|
||||
|
||||
VOID AIAPI TimerHandler(VOID)
|
||||
{
|
||||
nTickCounter++;
|
||||
}
|
||||
|
||||
VOID InitTimerHandler(VOID)
|
||||
{
|
||||
Assert(ASetAudioTimerProc(TimerHandler));
|
||||
Assert(ASetAudioTimerRate(125));
|
||||
}
|
||||
|
||||
VOID DoneTimerHandler(VOID)
|
||||
{
|
||||
Assert(ASetAudioTimerProc(NULL));
|
||||
}
|
||||
|
||||
VOID TestTimerServices(VOID)
|
||||
{
|
||||
InitTimerHandler();
|
||||
do {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
fprintf(stderr, "Elapsed: %2.2f secs\r", nTickCounter / 50.0F);
|
||||
} while (nTickCounter < 2*50);
|
||||
DoneTimerHandler();
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioVoice, ADestroyAudioVoice, APlayVoice, ASetVoiceXXX */
|
||||
VOID PlayWaveform(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
HAC hVoice;
|
||||
BOOL stopped;
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
Assert(ASetVoicePanning(hVoice, 128));
|
||||
printf("press any key to stop\n");
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
Assert(AGetVoiceStatus(hVoice, &stopped));
|
||||
if (stopped) break;
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
}
|
||||
|
||||
VOID TestPlayWaveform(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
lpWave->wFormat |= AUDIO_FORMAT_LOOP;
|
||||
lpWave->dwLoopStart = 0;
|
||||
lpWave->dwLoopEnd = lpWave->dwLength;
|
||||
Assert(AOpenVoices(1));
|
||||
PlayWaveform(lpWave);
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* APrimeVoice, AStartVoice, ASetVoiceXXX */
|
||||
VOID PlayChord(HAC aVoices[3], LPAUDIOWAVE lpWave, LONG aFreqs[3])
|
||||
{
|
||||
UINT n;
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(APrimeVoice(aVoices[n], lpWave));
|
||||
Assert(ASetVoiceFrequency(aVoices[n], aFreqs[n]));
|
||||
Assert(ASetVoiceVolume(aVoices[n], 64));
|
||||
}
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(AStartVoice(aVoices[n]));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TestPlayChord(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[3];
|
||||
LONG aFreqs[3] = { (8*6000)/8, (8*6000)/6, (8*6000)/5 };
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(3));
|
||||
for (n = 0; n < 3; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play chord two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayChord(aVoices, lpWave, aFreqs);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ASetVoicePosition, AGetVoicePosition */
|
||||
VOID PlayEchoVoices(HAC aVoices[2], LPAUDIOWAVE lpWave, LONG dwDelay)
|
||||
{
|
||||
Assert(APrimeVoice(aVoices[0], lpWave));
|
||||
Assert(APrimeVoice(aVoices[1], lpWave));
|
||||
Assert(ASetVoiceFrequency(aVoices[0], lpWave->nSampleRate / 2));
|
||||
Assert(ASetVoiceFrequency(aVoices[1], lpWave->nSampleRate / 2));
|
||||
Assert(ASetVoiceVolume(aVoices[0], 64));
|
||||
Assert(ASetVoiceVolume(aVoices[1], 48));
|
||||
Assert(ASetVoicePosition(aVoices[1], dwDelay));
|
||||
Assert(AStartVoice(aVoices[0]));
|
||||
Assert(AStartVoice(aVoices[1]));
|
||||
}
|
||||
|
||||
VOID TestPlayEcho(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[2];
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(2));
|
||||
for (n = 0; n < 2; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayEchoVoices(aVoices, lpWave, 800);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 2; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ASetVoiceFrequency */
|
||||
VOID PlayVoiceStereo(HAC aVoices[2], LPAUDIOWAVE lpWave, LONG dwPitchShift)
|
||||
{
|
||||
Assert(APrimeVoice(aVoices[0], lpWave));
|
||||
Assert(APrimeVoice(aVoices[1], lpWave));
|
||||
Assert(ASetVoiceVolume(aVoices[0], 64));
|
||||
Assert(ASetVoiceVolume(aVoices[1], 64));
|
||||
Assert(ASetVoiceFrequency(aVoices[0], lpWave->nSampleRate));
|
||||
Assert(ASetVoiceFrequency(aVoices[1], lpWave->nSampleRate + dwPitchShift));
|
||||
Assert(ASetVoicePanning(aVoices[0], 0));
|
||||
Assert(ASetVoicePanning(aVoices[1], 255));
|
||||
Assert(AStartVoice(aVoices[0]));
|
||||
Assert(AStartVoice(aVoices[1]));
|
||||
}
|
||||
|
||||
VOID TestPlayStereoEnh(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[2];
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(2));
|
||||
for (n = 0; n < 2; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayVoiceStereo(aVoices, lpWave, 100);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 2; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioData, AWriteAudioData */
|
||||
LPAUDIOWAVE CreateAudio8BitMono(WORD nSampleRate,
|
||||
LPBYTE lpData, DWORD dwLength)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
if ((lpWave = (LPAUDIOWAVE) malloc(sizeof(AUDIOWAVE))) != NULL) {
|
||||
lpWave->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||
lpWave->nSampleRate = nSampleRate;
|
||||
lpWave->dwLength = dwLength;
|
||||
lpWave->dwLoopStart = lpWave->dwLoopEnd = 0L;
|
||||
Assert(ACreateAudioData(lpWave));
|
||||
memcpy(lpWave->lpData, lpData, dwLength);
|
||||
Assert(AWriteAudioData(lpWave, 0L, dwLength));
|
||||
}
|
||||
return lpWave;
|
||||
}
|
||||
|
||||
VOID TestCreateAudioData(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice;
|
||||
static BYTE aData[4000];
|
||||
UINT n;
|
||||
|
||||
/* create 500 Hz sinewave (sampled at 4 kHz) */
|
||||
for (n = 0; n < sizeof(aData); n++)
|
||||
aData[n] = (BYTE)(127.0 * sin((500.0 * 3.141592653 * n) / sizeof(aData)));
|
||||
|
||||
lpWave = CreateAudio8BitMono(4000, aData, sizeof(aData));
|
||||
if (lpWave == NULL) {
|
||||
printf("not enough memory\n");
|
||||
return;
|
||||
}
|
||||
Assert(AOpenVoices(1));
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
Assert(ACloseVoices());
|
||||
Assert(ADestroyAudioData(lpWave));
|
||||
free(lpWave);
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioData, AWriteAudioData */
|
||||
VOID StreamData8BitMono(FILE *stream, HAC hVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
static BYTE aBuffer[1024];
|
||||
LPBYTE lpChunk;
|
||||
UINT nLength, nChunkSize;
|
||||
DWORD dwOffset;
|
||||
static LONG dwVoicePosition;
|
||||
|
||||
if (2*sizeof(aBuffer) > lpWave->dwLength) {
|
||||
printf("the waveform is too small\n");
|
||||
return;
|
||||
}
|
||||
memset(lpWave->lpData, 0x80, lpWave->dwLength);
|
||||
Assert(AWriteAudioData(lpWave, 0L, lpWave->dwLength));
|
||||
lpWave->wFormat |= AUDIO_FORMAT_LOOP;
|
||||
lpWave->dwLoopStart = 0L;
|
||||
lpWave->dwLoopEnd = lpWave->dwLength;
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
dwOffset = 0L;
|
||||
while ((nLength = fread(aBuffer, 1, sizeof(aBuffer), stream)) != 0) {
|
||||
if (kbhit()) break;
|
||||
|
||||
#ifndef SIGNED
|
||||
{
|
||||
UINT n;
|
||||
for (n = 0; n < nLength; n++)
|
||||
aBuffer[n] ^= 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
lpChunk = aBuffer;
|
||||
while (nLength > 0) {
|
||||
nChunkSize = nLength;
|
||||
if (dwOffset + nChunkSize > lpWave->dwLength)
|
||||
nChunkSize = lpWave->dwLength - dwOffset;
|
||||
for (;;) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
Assert(AGetVoicePosition(hVoice, &dwVoicePosition));
|
||||
if (dwOffset + nChunkSize > lpWave->dwLength) {
|
||||
if (dwVoicePosition < dwOffset &&
|
||||
dwVoicePosition > dwOffset +
|
||||
nChunkSize - lpWave->dwLength)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (dwVoicePosition < dwOffset ||
|
||||
dwVoicePosition > dwOffset + nChunkSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
memcpy(lpWave->lpData + dwOffset, lpChunk, nChunkSize);
|
||||
Assert(AWriteAudioData(lpWave, dwOffset, nChunkSize));
|
||||
if ((dwOffset += nChunkSize) >= lpWave->dwLength)
|
||||
dwOffset = 0L;
|
||||
lpChunk += nChunkSize;
|
||||
nLength -= nChunkSize;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
}
|
||||
|
||||
VOID TestAudioStream(VOID)
|
||||
{
|
||||
FILE *stream;
|
||||
HAC hVoice;
|
||||
AUDIOWAVE Wave;
|
||||
|
||||
/* open .wav file and skip header structure */
|
||||
if ((stream = fopen("8mono.wav", "rb")) == NULL) {
|
||||
printf("cant open raw 8-bit mono file\n");
|
||||
return;
|
||||
}
|
||||
fseek(stream, 48L, SEEK_SET);
|
||||
|
||||
/* start playing the "data" chunk of the .wav file */
|
||||
Assert(AOpenVoices(1));
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
Wave.wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||
Wave.nSampleRate = 11025;
|
||||
Wave.dwLength = Wave.dwLoopEnd = 10000;
|
||||
Wave.dwLoopStart = 0;
|
||||
Assert(ACreateAudioData(&Wave));
|
||||
printf("press any key to stop\n");
|
||||
StreamData8BitMono(stream, hVoice, &Wave);
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
Assert(ACloseVoices());
|
||||
Assert(ADestroyAudioData(&Wave));
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifndef WIN32
|
||||
AInitialize();
|
||||
#endif
|
||||
|
||||
printf("------------ DetectAudioDevice() ------------\n");
|
||||
DetectAudioDevice();
|
||||
printf("------------ PrintAudioDevs() ---------------\n");
|
||||
PrintAudioDevs();
|
||||
printf("------------ InitializeAudio() --------------\n");
|
||||
InitializeAudio();
|
||||
printf("------------ TestTimerServices() ------------\n");
|
||||
TestTimerServices();
|
||||
printf("------------ TestPlayWaveform() -------------\n");
|
||||
TestPlayWaveform();
|
||||
printf("------------ TestPlayChord() ----------------\n");
|
||||
TestPlayChord();
|
||||
printf("------------ TestPlayEcho() -----------------\n");
|
||||
TestPlayEcho();
|
||||
printf("------------ TestPlayStereoEnh() ------------\n");
|
||||
TestPlayStereoEnh();
|
||||
printf("------------ TestCreateAudioData() ----------\n");
|
||||
TestCreateAudioData();
|
||||
printf("------------ TestAudioStream() --------------\n");
|
||||
TestAudioStream();
|
||||
printf("------------ ACloseAudio() ------------------\n");
|
||||
Assert(ACloseAudio());
|
||||
}
|
||||
49
seal-hack/examples/demo.pas
Normal file
49
seal-hack/examples/demo.pas
Normal file
@@ -0,0 +1,49 @@
|
||||
program Demo;
|
||||
uses
|
||||
SysUtils, Audio;
|
||||
|
||||
var
|
||||
Caps: TAudioCaps;
|
||||
Info: TAudioInfo;
|
||||
pModule: PAudioModule;
|
||||
szFileName : Array [0..127] of Char;
|
||||
bStatus: Integer;
|
||||
begin
|
||||
if ParamCount <> 1 then
|
||||
begin
|
||||
Writeln('use: demo filename[.mod|.s3m|.xm]');
|
||||
Halt(0);
|
||||
end;
|
||||
Info.nDeviceId := AUDIO_DEVICE_MAPPER;
|
||||
Info.wFormat := AUDIO_FORMAT_16BITS or AUDIO_FORMAT_STEREO or AUDIO_FORMAT_FILTER;
|
||||
Info.nSampleRate := 44100;
|
||||
if AOpenAudio(Info) <> 0 then
|
||||
begin
|
||||
Writeln('Audio initialization failed');
|
||||
Halt(1);
|
||||
end;
|
||||
AGetAudioDevCaps(Info.nDeviceId, Caps);
|
||||
Write(Caps.szProductName,' playing at ');
|
||||
if Info.wFormat and AUDIO_FORMAT_16BITS <> 0 then
|
||||
Write('16-bit ') else Write('8-bit ');
|
||||
if Info.wFormat and AUDIO_FORMAT_STEREO <> 0 then
|
||||
Write('stereo ') else Write('mono ');
|
||||
Writeln(Info.nSampleRate,' Hz');
|
||||
if ALoadModuleFile(StrPCopy(szFileName, ParamStr(1)), pModule, 0) <> 0 then
|
||||
begin
|
||||
Writeln('Cant load module file');
|
||||
ACloseAudio;
|
||||
Halt(1);
|
||||
end;
|
||||
AOpenVoices(pModule^.nTracks);
|
||||
APlayModule(pModule);
|
||||
while (AGetModuleStatus(bStatus) = 0) do
|
||||
begin
|
||||
if bStatus <> 0 then break;
|
||||
AUpdateAudio;
|
||||
end;
|
||||
AStopModule;
|
||||
ACloseVoices;
|
||||
AFreeModuleFile(pModule);
|
||||
ACloseAudio;
|
||||
end.
|
||||
BIN
seal-hack/examples/example1
Executable file
BIN
seal-hack/examples/example1
Executable file
Binary file not shown.
67
seal-hack/examples/example1.c
Normal file
67
seal-hack/examples/example1.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/* example1.c - initialize and print device information */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
AUDIOCAPS caps;
|
||||
UINT rc, nDevId;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* show registered device drivers */
|
||||
printf("List of registered devices:\n");
|
||||
for (nDevId = 0; nDevId < AGetAudioNumDevs(); nDevId++) {
|
||||
AGetAudioDevCaps(nDevId, &caps);
|
||||
printf(" %2d. %s\n", nDevId, caps.szProductName);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* NOTE: Here we can use any of the above devices, or we can
|
||||
* use the virtual device AUDIO_DEVICE_MAPPER for detection.
|
||||
*/
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
if ((rc = AOpenAudio(&info)) != AUDIO_ERROR_NONE) {
|
||||
CHAR szText[80];
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
printf("ERROR: %s\n", szText);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: Since the audio device may not support the playback
|
||||
* format and sampling frequency, the audio system uses the
|
||||
* closest configuration which is then returned to the user
|
||||
* in the AUDIOINFO structure.
|
||||
*
|
||||
*/
|
||||
|
||||
/* print information */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s at %d-bit %s %u Hz detected\n",
|
||||
caps.szProductName,
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
||||
info.nSampleRate);
|
||||
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
20
seal-hack/examples/example1.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example1.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example1</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
seal-hack/examples/example2
Executable file
BIN
seal-hack/examples/example2
Executable file
Binary file not shown.
70
seal-hack/examples/example2.c
Normal file
70
seal-hack/examples/example2.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* example2.c - play a module file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOMODULE lpModule;
|
||||
int ret;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = 2;// AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
|
||||
#ifdef USEFILTER
|
||||
/* enable antialias dynamic filtering */
|
||||
info.wFormat |= AUDIO_FORMAT_FILTER;
|
||||
#endif
|
||||
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load module file */
|
||||
ret = ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
if (lpModule == NULL)
|
||||
{
|
||||
printf("Error loding file... [%d]\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* open voices and play module */
|
||||
AOpenVoices(lpModule->nTracks);
|
||||
APlayModule(lpModule);
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing module file, press any key to stop.\n");
|
||||
while (!kbhit()) {
|
||||
BOOL stopped;
|
||||
|
||||
/* check if the module is stopped */
|
||||
AGetModuleStatus(&stopped);
|
||||
if (stopped) break;
|
||||
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
}
|
||||
|
||||
/* stop module and close voices */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release module file */
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
20
seal-hack/examples/example2.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example2.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example2</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
seal-hack/examples/example3
Executable file
BIN
seal-hack/examples/example3
Executable file
Binary file not shown.
87
seal-hack/examples/example3.c
Normal file
87
seal-hack/examples/example3.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* example3.c - play a waveform file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
#define NUMVOICES 3*3
|
||||
|
||||
#define FREQ(nPeriod) (((LONG) lpWave->nSampleRate * 428) / nPeriod)
|
||||
|
||||
UINT aPeriodTable[48] =
|
||||
{ /* C C# D D# E F F# G G# A A# B */
|
||||
856,808,762,720,678,640,604,570,538,508,480,453,
|
||||
428,404,381,360,339,320,302,285,269,254,240,226,
|
||||
214,202,190,180,170,160,151,143,135,127,120,113,
|
||||
107,101,95,90,85,80,75,71,67,63,60,56
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice[NUMVOICES];
|
||||
BOOL stopped;
|
||||
UINT n, m;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load waveform file */
|
||||
ALoadWaveFile("test.wav", &lpWave, 0);
|
||||
|
||||
/* open and allocate voices */
|
||||
AOpenVoices(NUMVOICES);
|
||||
for (n = 0; n < NUMVOICES; n++) {
|
||||
ACreateAudioVoice(&hVoice[n]);
|
||||
ASetVoiceVolume(hVoice[n], 64);
|
||||
ASetVoicePanning(hVoice[n], n & 1 ? 0 : 255);
|
||||
}
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing waveform, press any key to stop.\n");
|
||||
for (n = m = 0; !kbhit() && n < 48 - 7; n++) {
|
||||
/* play chord C-E-G */
|
||||
APlayVoice(hVoice[m+0], lpWave);
|
||||
APlayVoice(hVoice[m+1], lpWave);
|
||||
APlayVoice(hVoice[m+2], lpWave);
|
||||
ASetVoiceFrequency(hVoice[m+0], FREQ(aPeriodTable[n+0]));
|
||||
ASetVoiceFrequency(hVoice[m+1], FREQ(aPeriodTable[n+4]));
|
||||
ASetVoiceFrequency(hVoice[m+2], FREQ(aPeriodTable[n+7]));
|
||||
m = (m + 3) % NUMVOICES;
|
||||
|
||||
/* wait until note finishes */
|
||||
do {
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
AGetVoiceStatus(hVoice[0], &stopped);
|
||||
} while (!stopped);
|
||||
}
|
||||
|
||||
/* stop and release voices */
|
||||
for (n = 0; n < NUMVOICES; n++) {
|
||||
AStopVoice(hVoice[n]);
|
||||
ADestroyAudioVoice(hVoice[n]);
|
||||
}
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform file */
|
||||
AFreeWaveFile(lpWave);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
20
seal-hack/examples/example3.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example3.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example3</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
seal-hack/examples/example4
Executable file
BIN
seal-hack/examples/example4
Executable file
Binary file not shown.
78
seal-hack/examples/example4.c
Normal file
78
seal-hack/examples/example4.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/* example4.c - play module and waveform file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOMODULE lpModule;
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice;
|
||||
BOOL stopped;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = 1;//AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load module and waveform file */
|
||||
ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
ALoadWaveFile("test.wav", &lpWave, 0);
|
||||
|
||||
/* open voices for module and waveform */
|
||||
AOpenVoices(lpModule->nTracks + 1);
|
||||
|
||||
/* play the module file */
|
||||
APlayModule(lpModule);
|
||||
ASetModuleVolume(64);
|
||||
|
||||
/* play the waveform through a voice */
|
||||
ACreateAudioVoice(&hVoice);
|
||||
APlayVoice(hVoice, lpWave);
|
||||
ASetVoiceVolume(hVoice, 48);
|
||||
ASetVoicePanning(hVoice, 128);
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing module and waveform, press any key to stop.\n");
|
||||
while (!kbhit()) {
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
|
||||
/* restart waveform if stopped */
|
||||
AGetVoiceStatus(hVoice, &stopped);
|
||||
if (stopped) APlayVoice(hVoice, lpWave);
|
||||
|
||||
/* check if the module is stopped */
|
||||
AGetModuleStatus(&stopped);
|
||||
if (stopped) break;
|
||||
}
|
||||
|
||||
/* stop playing the waveform */
|
||||
AStopVoice(hVoice);
|
||||
ADestroyAudioVoice(hVoice);
|
||||
|
||||
/* stop playing the module */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform & module */
|
||||
AFreeWaveFile(lpWave);
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
20
seal-hack/examples/example4.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example4.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example4</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
seal-hack/examples/example5
Executable file
BIN
seal-hack/examples/example5
Executable file
Binary file not shown.
120
seal-hack/examples/example5.c
Normal file
120
seal-hack/examples/example5.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* example5.c - update the system using the timer interrupt, please compile
|
||||
* using WATCOM C/C++32 and assume that the stack segment is
|
||||
* not pegged to the DGROUP segment:
|
||||
*
|
||||
* wcl386 -l=dos4g -zu -s -I..\include example5.c ..\lib\dos\audiowcf.lib
|
||||
*/
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("This example only works with WATCOM C/C++32 and DOS4GW\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
#include <conio.h>
|
||||
#include <dos.h>
|
||||
|
||||
/* call the timer handler 70 times per second */
|
||||
#define TIMER_RATE (1193180/70)
|
||||
|
||||
volatile void (interrupt far *lpfnBIOSTimerHandler)(void) = NULL;
|
||||
volatile long dwTimerAccum = 0L;
|
||||
|
||||
void SetBorderColor(BYTE nColor)
|
||||
{
|
||||
outp(0x3c0, 0x31);
|
||||
outp(0x3c0, nColor);
|
||||
}
|
||||
|
||||
void interrupt far TimerHandler(void)
|
||||
{
|
||||
SetBorderColor(1);
|
||||
AUpdateAudio();
|
||||
SetBorderColor(0);
|
||||
if ((dwTimerAccum += TIMER_RATE) >= 0x10000L) {
|
||||
dwTimerAccum -= 0x10000L;
|
||||
lpfnBIOSTimerHandler();
|
||||
}
|
||||
else {
|
||||
outp(0x20, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
VOID InitTimerHandler(VOID)
|
||||
{
|
||||
lpfnBIOSTimerHandler = _dos_getvect(0x08);
|
||||
_dos_setvect(0x08, TimerHandler);
|
||||
outp(0x43, 0x34);
|
||||
outp(0x40, LOBYTE(TIMER_RATE));
|
||||
outp(0x40, HIBYTE(TIMER_RATE));
|
||||
}
|
||||
|
||||
VOID DoneTimerHandler(VOID)
|
||||
{
|
||||
outp(0x43, 0x34);
|
||||
outp(0x40, 0x00);
|
||||
outp(0x40, 0x00);
|
||||
_dos_setvect(0x08, lpfnBIOSTimerHandler);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
static AUDIOINFO info;
|
||||
static AUDIOCAPS caps;
|
||||
static LPAUDIOMODULE lpModule;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* show device information */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s detected. Please type EXIT to return.\n", caps.szProductName);
|
||||
|
||||
/* load module file */
|
||||
ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
|
||||
/* open voices for module */
|
||||
AOpenVoices(lpModule->nTracks);
|
||||
|
||||
/* play the module file */
|
||||
APlayModule(lpModule);
|
||||
|
||||
/* initialize the timer routines */
|
||||
InitTimerHandler();
|
||||
|
||||
/* invoke the DOS command processor */
|
||||
system(getenv("COMSPEC"));
|
||||
|
||||
/* terminate the timer routines */
|
||||
DoneTimerHandler();
|
||||
|
||||
/* stop playing the module */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform & module */
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
20
seal-hack/examples/example5.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example5.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example5</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
BIN
seal-hack/examples/example6
Executable file
BIN
seal-hack/examples/example6
Executable file
Binary file not shown.
100
seal-hack/examples/example6.c
Normal file
100
seal-hack/examples/example6.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* example6.c - play a streamed sample (sine wave) using triple buffering */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
AUDIOCAPS caps;
|
||||
AUDIOWAVE wave;
|
||||
HAC voice;
|
||||
int i;
|
||||
float t, dt;
|
||||
long position, chunkSize, chunkPosition;
|
||||
|
||||
/* initialize library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* show device name */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s detected. Press any key to exit.\n", caps.szProductName);
|
||||
|
||||
/* open audio voice */
|
||||
AOpenVoices(1);
|
||||
ACreateAudioVoice(&voice);
|
||||
ASetVoiceVolume(voice, 64);
|
||||
ASetVoicePanning(voice, 128);
|
||||
|
||||
/* setup buffer length to 1/60th of a second */
|
||||
chunkPosition = 0;
|
||||
chunkSize = info.nSampleRate / 60;
|
||||
|
||||
/* create a looped sound buffer of 3 x 1/60th secs */
|
||||
wave.nSampleRate = info.nSampleRate;
|
||||
wave.dwLength = 3 * chunkSize;
|
||||
wave.dwLoopStart = 0;
|
||||
wave.dwLoopEnd = wave.dwLength;
|
||||
wave.wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
|
||||
ACreateAudioData(&wave);
|
||||
|
||||
/* clean up sound buffer */
|
||||
memset(wave.lpData, 0, wave.dwLength);
|
||||
AWriteAudioData(&wave, 0, wave.dwLength);
|
||||
|
||||
/* setup 200 Hz sine wave parameters */
|
||||
t = 0.0;
|
||||
dt = 2.0 * M_PI * 200.0 / wave.nSampleRate;
|
||||
|
||||
printf("%d-bit %s %u Hz, buffer size = %ld, chunk size = %ld\n",
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
||||
info.nSampleRate, wave.dwLength, chunkSize);
|
||||
|
||||
/* start playing the sound buffer */
|
||||
APlayVoice(voice, &wave);
|
||||
|
||||
while (!kbhit()) {
|
||||
/* do not fill more than 'chunkSize' samples */
|
||||
AUpdateAudioEx(chunkSize);
|
||||
|
||||
/* update the chunk of samples at 'chunkPosition' */
|
||||
AGetVoicePosition(voice, &position);
|
||||
if (position < chunkPosition || position >= chunkPosition + chunkSize) {
|
||||
for (i = 0; i < chunkSize; i++)
|
||||
wave.lpData[chunkPosition++] = 64.0 * sin(t += dt);
|
||||
AWriteAudioData(&wave, chunkPosition - chunkSize, chunkSize);
|
||||
if (chunkPosition >= wave.dwLength)
|
||||
chunkPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* stop playing the buffer */
|
||||
AStopVoice(voice);
|
||||
|
||||
/* release sound buffer */
|
||||
ADestroyAudioData(&wave);
|
||||
|
||||
/* release audio voices */
|
||||
ADestroyAudioVoice(voice);
|
||||
ACloseVoices();
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
20
seal-hack/examples/example6.dSYM/Contents/Info.plist
Normal file
20
seal-hack/examples/example6.dSYM/Contents/Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example6</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
41
seal-hack/examples/mk
Executable file
41
seal-hack/examples/mk
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
case `uname -sr` in
|
||||
IRIX\ 4.0.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Indigo -laudio -lm" ;;
|
||||
SunOS\ 4.1.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/SunOS -laudio -lm" ;;
|
||||
SunOS\ 5.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Solaris -laudio -lm" ;;
|
||||
Linux*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Linux -lsdlseal -lm `sdl-config --libs`" ;;
|
||||
Darwin*)
|
||||
CC=clang
|
||||
STRIP=false
|
||||
LIBS="-L../lib/MacOSX -laudio -lm `allegro-config --libs` -arch i386" ;;
|
||||
FreeBSD*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/FreeBSD -laudio -lm" ;;
|
||||
BeOS*)
|
||||
CC=gcc
|
||||
STRIP=true
|
||||
LIBS="-L../lib/BeOS -laudio -lroot -lbe -lmedia" ;;
|
||||
*)
|
||||
echo "This program has not been tested on your machine!"
|
||||
exit
|
||||
esac
|
||||
|
||||
for f in 1 2 3 4 5 6; do
|
||||
echo "compiling example$f.c"
|
||||
$CC -I../include -g -o example$f example$f.c $LIBS
|
||||
$STRIP example$f
|
||||
done
|
||||
88
seal-hack/examples/mk.bat
Normal file
88
seal-hack/examples/mk.bat
Normal file
@@ -0,0 +1,88 @@
|
||||
@echo off
|
||||
|
||||
if "%1"=="bcl" goto bcl
|
||||
if "%1"=="wcl" goto wcl
|
||||
if "%1"=="bcx" goto bcx
|
||||
if "%1"=="wcf" goto wcf
|
||||
if "%1"=="djf" goto djf
|
||||
if "%1"=="w16bc" goto w16bc
|
||||
if "%1"=="w16wc" goto w16wc
|
||||
if "%1"=="w32bc" goto w32bc
|
||||
if "%1"=="w32wc" goto w32wc
|
||||
if "%1"=="w32vc" goto w32vc
|
||||
if "%1"=="w32bp" goto w32bp
|
||||
|
||||
:usage
|
||||
echo **** usage: build [target]
|
||||
echo ****
|
||||
echo **** 16-bit DOS real mode, large memory model:
|
||||
echo **** bcl - Borland C++ 3.1 real mode
|
||||
echo **** wcl - Watcom C/C++16 10.0 real mode
|
||||
echo ****
|
||||
echo **** 16-bit DOS protected mode, large memory model:
|
||||
echo **** bcx - Borland C++ 4.5 protected mode (DPMI16 PowerPack)
|
||||
echo ****
|
||||
echo **** 32-bit DOS protected mode, flat memory model:
|
||||
echo **** wcf - Watcom C/C++32 10.0 protected mode (DOS4GW Extender)
|
||||
echo **** djf - DJGPP V 2.0 protected mode (GO32/DPMI32 Extender)
|
||||
echo ****
|
||||
echo **** 16-bit Windows 3.x protected mode, large memory model:
|
||||
echo **** w16bc - Borland C++ 3.1 protected mode (Win16)
|
||||
echo **** w16wc - Watcom C/C++16 10.0 protected mode (Win16)
|
||||
echo ****
|
||||
echo **** 32-bit Windows 95/NT protected mode, flat memory model:
|
||||
echo **** w32bc - Borland C++ 4.5 protected mode (Win32)
|
||||
echo **** w32wc - Watcom C/C++16 10.0 protected mode (Win32)
|
||||
echo **** w32vc - Microsoft Visual C++ 4.1 protected mode (Win32)
|
||||
echo **** w32bp - Borland Delphi 2.0 protected mode (Win32)
|
||||
echo ****
|
||||
echo **** NOTE: 16-bit libraries are not available in this release.
|
||||
goto exit
|
||||
|
||||
:bcl
|
||||
for %%f in (*.c) do bcc -ml -I..\include ..\lib\dos\audiobcl.lib %%f
|
||||
goto exit
|
||||
|
||||
:wcl
|
||||
for %%f in (*.c) do wcl -ml -I..\include ..\lib\dos\audiowcl.lib %%f
|
||||
goto exit
|
||||
|
||||
:bcx
|
||||
for %%f in (*.c) do bcc -ml -WX -I..\include ..\lib\dos\audiobcx.lib %%f
|
||||
goto exit
|
||||
|
||||
:wcf
|
||||
for %%f in (*.c) do wcl386 -zq -I..\include ..\lib\dos\audiowcf.lib %%f
|
||||
goto exit
|
||||
|
||||
:djf
|
||||
for %%f in (1 2 3 4) do gcc -o example%%f.exe -I..\include example%%f.c -L..\lib\dos -laudio
|
||||
goto exit
|
||||
|
||||
:w16bc
|
||||
for %%f in (*.c) do bcc -ml -W -I..\include ..\lib\win16\audw16bc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w16wc
|
||||
for %%f in (*.c) do wcl -ml -zw -I..\include ..\lib\win16\audw16wc.lib mmsystem.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32bc
|
||||
for %%f in (*.c) do bcc32a -WC -DWIN32 -I..\include ..\lib\win32\audw32bc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32wc
|
||||
for %%f in (*.c) do wcl386 -l=nt -DWIN32 -I..\include ..\lib\win32\audw32wc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32vc
|
||||
for %%f in (*.c) do cl -DWIN32 -I..\include ..\lib\win32\audw32vc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32bp
|
||||
dcc32 -CC -U..\include demo.pas
|
||||
goto exit
|
||||
|
||||
:exit
|
||||
if exist *.obj del *.obj > nul
|
||||
if exist *.o del *.o > nul
|
||||
BIN
seal-hack/examples/test.s3m
Normal file
BIN
seal-hack/examples/test.s3m
Normal file
Binary file not shown.
BIN
seal-hack/examples/test.wav
Normal file
BIN
seal-hack/examples/test.wav
Normal file
Binary file not shown.
377
seal-hack/examples/vb/form1.frm
Normal file
377
seal-hack/examples/vb/form1.frm
Normal file
@@ -0,0 +1,377 @@
|
||||
VERSION 5.00
|
||||
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
|
||||
Begin VB.Form Form1
|
||||
BorderStyle = 1 'Fixed Single
|
||||
Caption = "Seal 1.03 - Visual Basic Interface"
|
||||
ClientHeight = 5220
|
||||
ClientLeft = 2220
|
||||
ClientTop = 2205
|
||||
ClientWidth = 6690
|
||||
ControlBox = 0 'False
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
PaletteMode = 1 'UseZOrder
|
||||
ScaleHeight = 5220
|
||||
ScaleWidth = 6690
|
||||
Begin VB.CommandButton Command3
|
||||
Caption = "Quit"
|
||||
Height = 375
|
||||
Left = 5880
|
||||
TabIndex = 12
|
||||
Top = 0
|
||||
Width = 735
|
||||
End
|
||||
Begin VB.TextBox Text1
|
||||
Appearance = 0 'Flat
|
||||
BackColor = &H80000004&
|
||||
BorderStyle = 0 'None
|
||||
Enabled = 0 'False
|
||||
BeginProperty Font
|
||||
Name = "MS Sans Serif"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 285
|
||||
Left = 1440
|
||||
TabIndex = 9
|
||||
Text = "None"
|
||||
Top = 120
|
||||
Width = 4215
|
||||
End
|
||||
Begin TabDlg.SSTab SSTab1
|
||||
Height = 4455
|
||||
Left = 360
|
||||
TabIndex = 0
|
||||
Top = 480
|
||||
Width = 6015
|
||||
_ExtentX = 10610
|
||||
_ExtentY = 7858
|
||||
_Version = 327680
|
||||
Tab = 2
|
||||
TabHeight = 520
|
||||
TabCaption(0) = "Song Selector"
|
||||
TabPicture(0) = "Form1.frx":0000
|
||||
Tab(0).ControlCount= 3
|
||||
Tab(0).ControlEnabled= 0 'False
|
||||
Tab(0).Control(0)= "File1"
|
||||
Tab(0).Control(0).Enabled= 0 'False
|
||||
Tab(0).Control(1)= "Drive1"
|
||||
Tab(0).Control(1).Enabled= 0 'False
|
||||
Tab(0).Control(2)= "Dir1"
|
||||
Tab(0).Control(2).Enabled= 0 'False
|
||||
TabCaption(1) = "PlayBack Controls"
|
||||
TabPicture(1) = "Form1.frx":001C
|
||||
Tab(1).ControlCount= 6
|
||||
Tab(1).ControlEnabled= 0 'False
|
||||
Tab(1).Control(0)= "Label2"
|
||||
Tab(1).Control(0).Enabled= 0 'False
|
||||
Tab(1).Control(1)= "Frame1"
|
||||
Tab(1).Control(1).Enabled= 0 'False
|
||||
Tab(1).Control(2)= "Command2"
|
||||
Tab(1).Control(2).Enabled= -1 'True
|
||||
Tab(1).Control(3)= "PlayButton"
|
||||
Tab(1).Control(3).Enabled= -1 'True
|
||||
Tab(1).Control(4)= "Command1"
|
||||
Tab(1).Control(4).Enabled= -1 'True
|
||||
Tab(1).Control(5)= "StopButton"
|
||||
Tab(1).Control(5).Enabled= -1 'True
|
||||
TabCaption(2) = "Author Info"
|
||||
TabPicture(2) = "Form1.frx":0038
|
||||
Tab(2).ControlCount= 4
|
||||
Tab(2).ControlEnabled= -1 'True
|
||||
Tab(2).Control(0)= "Label4"
|
||||
Tab(2).Control(0).Enabled= 0 'False
|
||||
Tab(2).Control(1)= "Label3"
|
||||
Tab(2).Control(1).Enabled= 0 'False
|
||||
Tab(2).Control(2)= "Command4"
|
||||
Tab(2).Control(2).Enabled= 0 'False
|
||||
Tab(2).Control(3)= "Command5"
|
||||
Tab(2).Control(3).Enabled= 0 'False
|
||||
Begin VB.CommandButton Command5
|
||||
Caption = "SEAL Page"
|
||||
Height = 615
|
||||
Left = 1200
|
||||
TabIndex = 16
|
||||
Top = 3240
|
||||
Width = 3855
|
||||
End
|
||||
Begin VB.CommandButton Command4
|
||||
Caption = "Egerter Software Home Page"
|
||||
Height = 615
|
||||
Left = 1200
|
||||
TabIndex = 13
|
||||
Top = 2040
|
||||
Width = 3855
|
||||
End
|
||||
Begin VB.CommandButton StopButton
|
||||
Caption = "Stop"
|
||||
Height = 495
|
||||
Left = -72480
|
||||
TabIndex = 7
|
||||
Top = 2520
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton Command1
|
||||
Caption = "Next"
|
||||
Height = 495
|
||||
Left = -71400
|
||||
TabIndex = 6
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton PlayButton
|
||||
Caption = "Play"
|
||||
Height = 495
|
||||
Left = -72480
|
||||
TabIndex = 5
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton Command2
|
||||
Caption = "Prev"
|
||||
Height = 495
|
||||
Left = -73560
|
||||
TabIndex = 4
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.DirListBox Dir1
|
||||
Height = 1440
|
||||
Left = -74280
|
||||
TabIndex = 3
|
||||
Top = 960
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.DriveListBox Drive1
|
||||
Height = 315
|
||||
Left = -74280
|
||||
TabIndex = 2
|
||||
Top = 480
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.FileListBox File1
|
||||
Height = 1650
|
||||
Left = -74280
|
||||
Pattern = "*.mod;*.s3m;*.mtm;*.xm"
|
||||
TabIndex = 1
|
||||
Top = 2520
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.Frame Frame1
|
||||
Caption = "Playback"
|
||||
Height = 2175
|
||||
Left = -74280
|
||||
TabIndex = 10
|
||||
Top = 1200
|
||||
Width = 4575
|
||||
End
|
||||
Begin VB.Label Label3
|
||||
Caption = "SEAL by Carlos Hasan"
|
||||
BeginProperty Font
|
||||
Name = "MS Sans Serif"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 1440
|
||||
TabIndex = 15
|
||||
Top = 1080
|
||||
Width = 3495
|
||||
End
|
||||
Begin VB.Label Label4
|
||||
Caption = "Modifications to VB interface by Barry Egerter"
|
||||
Height = 255
|
||||
Left = 1440
|
||||
TabIndex = 14
|
||||
Top = 1320
|
||||
Width = 3615
|
||||
End
|
||||
Begin VB.Label Label2
|
||||
Caption = "Use this simple playback system to control the music."
|
||||
Height = 255
|
||||
Left = -74160
|
||||
TabIndex = 11
|
||||
Top = 720
|
||||
Width = 4335
|
||||
End
|
||||
End
|
||||
Begin VB.Label Label1
|
||||
Caption = "Current Song:"
|
||||
Height = 255
|
||||
Left = 360
|
||||
TabIndex = 8
|
||||
Top = 120
|
||||
Width = 1095
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "Form1"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Dim iewindow As InternetExplorer
|
||||
Dim szFileName As String * 256
|
||||
Dim lpModule As Long
|
||||
Dim bSongPlaying As Long
|
||||
|
||||
|
||||
Private Sub Command1_Click()
|
||||
|
||||
Dim pnOrder As Long
|
||||
Dim lpnRow As Long
|
||||
|
||||
If AGetModulePosition(pnOrder, lpnRow) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ASetModulePosition(pnOrder + 1, 0) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command2_Click()
|
||||
|
||||
Dim pnOrder As Long
|
||||
Dim lpnRow As Long
|
||||
|
||||
If AGetModulePosition(pnOrder, lpnRow) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If pnOrder > 1 Then
|
||||
pnOrder = pnOrder - 1
|
||||
Else
|
||||
pnOrder = 0
|
||||
End If
|
||||
|
||||
If ASetModulePosition(pnOrder, 0) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command3_Click()
|
||||
|
||||
StopButton_Click
|
||||
Form1.Hide
|
||||
Unload Form1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command4_Click()
|
||||
|
||||
Set iewindow = New InternetExplorer
|
||||
|
||||
iewindow.Visible = True
|
||||
iewindow.Navigate ("http://www.egerter.com")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command5_Click()
|
||||
|
||||
Set iewindow = New InternetExplorer
|
||||
|
||||
iewindow.Visible = True
|
||||
iewindow.Navigate ("http://www.egerter.com/seal")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Dir1_Change()
|
||||
|
||||
File1.Path = Dir1.Path
|
||||
File1.Refresh
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Drive1_Change()
|
||||
|
||||
Dir1.Path = Drive1.Drive
|
||||
Dir1.Refresh
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub File1_Click()
|
||||
|
||||
Text1.Text = Dir1.Path + "\" + File1.filename
|
||||
Text1.Refresh
|
||||
szFileName = Text1.Text
|
||||
StopButton_Click
|
||||
|
||||
SSTab1.Tab = 1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PlayButton_Click()
|
||||
' WARNING! It's the very first time I have ever used VB, after some hours
|
||||
' I could finally write a sort of interface for AUDIOW32.DLL, it's not
|
||||
' perfect, there are still some things I couldn't figure how to port.
|
||||
' I used VB 4.0 and SEAL 1.03 to test this code.
|
||||
|
||||
Dim Info As AudioInfo
|
||||
|
||||
If bSongPlaying Then
|
||||
StopButton_Click
|
||||
End If
|
||||
|
||||
' set up audio configuration structure
|
||||
Info.nDeviceId = AUDIO_DEVICE_MAPPER
|
||||
Info.wFormat = AUDIO_FORMAT_STEREO + AUDIO_FORMAT_16BITS
|
||||
Info.nSampleRate = 22050 ' 44100 is an unsigned 16-bit integer!
|
||||
|
||||
' open the default audio device, return if error
|
||||
If AOpenAudio(Info) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' open 32 active voices
|
||||
If AOpenVoices(32) <> AUDIO_ERROR_NONE Then
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' load module file from disk, shutdown and return if error
|
||||
If ALoadModuleFile(szFileName, lpModule, 0) <> AUDIO_ERROR_NONE Then
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' start playing the module file
|
||||
If APlayModule(lpModule) <> AUDIO_ERROR_NONE Then
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
bSongPlaying = 1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub StopButton_Click()
|
||||
|
||||
If bSongPlaying = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
bSongPlaying = 0
|
||||
|
||||
' stop playing the module file
|
||||
AStopModule
|
||||
|
||||
' release the module file
|
||||
AFreeModuleFile (lpModule)
|
||||
|
||||
' close audio device
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
|
||||
End Sub
|
||||
BIN
seal-hack/examples/vb/form1.frx
Normal file
BIN
seal-hack/examples/vb/form1.frx
Normal file
Binary file not shown.
43
seal-hack/examples/vb/project1.vbp
Normal file
43
seal-hack/examples/vb/project1.vbp
Normal file
@@ -0,0 +1,43 @@
|
||||
Type=Exe
|
||||
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0; COMDLG32.OCX
|
||||
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
|
||||
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0; RICHTX32.OCX
|
||||
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0; COMCTL32.OCX
|
||||
Object={FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0; DBLIST32.OCX
|
||||
Object={00028C01-0000-0000-0000-000000000046}#1.0#0; DBGRID32.OCX
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SYSTEM\stdole2.tlb#Standard OLE Types
|
||||
Reference=*\G{EE008642-64A8-11CE-920F-08002B369A33}#2.0#0#C:\WINDOWS\SYSTEM\MSRDO20.DLL#Microsoft Remote Data Object 2.0
|
||||
Reference=*\G{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.0#0#C:\WINDOWS\SYSTEM\SHDOCVW.DLL#Microsoft Internet Controls
|
||||
Form=Form1.frm
|
||||
Module=Audio; audio.Bas
|
||||
Form=frmSplash.frm
|
||||
IconForm="Form1"
|
||||
Startup="frmSplash"
|
||||
HelpFile=""
|
||||
Title="SealStuf"
|
||||
ExeName32="SEAL_VB.exe"
|
||||
Command32=""
|
||||
Name="SEALVB"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionComments="Modified by Barry Egerter with initial code by Carlos Hasan"
|
||||
VersionCompanyName="Egerter Software"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
3
seal-hack/examples/vb/project1.vbw
Normal file
3
seal-hack/examples/vb/project1.vbw
Normal file
@@ -0,0 +1,3 @@
|
||||
Form1 = 212, 37, 735, 505, C, 23, 44, 546, 512,
|
||||
Audio = 0, 0, 0, 0, C
|
||||
frmSplash = 88, 88, 611, 556, C, 92, 63, 615, 531,
|
||||
230
seal-hack/examples/vb/splash.frm
Normal file
230
seal-hack/examples/vb/splash.frm
Normal file
@@ -0,0 +1,230 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmSplash
|
||||
BorderStyle = 3 'Fixed Dialog
|
||||
ClientHeight = 4245
|
||||
ClientLeft = 255
|
||||
ClientTop = 1410
|
||||
ClientWidth = 7380
|
||||
ClipControls = 0 'False
|
||||
ControlBox = 0 'False
|
||||
Icon = "Splash.frx":0000
|
||||
KeyPreview = -1 'True
|
||||
LinkTopic = "Form2"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 4245
|
||||
ScaleWidth = 7380
|
||||
ShowInTaskbar = 0 'False
|
||||
StartUpPosition = 2 'CenterScreen
|
||||
Begin VB.Frame Frame1
|
||||
Height = 4050
|
||||
Left = 150
|
||||
TabIndex = 0
|
||||
Top = 60
|
||||
Width = 7080
|
||||
Begin VB.Timer Timer1
|
||||
Interval = 1000
|
||||
Left = 6600
|
||||
Top = 3240
|
||||
End
|
||||
Begin VB.Label Label1
|
||||
AutoSize = -1 'True
|
||||
Caption = "Visual Basic Interface"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 15.75
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 360
|
||||
Left = 2400
|
||||
TabIndex = 9
|
||||
Top = 1800
|
||||
Width = 3240
|
||||
End
|
||||
Begin VB.Image imgLogo
|
||||
Height = 2385
|
||||
Left = 360
|
||||
Picture = "Splash.frx":000C
|
||||
Stretch = -1 'True
|
||||
Top = 795
|
||||
Width = 1815
|
||||
End
|
||||
Begin VB.Label lblCopyright
|
||||
Caption = "Copyright 1997"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 4560
|
||||
TabIndex = 4
|
||||
Top = 3060
|
||||
Width = 2415
|
||||
End
|
||||
Begin VB.Label lblCompany
|
||||
Caption = "Egerter Software"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 4560
|
||||
TabIndex = 3
|
||||
Top = 3270
|
||||
Width = 2415
|
||||
End
|
||||
Begin VB.Label lblWarning
|
||||
AutoSize = -1 'True
|
||||
Caption = "Warning - Do not close the application while a song is still playing.......bugs exist!"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 210
|
||||
Left = 600
|
||||
TabIndex = 2
|
||||
Top = 3720
|
||||
Width = 5790
|
||||
End
|
||||
Begin VB.Label lblVersion
|
||||
Alignment = 1 'Right Justify
|
||||
AutoSize = -1 'True
|
||||
Caption = "Version 1.0"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 12
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 285
|
||||
Left = 5580
|
||||
TabIndex = 5
|
||||
Top = 2700
|
||||
Width = 1275
|
||||
End
|
||||
Begin VB.Label lblPlatform
|
||||
Alignment = 1 'Right Justify
|
||||
AutoSize = -1 'True
|
||||
Caption = "for Windows 95/NT"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 15.75
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 360
|
||||
Left = 4020
|
||||
TabIndex = 6
|
||||
Top = 2340
|
||||
Width = 2835
|
||||
End
|
||||
Begin VB.Label lblProductName
|
||||
AutoSize = -1 'True
|
||||
Caption = "Seal 1.03"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 32.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 765
|
||||
Left = 2280
|
||||
TabIndex = 8
|
||||
Top = 1080
|
||||
Width = 2775
|
||||
End
|
||||
Begin VB.Label lblLicenseTo
|
||||
Alignment = 1 'Right Justify
|
||||
Caption = "Licensed to all users of the Egerter Software Web site. Free for home and office use."
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 120
|
||||
TabIndex = 1
|
||||
Top = 240
|
||||
Width = 6855
|
||||
End
|
||||
Begin VB.Label lblCompanyProduct
|
||||
AutoSize = -1 'True
|
||||
Caption = "Carlos Hasan presents"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 18
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 435
|
||||
Left = 1800
|
||||
TabIndex = 7
|
||||
Top = 705
|
||||
Width = 3870
|
||||
End
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmSplash"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Dim counter
|
||||
Option Explicit
|
||||
|
||||
Private Sub Form_KeyPress(KeyAscii As Integer)
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Unload(Cancel As Integer)
|
||||
|
||||
Load Form1
|
||||
Form1.Show
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Frame1_Click()
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub Timer1_Timer()
|
||||
counter = counter + 1
|
||||
If counter > 7 Then
|
||||
Unload Me
|
||||
End If
|
||||
End Sub
|
||||
BIN
seal-hack/examples/vb/splash.frx
Normal file
BIN
seal-hack/examples/vb/splash.frx
Normal file
Binary file not shown.
Reference in New Issue
Block a user