53 Commits

Author SHA1 Message Date
Godzil
61937a1391 Merge branch 'master' into debugger 2021-04-04 22:13:59 +01:00
Godzil
e28317d29e Disable the IO Dump by default. 2021-04-04 21:17:34 +01:00
Godzil
f32928b0c3 Remove -Werror by default and add a cmake option to enable them. 2021-04-04 21:14:53 +01:00
Godzil
e4cf98bfe1 Add a debug function to log all access to IO regs. 2021-04-04 21:05:48 +01:00
Godzil
a89e253d9c Now use glfw/OpenGL for displaying.
Code is a bit crude, but the whole emulator would need a proper refactor at some point anyway.
2021-04-04 20:55:40 +01:00
Godzil
88468d6028 Now build without SDL
But of course, display nothing.
2020-12-12 19:28:21 +00:00
Godzil
875f0edb46 printf can be a pain at time. 2020-11-14 20:30:09 +00:00
Godzil
8bd2170f44 Remove some of the Rotation code.
And add a call placeholder for read_key for now to make the compiler happy.
2020-11-14 20:28:31 +00:00
Godzil
564e0ea2e6 Remove more SDL references 2020-11-14 20:27:58 +00:00
Godzil
8976d4363f Remove SDLptc.h, the "Console" class and related code. 2020-11-14 20:27:25 +00:00
Godzil
f3aca9a3c7 Start working on implementing the video interface.
First disabling/removing all the SDL related function call/variables

Also removing some nonsensical dunction (line doubling and rotation are useless in GL mode)
2020-11-14 20:16:46 +00:00
Godzil
ece8a07dcf Remove SDL refenrence in the non working audio emulation. 2020-11-14 20:15:50 +00:00
Godzil
9035a922c3 Add GLFW in the CMakeLists, and remove all SDL references. 2020-11-14 20:14:57 +00:00
Godzil
02c16b7987 Add glfw as an external module 2020-11-14 19:36:54 +00:00
Godzil
8c79f6f417 Clang should be happy now? 2020-02-11 00:53:32 +00:00
Godzil
2802e64697 clang don't like these unused tables. 2020-02-11 00:42:33 +00:00
Godzil
e8d7d8473e GCC quirkness makes no sense sometimes. 2020-02-11 00:38:17 +00:00
Godzil
ed93d90c51 Make sure we are not forcing to GCC and add a bit of debug.
CMake find the proper lib but not the makefile? WTF
2020-02-11 00:29:34 +00:00
Godzil
6e857bf630 Stupid names ubuntu; "libsdl1.2debian", seriously? 2020-02-11 00:24:04 +00:00
Godzil
62c43f311c Trying to add SDL lib package (seems -dev don't install it) 2020-02-11 00:21:17 +00:00
Godzil
3552bb8bf9 Silly me... 2020-02-11 00:20:36 +00:00
Godzil
466f910c9a Try to also build cmake build. 2020-02-11 00:18:06 +00:00
Godzil
a5ce89d14f Hmmm it was lurking in other places! 2020-02-11 00:17:38 +00:00
Godzil
c26f935072 Interesting that not all GCC versions complain here. 2020-02-11 00:14:36 +00:00
Godzil
4967dcab21 I honestly don't care about the return value of write. 2020-02-11 00:07:16 +00:00
Godzil
a0e5006a18 Add dumpinfo to cmake, and set the CXX standard to C++98 as it should on that project. 2020-02-11 00:05:22 +00:00
Godzil
6d78199031 Update .gitignore 2020-02-11 00:04:42 +00:00
Godzil
6d5658eb68 Make gcc happy (and fix a potential issue) 2020-02-11 00:00:23 +00:00
Godzil
667f655d22 Add preliminary CMake build. Not replacing the makefile for now, will in the future. 2020-02-10 23:59:01 +00:00
Godzil
3e6f096191 Add CMake module to get Git version. 2020-02-10 23:58:18 +00:00
Godzil
0fadff165b Update travis to use latest ubuntu instead of the old 14.04 2020-02-07 18:00:54 +00:00
Godzil
cf80c9624c Add tentative travis build script 2020-02-07 17:58:12 +00:00
Godzil
b5488bacba Add portaudio for futur audio work. 2020-02-07 17:57:59 +00:00
Godzil
778c624664 Early changes to add a x86 debugger. 2020-02-07 17:39:46 +00:00
Godzil
f592057e48 Move everything in the root folder 2020-01-15 19:06:45 +00:00
Godzil
ec2a2f937f Update .gitignore 2020-01-15 19:02:30 +00:00
Godzil
ce85101e38 Remove root makefile. 2020-01-15 18:59:47 +00:00
Godzil
4b8495d443 Remove seal 2020-01-15 18:59:25 +00:00
Godzil
25cb419093 Disable all audio code to remove dependency to Seal. 2020-01-15 18:58:20 +00:00
Godzil
b7eb12dedc Remove more useless things 2020-01-15 18:48:29 +00:00
Godzil
8af626c143 Remove more useless files 2020-01-15 18:47:13 +00:00
Godzil
23088d723a Types cleanup. 2020-01-15 18:44:10 +00:00
Godzil
001cb1c080 Remove non standard flag. 2020-01-15 18:11:39 +00:00
Godzil
dfa4709069 Remove useless files. 2020-01-15 18:10:27 +00:00
Godzil
7583701b79 Don't do stupid things with memory allocation...
Seriously who wrote that code :(
That malloc was never freed.
2020-01-15 18:09:38 +00:00
Godzil
406d3253ba Some more cleanup 2020-01-15 18:08:24 +00:00
Godzil
9f49ce0de4 Add missing new emulate.cpp and emulate.h files
It contain the emulation loop that was in "filter" header files.
2020-01-15 17:53:21 +00:00
Godzil
fa498d40e5 Correct cart EEPROM handling to be more correct and cleaner. 2020-01-15 17:52:33 +00:00
Godzil
1130abeb9c Using mmap for cart sram/eeprom files. 2020-01-15 17:51:25 +00:00
Godzil
ee50803d33 Remove all useless filter and some dead code.
That streamline greatly the emulation code and remove all of that non-sense of code in headers included here and there.
Still lot to be done on that point.
Also update some times to use C99 instead of random from wherever it come from.
2020-01-15 17:49:52 +00:00
Godzil
d264ef17d8 Remove the segfault while exiting (was not really critical, but it's more clean)
For that: stop trying to free memory that was not malloc-ed.
2019-10-28 14:08:43 +00:00
Godzil
384525c9ad Change some **** in seal, and I'm pretty sure there are more of these things around. 2019-10-28 12:05:11 +00:00
Godzil
8b19769069 And change all of that **** of tabs into space here. 2019-10-28 12:04:35 +00:00
189 changed files with 1910 additions and 33740 deletions

21
.gitignore vendored
View File

@@ -5,8 +5,23 @@
*.bin
*.wsc
*~
seal-hack/src/mp
testserial
wonderswan
*.orig
*.rej
rom/
.idea/
*.zip
*.sav
*.iep
*.tags
*#
*.bck
*-
# Executables:
dumpinfo
testserial
wonderswan
# Build folder
cmake-*/
build*/

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "external/portaudio"]
path = external/portaudio
url = https://git.assembla.com/portaudio.git
[submodule "external/glfw"]
path = external/glfw
url = https://github.com/glfw/glfw.git

38
.travis.yml Normal file
View File

@@ -0,0 +1,38 @@
dist: bionic
language: c
os:
- linux
# - osx
#matrix:
# allow_failures:
# - os: osx
addons:
apt:
packages:
- libsdl1.2debian
- libsdl1.2-dev
compiler:
- clang
- gcc
script:
- make
- mkdir build
- cd build
- cmake ..
- make
cache:
directories:
- '$HOME/.sonar/cache'
#before_install:
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
# - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install glew; fi
#install: true
#after_success:
# - bash <(curl -s https://codecov.io/bash)

43
CMakeLists.txt Normal file
View File

@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.1)
# External cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/cmake ${CMAKE_MODULE_PATH})
project("NewOswan")
include(GetGitRevisionDescription)
git_describe(VERSION --tags --dirty=-dirty)
# Include GLFW3
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory("external/glfw")
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
option(WARN_AS_ERROR "Enable warning as error" OFF)
set(COMP_FLAGS "-march=native -Wall -Wextra -Wno-unused-parameter -Wno-unused-result -Wno-write-strings")
if (WARN_AS_ERROR)
set(COMP_FLAGS "${COMP_FLAGS} -Werror")
endif()
set(CMAKE_C_FLAGS ${COMP_FLAGS})
set(CMAKE_CXX_FLAGS ${COMP_FLAGS})
message("-- Building version ${VERSION}")
add_executable(wonderswan main.cpp)
set_property(TARGET wonderswan PROPERTY CXX_STANDARD 98)
target_compile_definitions(wonderswan PUBLIC VERSION="${VERSION}")
target_include_directories(wonderswan PUBLIC source)
add_subdirectory(source)
target_link_libraries(wonderswan wswan glfw ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
add_executable(dumpinfo dumpinfo.c)

View File

@@ -1,7 +1,57 @@
all:
make -C seal-hack
make -C oswan
clean:
make -C seal-hack clean
make -C oswan clean
wonderswan_CXX_SRCS = main.cpp \
source/audio.cpp \
source/gpu.cpp \
source/io.cpp \
source/log.cpp \
source/memory.cpp \
source/emulate.cpp \
source/rom.cpp \
source/ws.cpp \
source/nec/nec.cpp
OBJS = $(wonderswan_CXX_SRCS:.cpp=.o)
all: wonderswan dumpinfo
# CXX = g++
CXXFLAGS = -g -O2 `sdl-config --cflags` -Wall -std=c++98 -Wno-write-strings -Wno-unused-result
OPTIONS = -D_REENTRANT -I. -DVERSION=\"`git describe --tags --long --dirty`\"
LIBRARY_PATH =
SDL_LIBS = `sdl-config --libs`
LIBS = -g $(LIBRARY_PATH) $(SDL_LIBS)
ALLCFLAGS = $(CFLAGS) $(CEXTRA) $(OPTIONS) $(ALLFLAGS)
ALLCXXFLAGS=$(CXXFLAGS) $(CXXEXTRA) $(OPTIONS) $(ALLFLAGS)
CLEAN_FILES = wonderswan
.SUFFIXES: .cpp
main.o: main.cpp
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.cpp.o:
$(CXX) -c $(ALLCXXFLAGS) -o $@ $<
.PHONY: all install uninstall clean distclean depend dummy
$(SUBDIRS:%=%/__clean__): dummy
cd `dirname $@` && $(MAKE) clean
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES:%.exe=%) $(EXES:%=%.so) $(EXES:%=%.spec.o) $(DLLS:%=%.so) $(DLLS:%=%.spec.o)
dumpinfo: dumpinfo.o
$(CXX) $(LIBS) -o $@ $(<)
wonderswan: $(OBJS)
$(CXX) -o $@ $(OBJS) $(LIBS)

View File

@@ -0,0 +1,168 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
#${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
diff-index --quiet HEAD --
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var} "CLEAN" PARENT_SCOPE)
else()
set(${_var} "DIRTY" PARENT_SCOPE)
endif()
endfunction()

View File

@@ -0,0 +1,41 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

1
external/glfw vendored Submodule

Submodule external/glfw added at 0ef149c8f2

1
external/portaudio vendored Submodule

Submodule external/portaudio added at c5d2c51bd6

216
main.cpp Normal file
View File

@@ -0,0 +1,216 @@
///////////////////////////////////////////////////////////////////////////////
// Wonderswan emulator
////////////////////////////////////////////////////////////////////////////////
//
// 13.04.2002: Fixed a small bug causing crashes
//
//
//
//
//////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include "source/log.h"
#include "source/rom.h"
#include "source/nec/nec.h"
#include "source/memory.h"
#include "source/gpu.h"
#include "source/io.h"
#include "source/ws.h"
#include "source/emulate.h"
#include "source/audio.h"
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
#define LOG_PATH "oswan.log"
int gui_command=GUI_COMMAND_NONE;
int gui_mainDialogRunning;
int gui_controls_configuration_Running;
int gui_get_key_Running;
int gui_get_key_key;
int ws_videoEnhancementType=0;
int ws_colourScheme=COLOUR_SCHEME_DEFAULT;
int ws_system=WS_SYSTEM_COLOR;
int sram_path_explicit = 0;
int ieep_path_explicit = 0;
int ws_mk_savpath()
{
char *w;
if (sram_path_explicit)
{
return 0;
}
if (ws_sram_path != NULL)
{
free(ws_sram_path);
}
ws_sram_path = (char *)malloc(strlen(ws_rom_path) + 2);
strcpy(ws_sram_path, ws_rom_path);
w = strrchr(ws_sram_path, '.');
if (NULL == w)
{
strcpy(ws_sram_path, "error.sav");
return 1;
}
strcpy(w, ".sav");
return 0;
}
int ws_mk_ieppath()
{
char *w;
if (ieep_path_explicit)
{
return 0;
}
if (ws_ieep_path != NULL)
{
free(ws_ieep_path);
}
ws_ieep_path = (char *)malloc(strlen(ws_rom_path) + 2);
strcpy(ws_ieep_path, ws_rom_path);
w = strrchr(ws_ieep_path, '.');
if (NULL == w)
{
strcpy(ws_ieep_path, "error.iep");
return 1;
}
strcpy(w, ".iep");
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
if (!log_init(LOG_PATH))
{
printf("Warning: cannot open log file %s\n",LOG_PATH);
}
snprintf(app_window_title, 255, "Oswan %s - Esc to return to GUI", VERSION);
fprintf(log_get(),"Oswan-unix %s (built at: %s %s)\n",VERSION , __DATE__,__TIME__);
ws_system = WS_SYSTEM_COLOR;
ws_rom_path = NULL;
for (int n = 1; n < argc; ++n)
{
if (argv[n][0] == '-')
{
switch(argv[n][1])
{
case 'C':
if (++n < argc)
{
ws_cyclesByLine = atoi(argv[n]);
}
fprintf(log_get(), "Cycles by line set to %d\n", ws_cyclesByLine);
break;
case 'w':
if (++n < argc)
{
ws_system = atoi(argv[n]);
}
fprintf(log_get(), "WonderSwan set to %d\n", ws_system);
break;
case 's':
if (++n < argc)
{
ws_sram_path = argv[n];
}
sram_path_explicit = 1;
break;
default:
break;
}
}
else
{
ws_rom_path = argv[n];
ws_mk_savpath();
ws_mk_ieppath();
}
}
while (!app_terminate)
{
if (!ws_rom_path)
{
app_gameRunning=0;
exit(0);
}
if (ws_rom_path)
{
ws_set_system(ws_system);
if (ws_init(ws_rom_path))
{
app_rotated=ws_rotated();
app_gameRunning=1;
if (ws_system == WS_SYSTEM_COLOR)
{
ws_gpu_operatingInColor=1;
}
ws_set_colour_scheme(ws_colourScheme);
ws_reset();
ws_emulate();
}
ws_done();
}
}
log_done();
return(0);
}

View File

@@ -1,59 +0,0 @@
wonderswan_CXX_SRCS = main.cpp \
source/2xSaI.cpp \
source/audio.cpp \
source/gpu.cpp \
source/io.cpp \
source/log.cpp \
source/memory.cpp \
source/rom.cpp \
source/ws.cpp \
source/nec/nec.cpp
OBJS = $(wonderswan_CXX_SRCS:.cpp=.o)
all: wonderswan dumpinfo
CXX = g++
CXXFLAGS = -g -O2 `sdl-config --cflags` -Wall -Werror -std=c++98 -Wno-write-strings
#-arch i386
OPTIONS = -D_REENTRANT -I. -I../seal-hack/src/ -DVERSION=\"`git describe --tags --long --dirty`\"
LIBRARY_PATH = -L../seal-hack/lib/SDL
LIBS = -g $(LIBRARY_PATH) `sdl-config --libs`
#-arch i386
ALLCFLAGS = $(CFLAGS) $(CEXTRA) $(OPTIONS) $(ALLFLAGS)
ALLCXXFLAGS=$(CXXFLAGS) $(CXXEXTRA) $(OPTIONS) $(ALLFLAGS)
CLEAN_FILES = wonderswan
.SUFFIXES: .cpp
main.o: main.cpp source/filters/2xsai.h source/filters/doubled.h source/filters/filter_partA.h source/filters/filter_partB.h source/filters/filter_partC.h source/filters/filter_partD.h source/filters/filter_partE.h source/filters/halfscanlines.h source/filters/interpolate.h source/filters/scanlines.h source/filters/special.h source/filters/standard.h source/filters/super2xsai.h source/filters/supereagle.h source/SDLptc.h
$(CXX) -c $(ALLCXXFLAGS) -o $@ $<
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
.cpp.o:
$(CXX) -c $(ALLCXXFLAGS) -o $@ $<
.PHONY: all install uninstall clean distclean depend dummy
$(SUBDIRS:%=%/__clean__): dummy
cd `dirname $@` && $(MAKE) clean
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES:%.exe=%) $(EXES:%=%.so) $(EXES:%=%.spec.o) $(DLLS:%=%.so) $(DLLS:%=%.spec.o)
dumpinfo: dumpinfo.o
$(CXX) $(LIBS) -o $@ $(<)
wonderswan: $(OBJS)
$(CXX) $(LIBS) -o $@ $(OBJS) -laudio

View File

@@ -1,32 +0,0 @@
_____ _____ ___ _ __
\ | /___ /\__ ___> /___ /\__ ___ /\__ ___ | |/ / ___
\ / \ // .\/ . \/ . // __\/ _// __>/ . \/. || < / __\
\_____/ \___/\_/\_/\___/ \___/\_/ <___ \\_/\_/\___||_|\_\\___/
--- Wondersnake for WSC -------------\___/----- 09. 11. 2001 ---
This game is Freeware! You are more than welcome to copy it to
your friends or anyone else! Please note that it is not allowed
to charge any money for this game in any case! It is Freeware and
it will stay Freeware!
.................................................................
: Code: Dox dox@space.pl http://cygne.emuunlim.com :
: Gfx: Dox dox@space.pl http://cygne.emuunlim.com :
: Levels: Kojote kojote1980@yahoo.com http://www.pdroms.com :
:...............................................................:
Special "Thank you" goes out to Sir Dragoon for Hardwaretesting!
(Yes... Wondersnake will work on real Hardware!!!) But it will
even work on the latest version of Cygne! URL above...
Since some people were complaining that we forgot to mention them
in some of our previous productions, we want to greet everyone who
knows us ;) ... but Kojote want's to greet his wife "Amina" ;))
We hope you'll enjoy Wondersnake for Wonderswan Color, and if you
like it, please sent Feedback to both of us!
=====================
Regards, Dox & Kojote
=====================

Binary file not shown.

View File

@@ -1,150 +0,0 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG_MAIN DIALOG DISCARDABLE 0, 0, 283, 236
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Oswan 0.70"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "&Load",IDC_BUTTON_LOAD,25,170,80,14
PUSHBUTTON "&Reset",IDC_BUTTON_RESET,110,170,50,14
PUSHBUTTON "&Exit",IDC_BUTTON_EXIT,170,170,85,14
GROUPBOX "Video mode",IDC_STATIC,105,30,60,40
CONTROL "Windowed",IDC_RADIO_WINDOWED,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,111,40,49,10
CONTROL "Fullscreen",IDC_RADIO_FULLSCREEN,"Button",
BS_AUTORADIOBUTTON,111,54,49,10
PUSHBUTTON "L&oad state",IDC_BUTTON_LOADSTATE,170,110,85,14
PUSHBUTTON "&Save state",IDC_BUTTON_SAVESTATE,170,130,85,14
GROUPBOX "Video enhancement",IDC_STATIC,25,30,75,135
CONTROL 102,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN,1,1,281,23
GROUPBOX "System",IDC_STATIC,171,30,85,55
CONTROL "Autodetect",IDC_RADIO_SYSTEM_AUTODETECT,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,175,41,51,10
CONTROL "Wonderswan mono",IDC_RADIO_SYSTEM_MONO,"Button",
BS_AUTORADIOBUTTON,175,54,77,10
CONTROL "Wonderswan color",IDC_RADIO_SYSTEM_COLOR,"Button",
BS_AUTORADIOBUTTON,175,70,75,10
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP | SS_SUNKEN |
WS_BORDER,0,192,283,43
GROUPBOX "Colour scheme",IDC_STATIC,105,75,60,90
CONTROL "Default",IDC_COLOUR_DEFAULT,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,111,86,39,10
CONTROL "Amber",IDC_COLOUR_AMBER,"Button",BS_AUTORADIOBUTTON,111,
100,36,10
CONTROL "Green",IDC_COLOUR_GREEN,"Button",BS_AUTORADIOBUTTON,111,
116,35,10
PUSHBUTTON "&Return to game",IDC_BUTTON_CONTINUE,170,90,85,14
PUSHBUTTON "Co&nfigure controls",IDC_BUTTON_CONTROLS,170,150,85,14,
WS_DISABLED
CONTROL "None",IDC_RADIO_STANDARD_MODE,"Button",
BS_AUTORADIOBUTTON | WS_GROUP,31,41,60,10
CONTROL "Double size",IDC_RADIO_DOUBLESIZE_MODE,"Button",
BS_AUTORADIOBUTTON,31,54,60,10
CONTROL "Scanlines",IDC_RADIO_SCANLINES_MODE,"Button",
BS_AUTORADIOBUTTON,31,70,60,10
CONTROL "50% scanlines",IDC_RADIO_50PRCTSCANLINES_MODE,"Button",
BS_AUTORADIOBUTTON,31,86,60,10
CONTROL "Special",IDC_RADIO_SPECIAL_MODE,"Button",
BS_AUTORADIOBUTTON,31,99,60,10
CONTROL "2xSaI",IDC_RADIO_2XSAI,"Button",BS_AUTORADIOBUTTON,31,
114,60,10
CONTROL "Super 2xSaI",IDC_RADIO_SUPER2XSAI,"Button",
BS_AUTORADIOBUTTON,31,130,60,10
CONTROL "Super Eagle",IDC_RADIO_SUPEREAGLE,"Button",
BS_AUTORADIOBUTTON,31,145,60,10
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 276
TOPMARGIN, 6
BOTTOMMARGIN, 229
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BITMAP1 BITMAP DISCARDABLE "source\\gui\\logo.bmp"
IDB_BITMAP2 BITMAP DISCARDABLE "source\\gui\\sponsor.bmp"
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

View File

@@ -1,841 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
// Wonderswan emulator
////////////////////////////////////////////////////////////////////////////////
//
// 13.04.2002: Fixed a small bug causing crashes
//
//
//
//
//////////////////////////////////////////////////////////////////////////////
/*#include <windows.h>
#include <commctrl.h>
#include <direct.h>*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
//#include "resource.h"
#include "SDL.h"
#include "source/types.h"
#include "source/SDLptc.h"
#include "source/log.h"
#include "source/rom.h"
#include "source/nec/nec.h"
#include "source/memory.h"
#include "source/gpu.h"
#include "source/io.h"
#include "source/ws.h"
#include "source/ticker.h"
#include "source/2xSaI.h"
#include "source/audio.h"
#undef DWORD
#include <audio.h>
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
#define LOG_PATH "oswan.log"
#define KEY_ENTER 0x0D
#define KEY_SPACE 0x20
#define KEY_ESC 0x1b
#define KEY_UP 0x26
#define KEY_DOWN 0x28
#define KEY_LEFT 0x25
#define KEY_RIGHT 0x27
#define KEY_BUTTON1 0x57
#define KEY_BUTTON2 0x58
#define GUI_COMMAND_NONE 0
#define GUI_COMMAND_RESET 1
#define GUI_COMMAND_SCHEME_CHANGE 2
#define GUI_COMMAND_FILTER_CHANGE 3
char app_window_title[256];
int app_gameRunning=0;
int app_terminate=0;
int app_fullscreen=0;
SDL_Event app_input_event;
int app_rotated=0;
int gui_command=GUI_COMMAND_NONE;
int gui_mainDialogRunning;
int gui_controls_configuration_Running;
int gui_get_key_Running;
int gui_get_key_key;
SDL_Joystick *joystick=NULL;
int ws_videoEnhancementType=0;
int ws_colourScheme=COLOUR_SCHEME_DEFAULT;
int ws_system=WS_SYSTEM_COLOR;
char *ws_rom_path;
extern char *ws_sram_path;
int sram_path_explicit = 0;
char old_rom_path[4096];
#if 0
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
char *gui_getRomPath(HWND hWnd)
{
static OPENFILENAME ofn; // common dialog box structure
static char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
static char oldDir[1024];
InitCommonControls();
_getcwd(oldDir,1024);
szFile[0]=0;
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Wonderswan mono\0*.ws\0Wonderswan color\0*.wsc\0\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.hInstance=NULL;
// Display the Open dialog box.
if (GetOpenFileName(&ofn)==TRUE)
{
return(ofn.lpstrFile);
}
chdir(oldDir);
return(NULL);
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
char *gui_loadState(HWND hWnd)
{
static OPENFILENAME ofn; // common dialog box structure
static char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
static char oldDir[1024];
InitCommonControls();
_getcwd(oldDir,1024);
szFile[0]=0;
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Wonderswan state\0*.wss\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.hInstance=NULL;
// Display the Open dialog box.
if (GetOpenFileName(&ofn)==TRUE)
{
return(ofn.lpstrFile);
}
chdir(oldDir);
return(NULL);
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
char *gui_saveState(HWND hWnd)
{
static OPENFILENAME ofn; // common dialog box structure
static char szFile[260]; // buffer for file name
HWND hwnd; // owner window
HANDLE hf; // file handle
static char oldDir[1024];
InitCommonControls();
_getcwd(oldDir,1024);
szFile[0]=0;
// Initialize OPENFILENAME
ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Wonderswan state\0*.wss\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = 0;
ofn.hInstance=NULL;
// Display the Open dialog box.
if (GetSaveFileName(&ofn)==TRUE)
{
return(ofn.lpstrFile);
}
chdir(oldDir);
return(NULL);
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
BOOL CALLBACK GuiMainDialogProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
static BOOL bButton = FALSE;
switch(message)
{
case WM_INITDIALOG:
break;
case WM_CLOSE:
{
gui_mainDialogRunning=0;
DestroyWindow(hWnd);
return 1;
}
case WM_COMMAND:
{
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_LOAD))
{
ws_rom_path=gui_getRomPath(hWnd);
if (ws_rom_path)
{
SendMessage(hWnd, WM_CLOSE, 0,0);
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_SAVESTATE))
{
char *path=gui_saveState(hWnd);
if (path)
{
int err=ws_saveState(path);
if (err==0)
{
MessageBox(hWnd,"State cannot be saved","Error",MB_OK);
}
else
{
SendMessage(hWnd, WM_CLOSE, 0,0);
}
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_LOADSTATE))
{
char *path=gui_loadState(hWnd);
if (path)
{
int err=ws_loadState(path);
if (err==0)
{
MessageBox(hWnd,"State cannot be loaded","Error",MB_OK);
}
else if (err==-1)
{
MessageBox(hWnd,"Please load the correct rom first","Error",MB_OK);
}
else
{
SendMessage(hWnd, WM_CLOSE, 0,0);
}
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_RESET))
{
gui_command=GUI_COMMAND_RESET;
SendMessage(hWnd, WM_CLOSE, 0,0);
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_CONTINUE))
{
SendMessage(hWnd, WM_CLOSE, 0,0);
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_BUTTON_EXIT))
{
SendMessage(hWnd, WM_CLOSE, 0,0);
app_terminate=1;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_STANDARD_MODE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_STANDARD_MODE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=0;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_DOUBLESIZE_MODE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_DOUBLESIZE_MODE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=1;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SCANLINES_MODE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SCANLINES_MODE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=2;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_50PRCTSCANLINES_MODE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_50PRCTSCANLINES_MODE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=3;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SPECIAL_MODE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SPECIAL_MODE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=4;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_2XSAI))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_2XSAI),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=5;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SUPER2XSAI))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SUPER2XSAI),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=6;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SUPEREAGLE))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SUPEREAGLE),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_videoEnhancementType=7;
}
gui_command=GUI_COMMAND_FILTER_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_FULLSCREEN))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_FULLSCREEN),BM_GETCHECK,0,0)==BST_CHECKED)
{
app_fullscreen=1;
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_WINDOWED))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_WINDOWED),BM_GETCHECK,0,0)==BST_CHECKED)
{
app_fullscreen=0;
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_COLOUR_DEFAULT))
{
if (SendMessage(GetDlgItem(hWnd, IDC_COLOUR_DEFAULT),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_colourScheme=COLOUR_SCHEME_DEFAULT;
}
gui_command=GUI_COMMAND_SCHEME_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_COLOUR_AMBER))
{
if (SendMessage(GetDlgItem(hWnd, IDC_COLOUR_AMBER),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_colourScheme=COLOUR_SCHEME_AMBER;
}
gui_command=GUI_COMMAND_SCHEME_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_COLOUR_GREEN))
{
if (SendMessage(GetDlgItem(hWnd, IDC_COLOUR_GREEN),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_colourScheme=COLOUR_SCHEME_GREEN;
}
gui_command=GUI_COMMAND_SCHEME_CHANGE;
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SYSTEM_AUTODETECT))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SYSTEM_AUTODETECT),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_system=WS_SYSTEM_AUTODETECT;
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SYSTEM_COLOR))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SYSTEM_COLOR),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_system=WS_SYSTEM_COLOR;
}
return 1;
}
if ((HIWORD(wParam)==BN_CLICKED)&&(LOWORD(wParam)==IDC_RADIO_SYSTEM_MONO))
{
if (SendMessage(GetDlgItem(hWnd, IDC_RADIO_SYSTEM_MONO),BM_GETCHECK,0,0)==BST_CHECKED)
{
ws_system=WS_SYSTEM_MONO;
}
return 1;
}
}
}
if(message == WM_INITDIALOG)
{
return(TRUE);
}
return (FALSE);
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void gui_open(void)
{
HWND hwnd, hCtrl;
MSG msg;
gui_command=GUI_COMMAND_NONE;
InitCommonControls();
ws_rom_path=NULL;
hwnd = CreateDialog(gui_hInstance, MAKEINTRESOURCE(IDD_DIALOG_MAIN), NULL, (DLGPROC)GuiMainDialogProc);
if (hwnd==NULL)
{
MessageBox(NULL,"Cannot create gui","Error",MB_OK);
return;
}
if (ws_colourScheme==COLOUR_SCHEME_DEFAULT)
{
SendMessage(GetDlgItem(hwnd, IDC_COLOUR_DEFAULT),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_colourScheme==COLOUR_SCHEME_AMBER)
{
SendMessage(GetDlgItem(hwnd, IDC_COLOUR_AMBER),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_colourScheme==COLOUR_SCHEME_GREEN)
{
SendMessage(GetDlgItem(hwnd, IDC_COLOUR_GREEN),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
if (ws_videoEnhancementType==0)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_STANDARD_MODE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==1)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_DOUBLESIZE_MODE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==2)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SCANLINES_MODE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==3)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_50PRCTSCANLINES_MODE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==4)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SPECIAL_MODE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==5)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_2XSAI),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==6)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SUPER2XSAI),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_videoEnhancementType==7)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SUPEREAGLE),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
if (app_fullscreen)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_FULLSCREEN),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_WINDOWED),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
if (ws_system==WS_SYSTEM_AUTODETECT)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SYSTEM_AUTODETECT),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_system==WS_SYSTEM_COLOR)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SYSTEM_COLOR),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
else if (ws_system==WS_SYSTEM_MONO)
{
SendMessage(GetDlgItem(hwnd, IDC_RADIO_SYSTEM_MONO),BM_SETCHECK,(WPARAM)BST_CHECKED,0);
}
gui_mainDialogRunning=1;
ShowWindow(hwnd, SW_SHOWDEFAULT);
UpdateWindow(hwnd);
while(gui_mainDialogRunning)
{
if (GetMessage(&msg, hwnd, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
DestroyWindow(hwnd);
}
#endif
int ws_mk_savpath()
{
char *w;
if (sram_path_explicit)
{
return 0;
}
if (ws_sram_path != NULL)
{
free(ws_sram_path);
}
ws_sram_path = (char *)malloc(strlen(ws_rom_path) + 2);
strcpy(ws_sram_path, ws_rom_path);
w = strrchr(ws_sram_path, '.');
if (NULL == w)
{
strcpy(ws_sram_path, "error.sav");
return 1;
}
strcpy(w, ".sav");
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
#include "./source/filters/standard.h"
#include "./source/filters/doubled.h"
#include "./source/filters/scanlines.h"
#include "./source/filters/halfscanlines.h"
#include "./source/filters/2xsai.h"
#include "./source/filters/super2xsai.h"
#include "./source/filters/supereagle.h"
#include "./source/filters/special.h"
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
atexit(SDL_Quit);
SDL_Init(SDL_INIT_TIMER);
if (!log_init(LOG_PATH))
{
printf("Warning: cannot open log file %s\n",LOG_PATH);
}
snprintf(app_window_title, 255, "Oswan %s - Esc to return to GUI", VERSION);
fprintf(log_get(),"Oswan-unix %s (built at: %s %s)\n",VERSION , __DATE__,__TIME__);
ws_videoEnhancementType=1;
//ws_system = WS_SYSTEM_AUTODETECT;
ws_system = WS_SYSTEM_COLOR;
Init_2xSaI(555);
ws_rom_path = NULL;
/*gui_hInstance=hInstance;
gui_open();*/
// the hard-core UI, a command line:
for (int n = 1; n < argc; ++n)
{
if (argv[n][0] == '-')
{
switch(argv[n][1])
{
case 'E':
if (++n < argc)
{
ws_videoEnhancementType = atoi(argv[n]);
}
else
{
fprintf(stderr, "\n0 - plain\n1 - doubled\n2 - scanlines\n3 - 1/2 bright scanlines\n4 - \"special\"\n5 - 2xSaI\n6 - Super2xSaI (default)\n7 - SuperEagle\n\n");
exit(1);
}
break;
case 'C':
if (++n < argc)
{
ws_cyclesByLine = atoi(argv[n]);
}
fprintf(log_get(), "Cycles by line set to %d\n", ws_cyclesByLine);
break;
case 'w':
if (++n < argc)
{
ws_system = atoi(argv[n]);
}
fprintf(log_get(), "WonderSwan set to %d\n", ws_system);
break;
case 's':
if (++n < argc)
{
ws_sram_path = argv[n];
}
sram_path_explicit = 1;
break;
default:
break;
}
}
else
{
ws_rom_path = argv[n];
ws_mk_savpath();
}
}
while (!app_terminate)
{
if (!ws_rom_path)
{
app_gameRunning=0;
//gui_open();
exit(0); // nothing to wait for at the moment...
}
if (ws_rom_path)
{
ws_set_system(ws_system);
if (ws_init(ws_rom_path))
{
app_rotated=ws_rotated();
app_gameRunning=1;
if (ws_system == WS_SYSTEM_COLOR)
{
ws_gpu_operatingInColor=1;
}
ws_set_colour_scheme(ws_colourScheme);
ws_buildHalfBrightnessTable();
ws_reset();
switch (ws_videoEnhancementType)
{
case 0:
ws_emulate_standard();
break;
case 1:
ws_emulate_doubled();
break;
case 2:
ws_emulate_scanlines();
break;
case 3:
ws_emulate_halfBrightnessScanlines();
break;
case 4:
ws_emulate_special();
break;
case 5:
ws_emulate_2xSaI();
break;
case 6:
ws_emulate_Super2xSaI();
break;
case 7:
ws_emulate_SuperEagle();
break;
}
}
ws_done();
}
}
log_done();
return(0);
}

View File

@@ -1,940 +0,0 @@
/*
* Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
*
* (c) Copyright 1996 - 2001 Gary Henderson (gary@daniver.demon.co.uk) and
* Jerremy Koot (jkoot@snes9x.com)
*
* Super FX C emulator code
* (c) Copyright 1997 - 1999 Ivar (Ivar@snes9x.com) and
* Gary Henderson.
* Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
*
* DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
* C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
* C4 C code (c) Copyright 2001 Gary Henderson (gary@daniver.demon.co.uk).
*
* DOS port code contains the works of other authors. See headers in
* individual files.
*
* Snes9x homepage: www.snes9x.com
*
* Permission to use, copy, modify and distribute Snes9x in both binary and
* source form, for non-commercial purposes, is hereby granted without fee,
* providing that this license information and copyright notice appear with
* all copies and any derived work.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event shall the authors be held liable for any damages
* arising from the use of this software.
*
* Snes9x is freeware for PERSONAL USE only. Commercial users should
* seek permission of the copyright holders first. Commercial use includes
* charging money for Snes9x or software derived from Snes9x.
*
* The copyright holders request that bug fixes and improvements to the code
* should be forwarded to them so everyone can benefit from the modifications
* in future versions.
*
* Super NES and Super Nintendo Entertainment System are trademarks of
* Nintendo Co., Limited and its subsidiary companies.
*/
#include "types.h"
#include "2xSaI.h"
static u32 colorMask = 0xF7DEF7DE;
static u32 lowPixelMask = 0x08210821;
static u32 qcolorMask = 0xE79CE79C;
static u32 qlowpixelMask = 0x18631863;
static u32 redblueMask = 0xF81F;
static u32 greenMask = 0x7E0;
int Init_2xSaI(u32 BitFormat)
{
if (BitFormat == 565)
{
colorMask = 0xF7DEF7DE;
lowPixelMask = 0x08210821;
qcolorMask = 0xE79CE79C;
qlowpixelMask = 0x18631863;
redblueMask = 0xF81F;
greenMask = 0x7E0;
}
else if (BitFormat == 555)
{
colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421;
qcolorMask = 0x739C739C;
qlowpixelMask = 0x0C630C63;
redblueMask = 0x7C1F;
greenMask = 0x3E0;
}
else
{
return 0;
}
return 1;
}
static inline int GetResult1 (u32 A, u32 B, u32 C, u32 D,
u32 /* E */)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C)
{
x += 1;
}
else if (B == C)
{
y += 1;
}
if (A == D)
{
x += 1;
}
else if (B == D)
{
y += 1;
}
if (x <= 1)
{
r += 1;
}
if (y <= 1)
{
r -= 1;
}
return r;
}
static inline int GetResult2 (u32 A, u32 B, u32 C, u32 D,
u32 /* E */)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C)
{
x += 1;
}
else if (B == C)
{
y += 1;
}
if (A == D)
{
x += 1;
}
else if (B == D)
{
y += 1;
}
if (x <= 1)
{
r -= 1;
}
if (y <= 1)
{
r += 1;
}
return r;
}
static inline int GetResult (u32 A, u32 B, u32 C, u32 D)
{
int x = 0;
int y = 0;
int r = 0;
if (A == C)
{
x += 1;
}
else if (B == C)
{
y += 1;
}
if (A == D)
{
x += 1;
}
else if (B == D)
{
y += 1;
}
if (x <= 1)
{
r += 1;
}
if (y <= 1)
{
r -= 1;
}
return r;
}
static inline u32 INTERPOLATE (u32 A, u32 B)
{
if (A != B)
{
return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) +
(A & B & lowPixelMask));
}
else
{
return A;
}
}
static inline u32 Q_INTERPOLATE (u32 A, u32 B, u32 C, u32 D)
{
register u32 x = ((A & qcolorMask) >> 2) +
((B & qcolorMask) >> 2) +
((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2);
register u32 y = (A & qlowpixelMask) +
(B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask);
y = (y >> 2) & qlowpixelMask;
return x + y;
}
#define BLUE_MASK565 0x001F001F
#define RED_MASK565 0xF800F800
#define GREEN_MASK565 0x07E007E0
#define BLUE_MASK555 0x001F001F
#define RED_MASK555 0x7C007C00
#define GREEN_MASK555 0x03E003E0
void Super2xSaI (u8 *srcPtr, u32 srcPitch,
u8 *deltaPtr, u8 *dstPtr, u32 dstPitch,
int width, int height)
{
u16 *bP;
u8 *dP;
u32 inc_bP;
u32 Nextline = srcPitch >> 1;
{
inc_bP = 1;
for (; height; height--)
{
bP = (u16 *) srcPtr;
dP = (u8 *) dstPtr;
for (u32 finish = width; finish; finish -= inc_bP)
{
u32 color4, color5, color6;
u32 color1, color2, color3;
u32 colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3, colorS1, colorS2;
u32 product1a, product1b, product2a, product2b;
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
colorB0 = *(bP - Nextline - 1);
colorB1 = *(bP - Nextline);
colorB2 = *(bP - Nextline + 1);
colorB3 = *(bP - Nextline + 2);
color4 = *(bP - 1);
color5 = *(bP);
color6 = *(bP + 1);
colorS2 = *(bP + 2);
color1 = *(bP + Nextline - 1);
color2 = *(bP + Nextline);
color3 = *(bP + Nextline + 1);
colorS1 = *(bP + Nextline + 2);
colorA0 = *(bP + Nextline + Nextline - 1);
colorA1 = *(bP + Nextline + Nextline);
colorA2 = *(bP + Nextline + Nextline + 1);
colorA3 = *(bP + Nextline + Nextline + 2);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GetResult (color6, color5, color1, colorA1);
r += GetResult (color6, color5, color4, colorB1);
r += GetResult (color6, color5, colorA2, colorS1);
r += GetResult (color6, color5, colorB2, colorS2);
if (r > 0)
{
product2b = product1b = color6;
}
else if (r < 0)
{
product2b = product1b = color5;
}
else
{
product2b = product1b = INTERPOLATE (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1
&& color2 != colorA2 && color3 != colorA0)
product2b =
Q_INTERPOLATE (color3, color3, color3, color2);
else if (color5 == color2 && color2 == colorA2
&& colorA1 != color3 && color2 != colorA3)
product2b =
Q_INTERPOLATE (color2, color2, color2, color3);
else
{
product2b = INTERPOLATE (color2, color3);
}
if (color6 == color3 && color6 == colorB1
&& color5 != colorB2 && color6 != colorB0)
product1b =
Q_INTERPOLATE (color6, color6, color6, color5);
else if (color5 == color2 && color5 == colorB2
&& colorB1 != color6 && color5 != colorB3)
product1b =
Q_INTERPOLATE (color6, color5, color5, color5);
else
{
product1b = INTERPOLATE (color5, color6);
}
}
if (color5 == color3 && color2 != color6 && color4 == color5
&& color5 != colorA2)
{
product2a = INTERPOLATE (color2, color5);
}
else if (color5 == color1 && color6 == color5
&& color4 != color2 && color5 != colorA0)
{
product2a = INTERPOLATE (color2, color5);
}
else
{
product2a = color2;
}
if (color2 == color6 && color5 != color3 && color1 == color2
&& color2 != colorB2)
{
product1a = INTERPOLATE (color2, color5);
}
else if (color4 == color2 && color3 == color2
&& color1 != color5 && color2 != colorB0)
{
product1a = INTERPOLATE (color2, color5);
}
else
{
product1a = color5;
}
product1a = product1a | (product1b << 16);
product2a = product2a | (product2b << 16);
*((u32 *) dP) = product1a;
*((u32 *) (dP + dstPitch)) = product2a;
bP += inc_bP;
dP += sizeof (u32);
} // end of for ( finish= width etc..)
srcPtr += srcPitch;
dstPtr += dstPitch * 2;
// deltaPtr += srcPitch;
} // endof: for (; height; height--)
}
}
void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *dP;
u16 *bP;
//u16 *xP;
u32 inc_bP;
{
inc_bP = 1;
u32 Nextline = srcPitch >> 1;
for (; height; height--)
{
bP = (u16 *) srcPtr;
// xP = (u16 *) deltaPtr;
dP = dstPtr;
for (u32 finish = width; finish; finish -= inc_bP)
{
u32 color4, color5, color6;
u32 color1, color2, color3;
u32 colorA1, colorA2, colorB1, colorB2, colorS1, colorS2;
u32 product1a, product1b, product2a, product2b;
colorB1 = *(bP - Nextline);
colorB2 = *(bP - Nextline + 1);
color4 = *(bP - 1);
color5 = *(bP);
color6 = *(bP + 1);
colorS2 = *(bP + 2);
color1 = *(bP + Nextline - 1);
color2 = *(bP + Nextline);
color3 = *(bP + Nextline + 1);
colorS1 = *(bP + Nextline + 2);
colorA1 = *(bP + Nextline + Nextline);
colorA2 = *(bP + Nextline + Nextline + 1);
// --------------------------------------
if (color2 == color6 && color5 != color3)
{
product1b = product2a = color2;
if ((color1 == color2) || (color6 == colorB2))
{
product1a = INTERPOLATE (color2, color5);
product1a = INTERPOLATE (color2, product1a);
// product1a = color2;
}
else
{
product1a = INTERPOLATE (color5, color6);
}
if ((color6 == colorS2) || (color2 == colorA1))
{
product2b = INTERPOLATE (color2, color3);
product2b = INTERPOLATE (color2, product2b);
// product2b = color2;
}
else
{
product2b = INTERPOLATE (color2, color3);
}
}
else if (color5 == color3 && color2 != color6)
{
product2b = product1a = color5;
if ((colorB1 == color5) || (color3 == colorS1))
{
product1b = INTERPOLATE (color5, color6);
product1b = INTERPOLATE (color5, product1b);
// product1b = color5;
}
else
{
product1b = INTERPOLATE (color5, color6);
}
if ((color3 == colorA2) || (color4 == color5))
{
product2a = INTERPOLATE (color5, color2);
product2a = INTERPOLATE (color5, product2a);
// product2a = color5;
}
else
{
product2a = INTERPOLATE (color2, color3);
}
}
else if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GetResult (color6, color5, color1, colorA1);
r += GetResult (color6, color5, color4, colorB1);
r += GetResult (color6, color5, colorA2, colorS1);
r += GetResult (color6, color5, colorB2, colorS2);
if (r > 0)
{
product1b = product2a = color2;
product1a = product2b = INTERPOLATE (color5, color6);
}
else if (r < 0)
{
product2b = product1a = color5;
product1b = product2a = INTERPOLATE (color5, color6);
}
else
{
product2b = product1a = color5;
product1b = product2a = color2;
}
}
else
{
product2b = product1a = INTERPOLATE (color2, color6);
product2b =
Q_INTERPOLATE (color3, color3, color3, product2b);
product1a =
Q_INTERPOLATE (color5, color5, color5, product1a);
product2a = product1b = INTERPOLATE (color5, color3);
product2a =
Q_INTERPOLATE (color2, color2, color2, product2a);
product1b =
Q_INTERPOLATE (color6, color6, color6, product1b);
// product1a = color5;
// product1b = color6;
// product2a = color2;
// product2b = color3;
}
product1a = product1a | (product1b << 16);
product2a = product2a | (product2b << 16);
*((u32 *) dP) = product1a;
*((u32 *) (dP + dstPitch)) = product2a;
// *xP = color5;
bP += inc_bP;
// xP += inc_bP;
dP += sizeof (u32);
} // end of for ( finish= width etc..)
srcPtr += srcPitch;
dstPtr += dstPitch * 2;
// deltaPtr += srcPitch;
} // endof: for (height; height; height--)
}
}
void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *dP;
u16 *bP;
u32 inc_bP;
{
inc_bP = 1;
u32 Nextline = srcPitch >> 1;
for (; height; height--)
{
bP = (u16 *) srcPtr;
dP = dstPtr;
for (u32 finish = width; finish; finish -= inc_bP)
{
register u32 colorA, colorB;
u32 colorC, colorD,
colorE, colorF, colorG, colorH,
colorI, colorJ, colorK, colorL,
colorM, colorN, colorO, colorP;
u32 product, product1, product2;
//---------------------------------------
// Map of the pixels: I|E F|J
// G|A B|K
// H|C D|L
// M|N O|P
colorI = *(bP - Nextline - 1);
colorE = *(bP - Nextline);
colorF = *(bP - Nextline + 1);
colorJ = *(bP - Nextline + 2);
colorG = *(bP - 1);
colorA = *(bP);
colorB = *(bP + 1);
colorK = *(bP + 2);
colorH = *(bP + Nextline - 1);
colorC = *(bP + Nextline);
colorD = *(bP + Nextline + 1);
colorL = *(bP + Nextline + 2);
colorM = *(bP + Nextline + Nextline - 1);
colorN = *(bP + Nextline + Nextline);
colorO = *(bP + Nextline + Nextline + 1);
colorP = *(bP + Nextline + Nextline + 2);
if ((colorA == colorD) && (colorB != colorC))
{
if (((colorA == colorE) && (colorB == colorL)) ||
((colorA == colorC) && (colorA == colorF)
&& (colorB != colorE) && (colorB == colorJ)))
{
product = colorA;
}
else
{
product = INTERPOLATE (colorA, colorB);
}
if (((colorA == colorG) && (colorC == colorO)) ||
((colorA == colorB) && (colorA == colorH)
&& (colorG != colorC) && (colorC == colorM)))
{
product1 = colorA;
}
else
{
product1 = INTERPOLATE (colorA, colorC);
}
product2 = colorA;
}
else if ((colorB == colorC) && (colorA != colorD))
{
if (((colorB == colorF) && (colorA == colorH)) ||
((colorB == colorE) && (colorB == colorD)
&& (colorA != colorF) && (colorA == colorI)))
{
product = colorB;
}
else
{
product = INTERPOLATE (colorA, colorB);
}
if (((colorC == colorH) && (colorA == colorF)) ||
((colorC == colorG) && (colorC == colorD)
&& (colorA != colorH) && (colorA == colorI)))
{
product1 = colorC;
}
else
{
product1 = INTERPOLATE (colorA, colorC);
}
product2 = colorB;
}
else if ((colorA == colorD) && (colorB == colorC))
{
if (colorA == colorB)
{
product = colorA;
product1 = colorA;
product2 = colorA;
}
else
{
register int r = 0;
product1 = INTERPOLATE (colorA, colorC);
product = INTERPOLATE (colorA, colorB);
r +=
GetResult1 (colorA, colorB, colorG, colorE,
colorI);
r +=
GetResult2 (colorB, colorA, colorK, colorF,
colorJ);
r +=
GetResult2 (colorB, colorA, colorH, colorN,
colorM);
r +=
GetResult1 (colorA, colorB, colorL, colorO,
colorP);
if (r > 0)
{
product2 = colorA;
}
else if (r < 0)
{
product2 = colorB;
}
else
{
product2 =
Q_INTERPOLATE (colorA, colorB, colorC,
colorD);
}
}
}
else
{
product2 = Q_INTERPOLATE (colorA, colorB, colorC, colorD);
if ((colorA == colorC) && (colorA == colorF)
&& (colorB != colorE) && (colorB == colorJ))
{
product = colorA;
}
else if ((colorB == colorE) && (colorB == colorD)
&& (colorA != colorF) && (colorA == colorI))
{
product = colorB;
}
else
{
product = INTERPOLATE (colorA, colorB);
}
if ((colorA == colorB) && (colorA == colorH)
&& (colorG != colorC) && (colorC == colorM))
{
product1 = colorA;
}
else if ((colorC == colorG) && (colorC == colorD)
&& (colorA != colorH) && (colorA == colorI))
{
product1 = colorC;
}
else
{
product1 = INTERPOLATE (colorA, colorC);
}
}
product = colorA | (product << 16);
product1 = product1 | (product2 << 16);
*((s32 *) dP) = product;
*((u32 *) (dP + dstPitch)) = product1;
bP += inc_bP;
dP += sizeof (u32);
} // end of for ( finish= width etc..)
srcPtr += srcPitch;
dstPtr += dstPitch * 2;
// deltaPtr += srcPitch;
} // endof: for (height; height; height--)
}
}
static u32 Bilinear (u32 A, u32 B, u32 x)
{
unsigned long areaA, areaB;
unsigned long result;
if (A == B)
{
return A;
}
areaB = (x >> 11) & 0x1f; // reduce 16 bit fraction to 5 bits
areaA = 0x20 - areaB;
A = (A & redblueMask) | ((A & greenMask) << 16);
B = (B & redblueMask) | ((B & greenMask) << 16);
result = ((areaA * A) + (areaB * B)) >> 5;
return (result & redblueMask) | ((result >> 16) & greenMask);
}
static u32 Bilinear4 (u32 A, u32 B, u32 C, u32 D, u32 x,
u32 y)
{
unsigned long areaA, areaB, areaC, areaD;
unsigned long result, xy;
x = (x >> 11) & 0x1f;
y = (y >> 11) & 0x1f;
xy = (x * y) >> 5;
A = (A & redblueMask) | ((A & greenMask) << 16);
B = (B & redblueMask) | ((B & greenMask) << 16);
C = (C & redblueMask) | ((C & greenMask) << 16);
D = (D & redblueMask) | ((D & greenMask) << 16);
areaA = 0x20 + xy - x - y;
areaB = x - xy;
areaC = y - xy;
areaD = xy;
result = ((areaA * A) + (areaB * B) + (areaC * C) + (areaD * D)) >> 5;
return (result & redblueMask) | ((result >> 16) & greenMask);
}
void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch,
u32 dstWidth, u32 dstHeight, int width, int height)
{
u8 *dP;
u16 *bP;
u32 w;
u32 h;
u32 dw;
u32 dh;
u32 hfinish;
u32 wfinish;
u32 Nextline = srcPitch >> 1;
wfinish = (width - 1) << 16; // convert to fixed point
dw = wfinish / (dstWidth - 1);
hfinish = (height - 1) << 16; // convert to fixed point
dh = hfinish / (dstHeight - 1);
for (h = 0; h < hfinish; h += dh)
{
u32 y1, y2;
y1 = h & 0xffff; // fraction part of fixed point
bP = (u16 *) (srcPtr + ((h >> 16) * srcPitch));
dP = dstPtr;
y2 = 0x10000 - y1;
w = 0;
for (; w < wfinish;)
{
u32 A, B, C, D;
u32 E, F, G, H;
u32 I, J, K, L;
u32 x1, x2, a1, f1, f2;
u32 position, product1;
position = w >> 16;
A = bP[position]; // current pixel
B = bP[position + 1]; // next pixel
C = bP[position + Nextline];
D = bP[position + Nextline + 1];
E = bP[position - Nextline];
F = bP[position - Nextline + 1];
G = bP[position - 1];
H = bP[position + Nextline - 1];
I = bP[position + 2];
J = bP[position + Nextline + 2];
K = bP[position + Nextline + Nextline];
L = bP[position + Nextline + Nextline + 1];
x1 = w & 0xffff; // fraction part of fixed point
x2 = 0x10000 - x1;
/*0*/
if (A == B && C == D && A == C)
{
product1 = A;
}
else /*1*/ if (A == D && B != C)
{
f1 = (x1 >> 1) + (0x10000 >> 2);
f2 = (y1 >> 1) + (0x10000 >> 2);
if (y1 <= f1 && A == J && A != E) // close to B
{
a1 = f1 - y1;
product1 = Bilinear (A, B, a1);
}
else if (y1 >= f1 && A == G && A != L) // close to C
{
a1 = y1 - f1;
product1 = Bilinear (A, C, a1);
}
else if (x1 >= f2 && A == E && A != J) // close to B
{
a1 = x1 - f2;
product1 = Bilinear (A, B, a1);
}
else if (x1 <= f2 && A == L && A != G) // close to C
{
a1 = f2 - x1;
product1 = Bilinear (A, C, a1);
}
else if (y1 >= x1) // close to C
{
a1 = y1 - x1;
product1 = Bilinear (A, C, a1);
}
else if (y1 <= x1) // close to B
{
a1 = x1 - y1;
product1 = Bilinear (A, B, a1);
}
}
else
/*2*/
if (B == C && A != D)
{
f1 = (x1 >> 1) + (0x10000 >> 2);
f2 = (y1 >> 1) + (0x10000 >> 2);
if (y2 >= f1 && B == H && B != F) // close to A
{
a1 = y2 - f1;
product1 = Bilinear (B, A, a1);
}
else if (y2 <= f1 && B == I && B != K) // close to D
{
a1 = f1 - y2;
product1 = Bilinear (B, D, a1);
}
else if (x2 >= f2 && B == F && B != H) // close to A
{
a1 = x2 - f2;
product1 = Bilinear (B, A, a1);
}
else if (x2 <= f2 && B == K && B != I) // close to D
{
a1 = f2 - x2;
product1 = Bilinear (B, D, a1);
}
else if (y2 >= x1) // close to A
{
a1 = y2 - x1;
product1 = Bilinear (B, A, a1);
}
else if (y2 <= x1) // close to D
{
a1 = x1 - y2;
product1 = Bilinear (B, D, a1);
}
}
/*3*/
else
{
product1 = Bilinear4 (A, B, C, D, x1, y1);
}
//end First Pixel
*(u32 *) dP = product1;
dP += 2;
w += dw;
}
dstPtr += dstPitch;
}
}

View File

@@ -1,22 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __2XSAI_H__
#define __2XSAI_H__
int Init_2xSaI(u32 BitFormat);
void Super2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height);
void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height);
void _2xSaI (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr, u8 *dstPtr, u32 dstPitch, int width, int height);
void Scale_2xSaI (u8 *srcPtr, u32 srcPitch, u8 * /*deltaPtr */, u8 *dstPtr, u32 dstPitch, u32 dstWidth, u32 dstHeight, int width, int height);
#endif

View File

@@ -1,317 +0,0 @@
/* Some simple emulation classes to get PTC code running on SDL */
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
typedef Uint8 char8;
typedef Sint32 int32;
#define randomize() srand(time(NULL))
#define random(max) (rand()%(max))
#ifndef stricmp
#define stricmp strcasecmp
#endif
class Error
{
public:
Error(const char *message)
{
strcpy(_message, message);
}
void report(void)
{
printf("Error: %s\n", _message);
}
private:
char _message[1024];
};
class Area
{
public:
Area(int left, int top, int right, int bottom)
{
_left = left;
_top = top;
_right = right;
_bottom = bottom;
}
int left(void) const
{
return(_left);
}
int right(void) const
{
return(_right);
}
int top(void) const
{
return(_top);
}
int bottom(void) const
{
return(_bottom);
}
int width(void) const
{
return(_right-_left);
}
int height(void) const
{
return(_bottom-_top);
}
private:
int _left, _top, _right, _bottom;
};
class Format
{
public:
Format(int bpp, int maskR = 0, int maskG = 0, int maskB = 0)
{
_bpp = bpp;
_maskR = maskR;
_maskG = maskG;
_maskB = maskB;
}
Uint8 BPP(void) const
{
return(_bpp);
}
Uint32 MaskR(void) const
{
return(_maskR);
}
Uint32 MaskG(void) const
{
return(_maskG);
}
Uint32 MaskB(void) const
{
return(_maskB);
}
private:
Uint8 _bpp;
Uint32 _maskR, _maskG, _maskB;
};
class Surface
{
public:
Surface(int w, int h, const Format &format)
{
surface = SDL_AllocSurface(SDL_SWSURFACE, w, h, format.BPP(),
format.MaskR(),format.MaskG(),format.MaskB(),0);
if ( surface == NULL )
{
throw Error(SDL_GetError());
}
nupdates = 0;
is_console = 0;
}
Surface(void)
{
nupdates = 0;
is_console = 1;
}
virtual ~Surface()
{
if ( ! is_console )
{
SDL_FreeSurface(surface);
}
}
virtual int width(void)
{
return surface->w;
}
virtual int height(void)
{
return surface->h;
}
virtual int pitch(void)
{
return surface->pitch;
}
virtual void palette(int32 *pcolors)
{
SDL_Color colors[256];
for ( int i=0; i<256; ++i )
{
colors[i].r = (pcolors[i]>>16)&0xFF;
colors[i].g = (pcolors[i]>>8)&0xFF;
colors[i].b = (pcolors[i]>>0)&0xFF;
}
SDL_SetColors(surface, colors, 0, 256);
}
virtual void *lock(void)
{
if ( SDL_MUSTLOCK(surface) )
{
while ( SDL_LockSurface(surface) < 0 )
{
SDL_Delay(10);
}
}
return (Uint8 *)surface->pixels;
}
virtual void unlock(void)
{
if ( SDL_MUSTLOCK(surface) )
{
SDL_UnlockSurface(surface);
}
}
virtual void copy(Surface &dst,
const Area &srcarea, const Area &dstarea)
{
SDL_Rect srcrect, dstrect;
srcrect.x = srcarea.left();
srcrect.y = srcarea.top();
srcrect.w = srcarea.width();
srcrect.h = srcarea.height();
dstrect.x = dstarea.left();
dstrect.y = dstarea.top();
dstrect.w = dstarea.width();
dstrect.h = dstarea.height();
SDL_BlitSurface(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
virtual void copy(Surface &dst)
{
SDL_Rect srcrect, dstrect;
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = surface->w;
srcrect.h = surface->h;
dstrect.x = 0;
dstrect.y = 0;
dstrect.w = surface->w;
dstrect.h = surface->h;
SDL_LowerBlit(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
virtual void update(void)
{
SDL_UpdateRects(surface, nupdates, updates);
nupdates = 0;
}
protected:
SDL_Surface *surface;
int nupdates;
SDL_Rect updates[1]; /* Definitely increase this.. */
int is_console;
};
class Console : public Surface
{
int fullscreen;
public:
Console() : Surface()
{
fullscreen=0;
}
~Console()
{
SDL_Quit();
}
void close(void)
{
SDL_Quit();
}
void option(char *option)
{
if (!stricmp(option,"fullscreen output"))
{
fullscreen=1;
}
else if (!stricmp(option,"windowed output"))
{
fullscreen=0;
}
}
void open(const char *title, int width, int height, const Format &format)
{
Uint32 flags;
if ( SDL_InitSubSystem(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 )
{
throw Error(SDL_GetError());
}
//flags = (SDL_HWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN);
flags = (SDL_HWSURFACE|SDL_HWPALETTE);
if (fullscreen)
{
flags|=SDL_FULLSCREEN;
}
surface = SDL_SetVideoMode(width, height, 0, flags);
if ( surface == NULL )
{
throw Error(SDL_GetError());
}
SDL_WM_SetCaption(title, title);
}
int key(void)
{
SDL_Event event;
int keyevent;
keyevent = 0;
while ( SDL_PollEvent(&event) )
{
/* Real key events trigger this function */
if ( event.type == SDL_KEYDOWN )
{
keyevent = 1;
}
/* So do quit events -- let the app know about it */
if ( event.type == SDL_QUIT )
{
keyevent = 1;
}
}
return(keyevent);
}
private:
};

View File

@@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_2xSaI(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,325 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
__inline void ws_drawDoubledScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=8)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
__inline void ws_drawDoubledRotatedScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=8)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
uint16 ws_halfBrightnessTable[32];
#define M_HALFBRIGHTNESS(D) (ws_halfBrightnessTable[(D>>10)&0x1f]<<10)|(ws_halfBrightnessTable[(D>>5)&0x1f]<<5)|(ws_halfBrightnessTable[D&0x1f]);
__inline void ws_drawDoubledHalfBrightnessScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessScanlineSpecialEven(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessScanlineSpecialOdd(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanlineSpecialEven(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_doubled(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,15 +0,0 @@
//Sint32 startTime, endTime, totalFrames;
//Uint32 nNormalLast=0;
//Sint32 nNormalFrac=0;
//Sint32 nTime=0,
Sint32 nCount=0;
int i=0;
double dTime = 0.0, dNormalLast = 0.0, dTemp;
Sint32 surfacePitch;
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;

View File

@@ -1,29 +0,0 @@
int16 *backbuffer=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer,0x00,224*144*sizeof(int16));
surfacePitch=(surface->pitch()>>1);
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");
//totalFrames=0;
//startTime=clock();
//nNormalLast=0;// Last value of timeGetTime()
//nNormalFrac=0; // Extra fraction we did
//nNormalLast=timeGetTime();
// hopefully, we only care about time delta, not time of day...
//nNormalLast = SDL_GetTicks();
dNormalLast = (double) SDL_GetTicks();
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}

View File

@@ -1,100 +0,0 @@
//nTime=SDL_GetTicks()-nNormalLast; // calcule le temps <20>coul<75> depuis le dernier affichage
dTemp = (double) SDL_GetTicks();
dTime = dTemp - dNormalLast;
// nTime est en mili-secondes.
// d<>termine le nombre de trames <20> passer + 1
//nCount = (Sint32) ((((double)nTime)*600.0 - (double)nNormalFrac) / 10000.0);
nCount = (Sint32) (dTime * 0.07547); // does this calculation make sense?
// 75.47Hz vblank is according to wstech22.txt
//printf("%d ", nCount);
// si le nombre de trames <20> passer + 1 est nul ou n<>gatif,
// ne rien faire pendant 2 ms
//AUpdateAudio();
if (nCount<=0)
{
SDL_Delay(2);
} // No need to do anything for a bit
else
{
//nNormalFrac+=nCount*10000; //
//nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
//nNormalFrac%=600; //
//dNormalLast = dTemp;
dNormalLast += nCount * (1/0.07547);
// Pas plus de 9 (10-1) trames non affich<63>es
if (nCount>10)
{
nCount=10;
}
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/
int ws_key_esc=0;
#include "source/temp/key.h"
if (ws_key_esc)
{
console.close();
if (ws_rom_path)
{
strcpy(old_rom_path,ws_rom_path);
}
//gui_open();
#ifndef GUI_OPEN_WARNED
//#warning XXX something ought to take place here...
#define GUI_OPEN_WARNED
#endif
app_terminate = 1;
if ((ws_rom_path!=NULL)||(app_terminate))
{
break;
}
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
{
ws_reset();
}
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
{
ws_set_colour_scheme(ws_colourScheme);
}
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");

View File

@@ -1,11 +0,0 @@
}
for (i=0; i<nCount-1; i++)
while (!ws_executeLine(backbuffer,0));
while (!ws_executeLine(backbuffer,1));
//totalFrames++;

View File

@@ -1,4 +0,0 @@
//endTime=clock();
//float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
console.close();
delete surface;

View File

@@ -1,97 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_buildHalfBrightnessTable(void)
{
for (int i=0; i<32; i++)
{
ws_halfBrightnessTable[i]=0.65*i;
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_halfBrightnessScanlines(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,231 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
#define M_R(A) ((A&0x7c00)>>10)
#define M_G(A) ((A&0x03e0)>>5)
#define M_B(A) (A&0x1f)
#define NB_BUFFERS 8
#define NB_BUFFERS_DIV 3
void ws_mergeBackbuffers(int16 **buffers)
{
int16 *buffersAlias[NB_BUFFERS+1];
memcpy(buffersAlias,buffers,sizeof(int16*)*(NB_BUFFERS+1));
for (int i=0; i<224*144; i++)
{
int r,g,b;
r=g=b=0;
for (int j=0; j<NB_BUFFERS; j++)
{
r+=M_R(*buffersAlias[j]);
g+=M_G(*buffersAlias[j]);
b+=M_B(*buffersAlias[j]);
buffersAlias[j]++;
}
r>>=NB_BUFFERS_DIV;
g>>=NB_BUFFERS_DIV;
b>>=NB_BUFFERS_DIV;
*buffersAlias[NB_BUFFERS]++=(r<<10)|(g<<5)|b;
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_standard_interpolate(void)
{
#define KEY_ENTER 0x0D
#define KEY_ESC 0x1b
#define KEY_UP 0x26
#define KEY_DOWN 0x28
#define KEY_LEFT 0x25
#define KEY_RIGHT 0x27
#define KEY_BUTTON1 0x57
#define KEY_BUTTON2 0x58
uint32 startTime, endTime, totalFrames;
unsigned int nNormalLast=0;
int nNormalFrac=0;
int nTime=0,nCount=0;
int i=0;
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;
if (app_rotated)
{
surface=new Surface(144,224,format);
}
else
{
surface=new Surface(224,144,format);
}
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");
console.open("Oswan",224,144,format);
int16 *backbuffer[NB_BUFFERS+1];
for (int fr=0; fr<NB_BUFFERS+1; fr++)
{
backbuffer[fr]=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer[fr],0x00,224*144*sizeof(int16));
}
totalFrames=0;
startTime=clock();
nNormalLast=0;// Last value of timeGetTime()
nNormalFrac=0; // Extra fraction we did
nNormalLast=timeGetTime();
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}
while (1)
{
nTime=timeGetTime()-nNormalLast; // calcule le temps <20>coul<75> depuis le dernier affichage
// nTime est en mili-secondes.
// d<>termine le nombre de trames <20> passer + 1
nCount=(nTime*600 - nNormalFrac) /10000;
// si le nombre de trames <20> passer + 1 est nul ou n<>gatif,
// ne rien faire pendant 2 ms
if (nCount<=0)
{
Sleep(2);
} // No need to do anything for a bit
else
{
nNormalFrac+=nCount*10000; //
nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
nNormalFrac%=600; //
// Pas plus de 9 (10-1) trames non affich<63>es
if (nCount>10)
{
nCount=10;
}
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/ int ws_key_esc=0;
#include "./source/temp/key.h"
if (ws_key_esc)
{
console.close();
strcpy(old_rom_path,ws_rom_path);
gui_open();
if ((ws_rom_path!=NULL)||(app_terminate))
{
break;
}
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
{
ws_reset();
}
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
{
ws_set_colour_scheme(ws_colourScheme);
}
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");
console.open("Oswan",224,144,format);
}
for (i=0; i<nCount-1; i++)
while (!ws_executeLine(backbuffer[0],0));
while (!ws_executeLine(backbuffer[totalFrames&(NB_BUFFERS-1)],1));
ws_mergeBackbuffers(backbuffer);
if (app_rotated)
{
ws_rotate_backbuffer(backbuffer[NB_BUFFERS]);
}
totalFrames++;
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer[NB_BUFFERS],224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
endTime=clock();
float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
printf("%f fps (%i %% the original speed)\n",fps, (int)((fps*100)/60));
console.close();
delete surface;
}

View File

@@ -1,77 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_scanlines(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,82 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_special(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
while (!ws_executeLine(backbuffer,1));
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledHalfBrightnessScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,82 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// VERY SLOW !!!!
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_rotate_backbuffer(int16 *backbuffer)
{
static int16 temp[224*144];
memcpy(temp,backbuffer,224*144*2);
for (int line=0; line<144; line++)
for (int column=0; column<224; column++)
{
backbuffer[line+((223-column)<<7)+((223-column)<<4)]=temp[column+(line<<7)+(line<<6)+(line<<5)];
}
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_standard(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144,224,format);
#include "filter_partB.h"
surfacePitch>>=1;
console.open(app_window_title,144,224,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144,224,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224,144,format);
#include "filter_partB.h"
console.open(app_window_title,224,144,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224,144,format);
#include "filter_partD.h"
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_Super2xSaI(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_SuperEagle(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@@ -1,202 +0,0 @@
static int testJoystick=1;
if (testJoystick==1)
{
testJoystick=0;
fprintf(log_get(),"%i joysticks were found.\n\n", SDL_NumJoysticks() );
fprintf(log_get(),"The names of the joysticks are:\n");
for(int tti=0; tti < SDL_NumJoysticks(); tti++ )
{
fprintf(log_get()," %s\n", SDL_JoystickName(tti));
}
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
else
{
if (joystick!=NULL)
{
SDL_JoystickClose(0);
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
}
while ( SDL_PollEvent(&app_input_event) )
{
if ( app_input_event.type == SDL_QUIT )
{
ws_key_esc = 1;
}
}
if (joystick)
{
if (SDL_JoystickGetButton(joystick,0))
{
ws_key_start=1;
}
else
{
ws_key_start=0;
}
if (SDL_JoystickGetButton(joystick,1))
{
ws_key_button_a=1;
}
else
{
ws_key_button_a=0;
}
if (SDL_JoystickGetButton(joystick,2))
{
ws_key_button_b=1;
}
else
{
ws_key_button_b=0;
}
if (SDL_JoystickGetAxis(joystick,0)<-7000)
{
ws_key_x4=1;
}
else
{
ws_key_x4=0;
}
if (SDL_JoystickGetAxis(joystick,0)>7000)
{
ws_key_x2=1;
}
else
{
ws_key_x2=0;
}
if (SDL_JoystickGetAxis(joystick,1)<-7000)
{
ws_key_x1=1;
}
else
{
ws_key_x1=0;
}
if (SDL_JoystickGetAxis(joystick,1)>7000)
{
ws_key_x3=1;
}
else
{
ws_key_x3=0;
}
ws_key_y4=0;
ws_key_y2=0;
ws_key_y1=0;
ws_key_y3=0;
}
else
{
ws_key_start=0;
ws_key_x4=0;
ws_key_x2=0;
ws_key_x1=0;
ws_key_x3=0;
ws_key_y4=0;
ws_key_y2=0;
ws_key_y1=0;
ws_key_y3=0;
ws_key_button_a=0;
ws_key_button_b=0;
}
uint8 *keystate = SDL_GetKeyState(NULL);
if ( keystate[SDLK_e])
{
dump_memory();
}
if ( keystate[SDLK_r])
{
printf("Boop\n");
ws_reset();
}
if ( keystate[SDLK_ESCAPE] )
{
ws_key_esc = 1;
}
if ( keystate[SDLK_UP] )
{
ws_key_x1=1;
}
if ( keystate[SDLK_DOWN] )
{
ws_key_x3=1;
}
if ( keystate[SDLK_RIGHT] )
{
ws_key_x2=1;
}
if ( keystate[SDLK_LEFT] )
{
ws_key_x4=1;
}
if (keystate[SDLK_RETURN])
{
ws_key_start=1;
}
if (keystate[SDLK_c])
{
ws_key_button_a=1;
}
if (keystate[SDLK_x])
{
ws_key_button_b=1;
}
if (keystate[SDLK_w])
{
ws_key_y1=1;
}
if (keystate[SDLK_a])
{
ws_key_y4=1;
}
if (keystate[SDLK_s])
{
ws_key_y3=1;
}
if (keystate[SDLK_d])
{
ws_key_y2=1;
}
if (keystate[SDLK_o])
{
ws_cyclesByLine+=10;
}
if (keystate[SDLK_l])
{
ws_cyclesByLine-=10;
}

Binary file not shown.

View File

@@ -1,42 +0,0 @@
bits 32
section .data
bits 32
times ($$-$)&7 db 0
section .text
bits 32
global rdtscCapableCpu_
global _rdtscCapableCpu
global _ticker
global ticker_
_ticker:
ticker_:
push edx
rdtsc
shr eax,8
shl edx,24
and edx,0xff000000
or eax,edx
pop edx
ret
rdtscCapableCpu_:
_rdtscCapableCpu:
push ebx
push ecx
push edx
mov eax,1
xor ebx,ebx
xor ecx,ecx
xor edx,edx
cpuid
test edx,0x10
setne al
and eax,1
pop edx
pop ecx
pop ebx
ret
end

View File

@@ -1,5 +0,0 @@
extern "C"
{
long ticker();
};

View File

@@ -1,44 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//////////////////////////////////////////////////////////////////////////////
// this file is a travesty. [SU]int(8|16|32) should be used instead.
#ifndef __TYPES_H__
#define __TYPES_H__
#include "SDL.h"
#define UINT8 Uint8
#define UINT16 Uint16
#define INT8 Sint8
#define INT16 Sint16
#define INT32 Sint32
#define UINT32 Uint32
#define uint8 UINT8
#define uint16 UINT16
#define uint32 UINT32
#define int8 INT8
#define int16 INT16
#define int32 INT32
#define u8 uint8
#define u16 uint16
#define u32 uint32
#define s8 int8
#define s16 int16
#define s32 int32
#define BYTE Uint8
#define WORD Uint16
#define DWORD Uint32
#endif

View File

@@ -1,409 +0,0 @@
# Microsoft Developer Studio Project File - Name="wonderswan" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=wonderswan - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wonderswan.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wonderswan.mak" CFG="wonderswan - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wonderswan - Win32 Release" (based on\
"Win32 (x86) Console Application")
!MESSAGE "wonderswan - Win32 Debug" (based on\
"Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "wonderswan - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /GX /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 comctl32.lib comdlg32.lib kernel32.lib user32.lib gdi32.lib winmm.lib winspool.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "wonderswan - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Gm /GX /Zi /O2 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 comctl32.lib comdlg32.lib kernel32.lib user32.lib gdi32.lib winspool.lib winmm.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "wonderswan - Win32 Release"
# Name "wonderswan - Win32 Debug"
# Begin Group "nec"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\nec\nec.cpp
!IF "$(CFG)" == "wonderswan - Win32 Release"
# ADD CPP /W1
!ELSEIF "$(CFG)" == "wonderswan - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\source\nec\nec.h
# End Source File
# Begin Source File
SOURCE=.\source\nec\necea.h
# End Source File
# Begin Source File
SOURCE=.\source\nec\necinstr.h
# End Source File
# Begin Source File
SOURCE=.\source\nec\necmodrm.h
# End Source File
# End Group
# Begin Group "documentation"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\documentation\ws_communication.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_controls.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_dma.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_external_eeprom.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_gpu.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_hardware_type.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_internal_eeprom.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_interrupts.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_lcd_control.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_line_execution_behaviour.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_palette.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_realtimeclock.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_rom_banks_selectors.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_rom_header.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_sound.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\ws_tileformat.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\wstech20.txt
# End Source File
# Begin Source File
SOURCE=.\documentation\wstech20work.txt
# End Source File
# End Group
# Begin Group "tools"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\log.cpp
# End Source File
# Begin Source File
SOURCE=.\source\LOG.H
# End Source File
# Begin Source File
SOURCE=.\source\ticker.h
# End Source File
# Begin Source File
SOURCE=.\source\ticker.obj
# End Source File
# Begin Source File
SOURCE=.\source\types.h
# End Source File
# End Group
# Begin Group "gui"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\gui.rc
!IF "$(CFG)" == "wonderswan - Win32 Release"
!ELSEIF "$(CFG)" == "wonderswan - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\source\gui\logo.bmp
# End Source File
# Begin Source File
SOURCE=.\source\gui\sponsor.bmp
# End Source File
# End Group
# Begin Group "sdl"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\sdl\include\SDL.h
# End Source File
# Begin Source File
SOURCE=.\source\sdl\SDL.lib
# End Source File
# Begin Source File
SOURCE=.\source\sdl\SDLmain.lib
# End Source File
# Begin Source File
SOURCE=.\source\sdl\include\SDLptc.h
# End Source File
# End Group
# Begin Group "wonderswan"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\audio.cpp
# End Source File
# Begin Source File
SOURCE=.\source\audio.h
# End Source File
# Begin Source File
SOURCE=.\source\gpu.cpp
# End Source File
# Begin Source File
SOURCE=.\source\gpu.h
# End Source File
# Begin Source File
SOURCE=.\source\ieeprom.h
# End Source File
# Begin Source File
SOURCE=.\source\initialIo.h
# End Source File
# Begin Source File
SOURCE=.\source\io.cpp
# End Source File
# Begin Source File
SOURCE=.\source\io.h
# End Source File
# Begin Source File
SOURCE=.\source\memory.cpp
# End Source File
# Begin Source File
SOURCE=.\source\memory.h
# End Source File
# Begin Source File
SOURCE=.\source\rom.cpp
# End Source File
# Begin Source File
SOURCE=.\source\rom.h
# End Source File
# Begin Source File
SOURCE=.\source\ws.cpp
# End Source File
# Begin Source File
SOURCE=.\source\ws.h
# End Source File
# End Group
# Begin Group "filters"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\2xSaI.cpp
# End Source File
# Begin Source File
SOURCE=.\source\2xSaI.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\2xsai.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\doubled.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\filter_partA.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\filter_partB.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\filter_partC.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\filter_partD.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\filter_partE.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\halfscanlines.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\scanlines.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\special.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\standard.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\super2xsai.h
# End Source File
# Begin Source File
SOURCE=.\source\filters\supereagle.h
# End Source File
# End Group
# Begin Group "seal"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\source\seal\AUDIO.H
# End Source File
# Begin Source File
SOURCE=.\source\seal\AUDW32VC.LIB
# End Source File
# End Group
# Begin Source File
SOURCE=.\source\temp\key.h
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Target
# End Project

View File

@@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "wonderswan"=.\wonderswan.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -1,44 +0,0 @@
Release 1.0.7 July 30th, 1999
- Source code released under the GNU Lesser General Public License (LGPL)
Release 1.0.6 December 25th, 1998
- New API functions ASetAudioMixerValue and AUpdateAudioEx
- Minor fixes in ENSONIQ SoundScape and Windows Sound System drivers
- Fixed DJGPP memory protection fault due to page swapping
- Windows 95 and NT driver thread priority changed
- Workaround to get sound on some SB compatible cards
- Port to Intel BeOS R4 platforms
- New experimental accelerated DirectSound driver
Release 1.0.5 October 18th, 1998
- Fixed problems with ENSONIQ AudioPCI cards (Thanks Bomb!)
- Port to OS/2 platforms (Thanks Marty!)
- Port to Intel BeOS R3 platforms
- HTML documentation
Release 1.0.4 April 12th, 1998
- Memory leak in AFreeWaveFile() fixed
- New API call to retrieve tracks' parameters
Release 1.0.3 January 9th, 1997
- Windows Wave and DirectSound drivers bug fixes
- Minor bug fix in XM module file loader
- Silence driver now actually "play" modules
Release 1.0.1 September 25th, 1996
- Support for DirectSound in Windows 95 and NT
- Support for Sound Blaster AWE32 (EMU8000) sound cards
- Support for Ultrasound PnP (InterWave) sound cards
- Support for MultiTracker 1.0 module files
- New synchronization callback feature
- New file offset parameter in loading routines
- Data type names changed for better portability
- Fixed mono playback for non-wavetable sound cards
- Volume was too quiet for 8-bit sound cards
- Fixed WATCOM C/C++ 10.x naming convention bug
- Fixed 4DOS-only batch files to work with COMMAND.COM
- Many other minor bug fixes
Release 1.0.0 June 8th, 1996
- First release

View File

@@ -1,13 +0,0 @@
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
SEAL Audio Library Release 1.0.7
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
32-bit multichannel audio system
for DOS, Windows 95, Windows NT,
OS/2, BeOS and Linux platforms.
Supports SB, SBPro, SB16, AWE32,
PAS, PAS16, GUS, GUSDB, GUSMAX,
IW, WSS, ESS and Aria cards.
Plays MOD/MTM/S3M/XM modules.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Full source code available!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

View File

@@ -1,505 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and an idea of what it does.>
Copyright (C) year name of author
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -1,6 +0,0 @@
all:
cd src ; make
clean:
-rm lib/SDL/*.a
cd src ; make clean

View File

@@ -1,39 +0,0 @@
This is the OS/2 port of the Synthetic Audio Library (SEAL).
The DLL included can be used to add OS/2 native support for playing module
files and streamed audio to OS/2 Presentation Manager (PM) and VIO
applications. It can also be used to assist in the porting of other DOS,
Windows, and Linux applications that also use the SEAL API.
To build applications with the SEAL library, simply link them with the
AUDIO.LIB file and include the AUDIO.H file in your programs. The standard SEAL
documentation covers the usage of the standard SEAL API. There are a few
additional considerations in using the OS/2 version:
* The OS/2 version is multithreaded. This means that the SEAL library is
updating the audio buffers in the background while the rest of your
application is running. Unlike the DOS and Windows versions, you DO NOT
HAVE TO call the AUpdateAudio function to update the audio buffers. This
also means that some care needs to be taken when updating the voices
and sound buffers yourself. It is recommended that you use DosEnterCritSec
and DosExitCritSec around areas where voices are created and destroyed.
* Some of the SEAL API functions require other threads to be running when
they are called. If you are in a critical section when you call some
functions, it can cause deadlock because the critical section prevents
other threads in the same task from running. Do not call the following
functions in a critical section: AOpenAudio, ACloseAudio, AUpdateAudio.
* The AUpdateAudio function was implemented, but not to update the audio.
It was made to be a means of synchronizing your application with the audio
stream. When you call AUpdateAudio, the calling thread will block until
an audio buffer needs more data. For a good example of how to use this
function and the rest of the SEAL API, ask me for the source code for
MAME for OS/2. E-mail me at mta3206@grace.isc.rit.edu.
There are no known OS/2 specific bugs at this time.
Look for a DART-enabled version soon.
- Marty

View File

@@ -1,224 +0,0 @@
Synthetic Audio Library (SEAL) Development Kit
Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
All Rights Reserved
OS/2 Sound Driver Copyright (C) 1998 Martin Amodeo
This 1.0.7 release of the Synthetic Audio Library (SEAL) lets you write
applications that conform to the 1.0 SEAL API which is able to play
digital audio waveforms and music modules on many platforms.
What's New
----------
- Source code released under the GNU Lesser General Public License (LGPL)
Features
--------
- simple and powerful API interface
- 32 simultaneous digital audio channels
- smooth pitch shifting, volume and panning controllers per channel
- smart digital filtering for improved sound quality
- efficient digital audio waveform mixing algorithms combined with
uncompromising low-level optimizations
- importing of wave and music file formats such as Protracker 1.1,
MultiTracker 1.0, Scream Tracker 3.0 and FastTracker 2.0 modules
- performance tuned for the i486 and Pentium processors
- native support in DOS for hardware wavetable accelerators such
as the Sound Blaster AWE32, Gravis Forte's UltraSound, and normal
digital audio devices such as the Sound Blaster 1.5/2.0/Pro/16,
Pro Audio Spectrum 16, Windows Sound System, Ensoniq Soundscape
and Aria soundcards
Supported platforms
-------------------
The SEAL SDK is available for DOS, Extended DOS, Windows 95, Windows NT,
OS/2, BeOS and Linux platforms. FreeBSD, SPARC SunOS, SPARC Solaris and
SGI Indigo ports are in progress. The following compilers were used to
build the library files:
- Borland C++ 4.5 compiler for DOS and Win32s
- WATCOM C/C++ 10.0 compiler for DOS and Windows
- Microsoft Visual C++ 4.1 compiler for Windows 95
- DJGPP 2.0 port of GNU C/C++ compiler for DOS
- GNU C/C++ 2.7.0 for Linux (a.out and ELF)
- Metrowerks CodeWarrior C++ for Intel BeOS Release 3
- EMX port of GNU CC 2.7.x for OS/2 platforms
The SEAL SDK contains
---------------------
- SEAL API header and library files
- SEAL audio library source code files (GPL license)
- set of example source code files
---------------------------------------------------------------------
IMPORTANT: Please make sure you understand the Copyright and License
information (in the file named LICENSE.TXT) before using this release.
---------------------------------------------------------------------
Installing the Software
-----------------------
The SEAL SDK can be installed unpacking the distribution archive
in your hard disk. For example,
C:\>PKUNZIP -d SEAL107.ZIP
The SEAL SDK include and library directories can be installed in
your C programming environment modifying the header and library
directory paths. Here are some examples to compile and link
the SEAL audio system library with your own programs:
- WATCOM C/C++32 10.0 and DOS4GW DOS Extender:
wcl386 -I\audio\include example.c \audio\lib\dos\audiowcf.lib
- DJGPP 2.0 port of GNU CC for DOS/DPMI32:
gcc -I\audio\include -o example example.c \audio\lib\dos\audiodjf.a
- Visual C/C++ 4.1 for Windows 95 and Windows NT:
cl -DWIN32 -I\audio\include example.c \audio\lib\Win32\audw32vc.lib
- Borland C++ 4.5 for Win32s:
bcc32a -WC -I\audio\include example.c \audio\lib\Win32\audw32bc.lib
- GNU CC 2.7.0 for Linux (ELF binaries):
gcc -Iaudio/include -o example example.c audio/lib/Linux/libaudio.a
- Metrowerks CodeWarrior C++ for BeOS R3:
mwcc -Iaudio/include -o example example.c audio/lib/BeOS/libaudio.a
The above examples assume that the audio system was installed at the
root directory of the current drive. For Windows 95 and Windows NT
applications you must copy the AUDIOW32.DLL dynamic-link library into
the Windows system directory, usually located at C:\WINDOWS\SYSTEM in
your hard disk.
Notes about DOS Drivers
-----------------------
For applications running in DOS, the audio system will try to detect
the hardware sound devices installed on your system. Since there can
be problems to autodetect your sound hardware, your application should
provide a way to force the use of a particular audio device driver.
Here is a list of notes for the autodetection methods used by the audio
device drivers under the DOS operating system:
- Sound Blaster 1.0/1.5/2.0/Pro/16 device drivers:
These drivers use the BLASTER environment variable to determine
the hardware I/O base port address, IRQ interrupt line and DMA
channels. The model of the card is then determined by hardware
reading the DSP version number. If you do not get sound, try
forcing other SB model by using the "T" parameter of the BLASTER
environment variable:
T1 = Sound Blaster 1.0
T2 = Sound Blaster 1.5
T3 = Sound Blaster 2.0
T4 = Sound Blaster Pro
T6 = Sound Blaster 16
- Sound Blaster AWE32 and Sound Blaster 32 device drivers:
The driver uses the BLASTER environment variable, you must
specify the EMU8000 I/O base port address parameter. If your
card does not have DRAM local sound memory, you must use the
card as a Sound Blaster 16 or earlier.
- Pro Audio Spectrum, Pro Audio Spectrum Plus/16 device drivers:
These drivers need to have the MVSOUND.SYS driver installed
in your CONFIG.SYS configuration file. The model of the card
is determined by hardware checking the card features bits.
- Gravis Ultrasound, Ultrasound MAX device drivers:
This driver uses the ULTRASND environment variable to determine
the hardware configuration of your card. For applications using
the DOS4GW extender, the GF1-IRQ number must be less than 8 to
work correctly.
- Gravis Ultrasound Daughterboard / MAX (CS4231) device drivers:
This driver uses the CS4231 codec of your GUS DB/MAX card, so
you must have the ULTRASND and ULTRA16 environment variables.
- Gravis Ultrasound PnP (Pro), InterWave-based device drivers:
This driver uses the ULTRASND and INTERWAVE environment variables
to determine the hardware configuration of your sound board.
- Windows Sound System device driver:
This driver automatically detect WSS sound devices installed
at the 530, E80, F40 or 604 I/O base port addresses and uses
by default the IRQ line #7 and DMA channel #1 for playback.
Since there can be hardware conflicts, the driver first check
for the WSSCFG environment variable which has the following
format:
SET WSSCFG=Annn In Dn
| | |
| | +-- DMA channel (0,1,3)
| +---- IRQ number (7,9,10,11)
+----- I/O port (530,E80,F40,604)
You must write the above command in your AUTOEXEC.BAT start-up
batch file. Also, some WSS clone devices need to run an utility
to put the card in WSS mode (ie. MAD16 OPTi-based cards).
- Ensoniq Soundscape, Soundscape Elite device drivers:
These drivers uses the SNDSCAPE environment variable to read
the SNDSCAPE.INI configuration file.
- Sierra Semoconductors' Aria sound card driver:
This driver uses the ARIA environment variable to read the
hardware configuration parameters.
- Ensoniq AudioPCI and Creative PCI64 sound cards:
These cards have to be configured in Legacy emulation mode
under DOS. The library will use these cards as Ensoniq
SoundScape ISA cards.
If you experience any problems, please try avoiding autodetection and
tell your application what device driver to use. Also, ensure your
system has no TSR's loaded in memory (such as SBOS for GUS cards).
Notes about Windows 95
----------------------
The SEAL audio system for DOS and Extended DOS has been sucessfully
tested under Windows 95 DOS boxes running in foreground. However,
some Windows 95 sound drivers might not be able to share the sound
hardware with DOS sessions (such as the Ultrasound drivers). In such
cases, you must either remove the Windows 95 drivers or exit to DOS
to run your DOS programs.
Notes about Linux
-----------------
The SEAL audio system for Linux uses the UNIX Sound System interface,
also known as the VoxWare Kit. The audio system can be easily ported
to other UNIX operating system running in Intel x86 platforms where
the UNIX Sound System interface is also available, such as FreeBSD,
386bsd, SCO and SVR4.2 operating systems.
Notes about BeOS
----------------
The SEAL audio library for Intel BeOS Release 3 also works with
New MediaKit sound drivers found on BeOS R4. The SEAL 1.06 library
comes with ELF binaries for Intel BeOS Release 4.
Contacting the Author
---------------------
If you have questions, problems or comments you can contact the author
at the following email address: chasan@dcc.uchile.cl.
Closing Words
-------------
I would like to thank all the beta testers and specially to Jon L.
for the music module file used by the example programs, and to all
the IRC friends at the #coders channel.

File diff suppressed because it is too large Load Diff

View File

@@ -1,479 +0,0 @@
/* 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());
}

View File

@@ -1,49 +0,0 @@
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.

Binary file not shown.

View File

@@ -1,67 +0,0 @@
/* 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;
}

View File

@@ -1,20 +0,0 @@
<?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.

View File

@@ -1,70 +0,0 @@
/* 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;
}

View File

@@ -1,20 +0,0 @@
<?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.

View File

@@ -1,87 +0,0 @@
/* 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;
}

View File

@@ -1,20 +0,0 @@
<?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.

View File

@@ -1,78 +0,0 @@
/* 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;
}

View File

@@ -1,20 +0,0 @@
<?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.

View File

@@ -1,120 +0,0 @@
/* 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

View File

@@ -1,20 +0,0 @@
<?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.

View File

@@ -1,100 +0,0 @@
/* 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;
}

View File

@@ -1,20 +0,0 @@
<?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>

View File

@@ -1,41 +0,0 @@
#!/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

View File

@@ -1,88 +0,0 @@
@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

Binary file not shown.

Binary file not shown.

View File

@@ -1,377 +0,0 @@
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

Binary file not shown.

View File

@@ -1,43 +0,0 @@
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

View File

@@ -1,3 +0,0 @@
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,

View File

@@ -1,230 +0,0 @@
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

Binary file not shown.

View File

@@ -1,288 +0,0 @@
Attribute VB_Name = "Audio"
'
' $Id: audio.h 1.17 1996/09/25 17:13:02 chasan released $
'
' SEAL Synthetic Audio Library API Interface
'
' Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License as published
' by the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' MICROSOFT VISUAL BASIC INTERFACE FOR WINDOWS 95/NT
'
Option Explicit
' audio system version number
Public Const AUDIO_SYSTEM_VERSION = &H101
' audio capabilities bit fields definitions
Public Const AUDIO_FORMAT_1M08 = &H1
Public Const AUDIO_FORMAT_1S08 = &H2
Public Const AUDIO_FORMAT_1M16 = &H4
Public Const AUDIO_FORMAT_1S16 = &H8
Public Const AUDIO_FORMAT_2M08 = &H10
Public Const AUDIO_FORMAT_2S08 = &H20
Public Const AUDIO_FORMAT_2M16 = &H40
Public Const AUDIO_FORMAT_2S16 = &H80
Public Const AUDIO_FORMAT_4M08 = &H100
Public Const AUDIO_FORMAT_4S08 = &H200
Public Const AUDIO_FORMAT_4M16 = &H400
Public Const AUDIO_FORMAT_4S16 = &H800
' audio format bit fields defines for devices and waveforms
Public Const AUDIO_FORMAT_8BITS = &H0
Public Const AUDIO_FORMAT_16BITS = &H1
Public Const AUDIO_FORMAT_LOOP = &H10
Public Const AUDIO_FORMAT_BIDILOOP = &H20
Public Const AUDIO_FORMAT_REVERSE = &H80
Public Const AUDIO_FORMAT_MONO = &H0
Public Const AUDIO_FORMAT_STEREO = &H100
Public Const AUDIO_FORMAT_FILTER = &H8000
' audio resource limits defines
Public Const AUDIO_MAX_VOICES = 32
Public Const AUDIO_MAX_SAMPLES = 16
Public Const AUDIO_MAX_PATCHES = 128
Public Const AUDIO_MAX_PATTERNS = 256
Public Const AUDIO_MAX_ORDERS = 256
Public Const AUDIO_MAX_NOTES = 96
Public Const AUDIO_MAX_POINTS = 12
Public Const AUDIO_MIN_PERIOD = 1
Public Const AUDIO_MAX_PERIOD = 31999
Public Const AUDIO_MIN_VOLUME = 0
Public Const AUDIO_MAX_VOLUME = 64
Public Const AUDIO_MIN_PANNING = 0
Public Const AUDIO_MAX_PANNING = 255
Public Const AUDIO_MIN_POSITION = 0
Public Const AUDIO_MAX_POSITION = 1048576
Public Const AUDIO_MIN_FREQUENCY = 512
Public Const AUDIO_MAX_FREQUENCY = 524288
' audio error code defines
Public Const AUDIO_ERROR_NONE = 0
Public Const AUDIO_ERROR_INVALHANDLE = 1
Public Const AUDIO_ERROR_INVALPARAM = 2
Public Const AUDIO_ERROR_NOTSUPPORTED = 3
Public Const AUDIO_ERROR_BADDEVICEID = 4
Public Const AUDIO_ERROR_NODEVICE = 5
Public Const AUDIO_ERROR_DEVICEBUSY = 6
Public Const AUDIO_ERROR_BADFORMAT = 7
Public Const AUDIO_ERROR_NOMEMORY = 8
Public Const AUDIO_ERROR_NODRAMMEMORY = 9
Public Const AUDIO_ERROR_FILENOTFOUND = 10
Public Const AUDIO_ERROR_BADFILEFORMAT = 11
Public Const AUDIO_LAST_ERROR = 11
' audio device identifiers
Public Const AUDIO_DEVICE_NONE = 0
Public Const AUDIO_DEVICE_MAPPER = 65535
' audio product identifiers
Public Const AUDIO_PRODUCT_NONE = 0
Public Const AUDIO_PRODUCT_SB = 1
Public Const AUDIO_PRODUCT_SB15 = 2
Public Const AUDIO_PRODUCT_SB20 = 3
Public Const AUDIO_PRODUCT_SBPRO = 4
Public Const AUDIO_PRODUCT_SB16 = 5
Public Const AUDIO_PRODUCT_AWE32 = 6
Public Const AUDIO_PRODUCT_WSS = 7
Public Const AUDIO_PRODUCT_ESS = 8
Public Const AUDIO_PRODUCT_GUS = 9
Public Const AUDIO_PRODUCT_GUSDB = 10
Public Const AUDIO_PRODUCT_GUSMAX = 11
Public Const AUDIO_PRODUCT_IWAVE = 12
Public Const AUDIO_PRODUCT_PAS = 13
Public Const AUDIO_PRODUCT_PAS16 = 14
Public Const AUDIO_PRODUCT_ARIA = 15
Public Const AUDIO_PRODUCT_WINDOWS = 256
Public Const AUDIO_PRODUCT_LINUX = 257
Public Const AUDIO_PRODUCT_SPARC = 258
Public Const AUDIO_PRODUCT_SGI = 259
Public Const AUDIO_PRODUCT_DSOUND = 260
' audio envelope bit fields
Public Const AUDIO_ENVELOPE_ON = &H1
Public Const AUDIO_ENVELOPE_SUSTAIN = &H2
Public Const AUDIO_ENVELOPE_LOOP = &H4
' audio pattern bit fields
Public Const AUDIO_PATTERN_PACKED = &H80
Public Const AUDIO_PATTERN_NOTE = &H1
Public Const AUDIO_PATTERN_SAMPLE = &H2
Public Const AUDIO_PATTERN_VOLUME = &H4
Public Const AUDIO_PATTERN_COMMAND = &H8
Public Const AUDIO_PATTERN_PARAMS = &H10
' audio module bit fields
Public Const AUDIO_MODULE_AMIGA = &H0
Public Const AUDIO_MODULE_LINEAR = &H1
Public Const AUDIO_MODULE_PANNING = &H8000
' FIXME: structures should be byte aligned
' audio capabilities structure
Public Type AudioCaps
wProductId As Integer ' product identifier
szProductName As String * 30 ' product name
dwFormats As Long ' formats supported
End Type
' audio format structure
Public Type AudioInfo
nDeviceId As Long ' device identifier
wFormat As Integer ' playback format
nSampleRate As Integer ' sampling frequency
End Type
' audio waveform structure
Public Type AudioWave
lpData As Long ' data pointer
dwHandle As Long ' waveform handle
dwLength As Long ' waveform length
dwLoopStart As Long ' loop start point
dwLoopEnd As Long ' loop end point
nSampleRate As Integer ' sampling rate
wFormat As Integer ' format bits
End Type
' audio envelope point structure
Public Type AudioPoint
nFrame As Integer ' envelope frame
nValue As Integer ' envelope value
End Type
' audio envelope structure
Public Type AudioEnvelope
aEnvelope(0 To 11) As AudioPoint ' envelope points
nPoints As Byte ' number of points
nSustain As Byte ' sustain point
nLoopStart As Byte ' loop start point
nLoopEnd As Byte ' loop end point
wFlags As Integer ' envelope flags
nSpeed As Integer ' envelope speed
End Type
' audio sample structure
Public Type AudioSample
szSampleName As String * 32 ' sample name
nVolume As Byte ' default volume
nPanning As Byte ' default panning
nRelativeNote As Byte ' relative note
nFinetune As Byte ' finetune
Wave As AudioWave ' waveform handle
End Type
' audio patch structure
Public Type AudioPatch
szPatchName As String * 32 ' patch name
aSampleNumber(0 To 95) As Byte ' multi-sample table
nSamples As Integer ' number of samples
nVibratoType As Byte ' vibrato type
nVibratoSweep As Byte ' vibrato sweep
nVibratoDepth As Byte ' vibrato depth
nVibratoRate As Byte ' vibrato rate
nVolumeFadeout As Integer ' volume fadeout
Volume As AudioEnvelope ' volume envelope
Panning As AudioEnvelope ' panning envelope
aSampleTable As Long ' sample table (pointer)
End Type
' audio pattern structure
Public Type AudioPattern
nPacking As Integer ' packing type
nTracks As Integer ' number of tracks
nRows As Integer ' number of rows
nSize As Integer ' data size
lpData As Long ' data pointer
End Type
' audio module structure
Public Type AudioModule
szModuleName As String * 32 ' module name
wFlags As Integer ' module flags
nOrders As Integer ' number of orders
nRestart As Integer ' restart position
nTracks As Integer ' number of tracks
nPatterns As Integer ' number of patterns
nPatches As Integer ' number of patches
nTempo As Integer ' initial tempo
nBPM As Integer ' initial BPM
aOrderTable(0 To 255) As Byte ' order table
aPanningTable(0 To 31) As Byte ' panning table
aPatternTable As Long ' pattern table (pointer)
aPatchTable As Long ' patch table (pointer)
End Type
' FIXME: how do I define callback functions?
'typedef VOID (AIAPI* LPFNAUDIOWAVE)(LPBYTE, UINT);
'typedef VOID (AIAPI* LPFNAUDIOTIMER)(VOID);
'typedef VOID (AIAPI* LPFNAUDIOCALLBACK)(BYTE, UINT, UINT);
' audio interface API prototypes
Public Declare Function AInitialize Lib "AudioW32" () As Long
Public Declare Function AGetVersion Lib "AudioW32" () As Long
Public Declare Function AGetAudioNumDevs Lib "AudioW32" () As Long
Public Declare Function AGetAudioDevCaps Lib "AudioW32" (ByVal nDeviceId As Long, ByRef lpCaps As AudioCaps) As Long
Public Declare Function AGetErrorText Lib "AudioW32" (ByVal nErrorCode As Long, ByVal lpszText As String, ByVal nSize As Long) As Long
Public Declare Function APingAudio Lib "AudioW32" (ByRef lpnDeviceId As Long) As Long
Public Declare Function AOpenAudio Lib "AudioW32" (ByRef lpInfo As AudioInfo) As Long
Public Declare Function ACloseAudio Lib "AudioW32" () As Long
Public Declare Function AUpdateAudio Lib "AudioW32" () As Long
Public Declare Function AOpenVoices Lib "AudioW32" (ByVal nVoices As Long) As Long
Public Declare Function ACloseVoices Lib "AudioW32" () As Long
Public Declare Function ASetAudioCallback Lib "AudioW32" (ByVal lpfnAudioWave As Long) As Long
Public Declare Function ASetAudioTimerProc Lib "AudioW32" (ByVal lpfnAudioTimer As Long) As Long
Public Declare Function ASetAudioTimerRate Lib "AudioW32" (ByVal nTimerRate As Long) As Long
Public Declare Function AGetAudioDataAvail Lib "AudioW32" () As Long
Public Declare Function ACreateAudioData Lib "AudioW32" (ByRef lpWave As AudioWave) As Long
Public Declare Function ADestroyAudioData Lib "AudioW32" (ByRef lpWave As AudioWave) As Long
Public Declare Function AWriteAudioData Lib "AudioW32" (ByRef lpWave As AudioWave, ByVal dwOffset As Long, ByVal nCount As Long) As Long
Public Declare Function ACreateAudioVoice Lib "AudioW32" (ByRef lphVoice As Long) As Long
Public Declare Function ADestroyAudioVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
Public Declare Function APlayVoice Lib "AudioW32" (ByVal hVoice As Long, ByVal lpWave As Long) As Long
Public Declare Function APrimeVoice Lib "AudioW32" (ByVal hVoice As Long, ByVal lpWave As Long) As Long
Public Declare Function AStartVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
Public Declare Function AStopVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
Public Declare Function ASetVoicePosition Lib "AudioW32" (ByVal hVoice As Long, ByVal dwPosition As Long) As Long
Public Declare Function ASetVoiceFrequency Lib "AudioW32" (ByVal hVoice As Long, ByVal dwFrequency As Long) As Long
Public Declare Function ASetVoiceVolume Lib "AudioW32" (ByVal hVoice As Long, ByVal nVolume As Long) As Long
Public Declare Function ASetVoicePanning Lib "AudioW32" (ByVal hVoice As Long, ByVal nPanning As Long) As Long
Public Declare Function AGetVoicePosition Lib "AudioW32" (ByVal hVoice As Long, ByRef lpdwPosition As Long) As Long
Public Declare Function AGetVoiceFrequency Lib "AudioW32" (ByVal hVoice As Long, ByRef lpdwFrequency As Long) As Long
Public Declare Function AGetVoiceVolume Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnVolume As Long) As Long
Public Declare Function AGetVoicePanning Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnPanning As Long) As Long
Public Declare Function AGetVoiceStatus Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnStatus As Long) As Long
Public Declare Function APlayModule Lib "AudioW32" (ByVal lpModule As Long) As Long
Public Declare Function AStopModule Lib "AudioW32" () As Long
Public Declare Function APauseModule Lib "AudioW32" () As Long
Public Declare Function AResumeModule Lib "AudioW32" () As Long
Public Declare Function ASetModuleVolume Lib "AudioW32" (ByVal nVolume As Long) As Long
Public Declare Function ASetModulePosition Lib "AudioW32" (ByVal nOrder As Long, ByVal nRow As Long) As Long
Public Declare Function AGetModuleVolume Lib "AudioW32" (ByVal lpnVolume As Long) As Long
Public Declare Function AGetModulePosition Lib "AudioW32" (ByRef pnOrder As Long, ByRef lpnRow As Long) As Long
Public Declare Function AGetModuleStatus Lib "AudioW32" (ByRef lpnStatus As Long) As Long
Public Declare Function ASetModuleCallback Lib "AudioW32" (ByVal lpfnAudioCallback As Long) As Long
' FIXME: how do I define pointers to AudioModule and AudioWave?
Public Declare Function ALoadModuleFile Lib "AudioW32" (ByVal lpszFileName As String, ByRef lplpModule As Long, ByVal dwFileOffset As Long) As Long
Public Declare Function AFreeModuleFile Lib "AudioW32" (ByVal lpModule As Long) As Long
Public Declare Function ALoadWaveFile Lib "AudioW32" (ByVal lpszFileName As String, ByRef lplpWave As Long, ByVal dwFileOffset As Long) As Long
Public Declare Function AFreeWaveFile Lib "AudioW32" (ByVal lpWave As Long) As Long

View File

@@ -1,388 +0,0 @@
/*
* $Id: audio.h 1.17 1996/09/25 17:13:02 chasan released $
* 1.18 1998/10/12 23:54:08 chasan released
* 1.19 1998/10/24 18:20:52 chasan released
* 1.20 1999/06/27 17:49:49 chasan released
*
* SEAL Synthetic Audio Library API Interface
*
* Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __AUDIO_H
#define __AUDIO_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WIN32
#define AIAPI
#else
#define AIAPI __stdcall
#endif
#ifndef WINAPI
#if 0
typedef void VOID;
typedef char CHAR;
typedef int INT;
typedef long LONG;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int UINT;
typedef unsigned long DWORD;
#else
typedef void VOID;
typedef int8_t CHAR;
typedef int32_t INT;
typedef int32_t LONG;
typedef int8_t BOOL;
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t UINT;
typedef uint32_t DWORD;
#endif
typedef VOID* LPVOID;
typedef CHAR* LPCHAR;
typedef INT* LPINT;
typedef LONG* LPLONG;
typedef BOOL* LPBOOL;
typedef BYTE* LPBYTE;
typedef WORD* LPWORD;
typedef UINT* LPUINT;
typedef DWORD* LPDWORD;
typedef char* LPSTR;
typedef uint64_t HANDLE;
/* helper macros */
#define LOBYTE(s) ((BYTE)(s))
#define HIBYTE(s) ((BYTE)((WORD)(s)>>8))
#define LOWORD(l) ((WORD)(l))
#define HIWORD(l) ((WORD)((DWORD)(l)>>16))
#define MAKEWORD(l,h) ((WORD)(((BYTE)(l))|(((WORD)((BYTE)(h)))<<8)))
#define MAKELONG(l,h) ((DWORD)(((WORD)(l))|(((DWORD)((WORD)(h)))<<16)))
#endif
/* audio system version number */
#define AUDIO_SYSTEM_VERSION 0x0106
/* audio capabilities bit fields definitions */
#define AUDIO_FORMAT_1M08 0x00000001
#define AUDIO_FORMAT_1S08 0x00000002
#define AUDIO_FORMAT_1M16 0x00000004
#define AUDIO_FORMAT_1S16 0x00000008
#define AUDIO_FORMAT_2M08 0x00000010
#define AUDIO_FORMAT_2S08 0x00000020
#define AUDIO_FORMAT_2M16 0x00000040
#define AUDIO_FORMAT_2S16 0x00000080
#define AUDIO_FORMAT_4M08 0x00000100
#define AUDIO_FORMAT_4S08 0x00000200
#define AUDIO_FORMAT_4M16 0x00000400
#define AUDIO_FORMAT_4S16 0x00000800
/* audio format bit fields defines for devices and waveforms */
#define AUDIO_FORMAT_8BITS 0x0000
#define AUDIO_FORMAT_16BITS 0x0001
#define AUDIO_FORMAT_LOOP 0x0010
#define AUDIO_FORMAT_BIDILOOP 0x0020
#define AUDIO_FORMAT_REVERSE 0x0080
#define AUDIO_FORMAT_MONO 0x0000
#define AUDIO_FORMAT_STEREO 0x0100
#define AUDIO_FORMAT_FILTER 0x8000
/* audio resource limits defines */
#define AUDIO_MAX_VOICES 32
#define AUDIO_MAX_SAMPLES 16
#define AUDIO_MAX_PATCHES 128
#define AUDIO_MAX_PATTERNS 256
#define AUDIO_MAX_ORDERS 256
#define AUDIO_MAX_NOTES 96
#define AUDIO_MAX_POINTS 12
#define AUDIO_MIN_PERIOD 1
#define AUDIO_MAX_PERIOD 31999
#define AUDIO_MIN_VOLUME 0x00
#define AUDIO_MAX_VOLUME 0x40
#define AUDIO_MIN_PANNING 0x00
#define AUDIO_MAX_PANNING 0xFF
#define AUDIO_MIN_POSITION 0x00000000L
#define AUDIO_MAX_POSITION 0x00100000L
#define AUDIO_MIN_FREQUENCY 0x00000200L
#define AUDIO_MAX_FREQUENCY 0x00080000L
/* audio error code defines */
#define AUDIO_ERROR_NONE 0x0000
#define AUDIO_ERROR_INVALHANDLE 0x0001
#define AUDIO_ERROR_INVALPARAM 0x0002
#define AUDIO_ERROR_NOTSUPPORTED 0x0003
#define AUDIO_ERROR_BADDEVICEID 0x0004
#define AUDIO_ERROR_NODEVICE 0x0005
#define AUDIO_ERROR_DEVICEBUSY 0x0006
#define AUDIO_ERROR_BADFORMAT 0x0007
#define AUDIO_ERROR_NOMEMORY 0x0008
#define AUDIO_ERROR_NODRAMMEMORY 0x0009
#define AUDIO_ERROR_FILENOTFOUND 0x000A
#define AUDIO_ERROR_BADFILEFORMAT 0x000B
#define AUDIO_LAST_ERROR 0x000B
/* audio device identifiers */
#define AUDIO_DEVICE_NONE 0x0000
#define AUDIO_DEVICE_MAPPER 0xFFFF
/* audio product identifiers */
#define AUDIO_PRODUCT_NONE 0x0000
#define AUDIO_PRODUCT_SB 0x0001
#define AUDIO_PRODUCT_SB15 0x0002
#define AUDIO_PRODUCT_SB20 0x0003
#define AUDIO_PRODUCT_SBPRO 0x0004
#define AUDIO_PRODUCT_SB16 0x0005
#define AUDIO_PRODUCT_AWE32 0x0006
#define AUDIO_PRODUCT_WSS 0x0007
#define AUDIO_PRODUCT_ESS 0x0008
#define AUDIO_PRODUCT_GUS 0x0009
#define AUDIO_PRODUCT_GUSDB 0x000A
#define AUDIO_PRODUCT_GUSMAX 0x000B
#define AUDIO_PRODUCT_IWAVE 0x000C
#define AUDIO_PRODUCT_PAS 0x000D
#define AUDIO_PRODUCT_PAS16 0x000E
#define AUDIO_PRODUCT_ARIA 0x000F
#define AUDIO_PRODUCT_WINDOWS 0x0100
#define AUDIO_PRODUCT_LINUX 0x0101
#define AUDIO_PRODUCT_SPARC 0x0102
#define AUDIO_PRODUCT_SGI 0x0103
#define AUDIO_PRODUCT_DSOUND 0x0104
#define AUDIO_PRODUCT_OS2MMPM 0x0105
#define AUDIO_PRODUCT_OS2DART 0x0106
#define AUDIO_PRODUCT_BEOSR3 0x0107
#define AUDIO_PRODUCT_BEOS 0x0108
#define AUDIO_PRODUCT_QNX 0x0109
/* audio mixer channels */
#define AUDIO_MIXER_MASTER_VOLUME 0x0001
#define AUDIO_MIXER_TREBLE 0x0002
#define AUDIO_MIXER_BASS 0x0003
#define AUDIO_MIXER_CHORUS 0x0004
#define AUDIO_MIXER_REVERB 0x0005
/* audio envelope bit fields */
#define AUDIO_ENVELOPE_ON 0x0001
#define AUDIO_ENVELOPE_SUSTAIN 0x0002
#define AUDIO_ENVELOPE_LOOP 0x0004
/* audio pattern bit fields */
#define AUDIO_PATTERN_PACKED 0x0080
#define AUDIO_PATTERN_NOTE 0x0001
#define AUDIO_PATTERN_SAMPLE 0x0002
#define AUDIO_PATTERN_VOLUME 0x0004
#define AUDIO_PATTERN_COMMAND 0x0008
#define AUDIO_PATTERN_PARAMS 0x0010
/* audio module bit fields */
#define AUDIO_MODULE_AMIGA 0x0000
#define AUDIO_MODULE_LINEAR 0x0001
#define AUDIO_MODULE_PANNING 0x8000
#pragma pack(1)
/* audio capabilities structure */
typedef struct {
WORD wProductId; /* product identifier */
CHAR szProductName[30]; /* product name */
DWORD dwFormats; /* formats supported */
} AUDIOCAPS, *LPAUDIOCAPS;
/* audio format structure */
typedef struct {
UINT nDeviceId; /* device identifier */
WORD wFormat; /* playback format */
WORD nSampleRate; /* sampling frequency */
} AUDIOINFO, *LPAUDIOINFO;
/* audio waveform structure */
typedef struct {
LPBYTE lpData; /* data pointer */
DWORD dwHandle; /* waveform handle */
DWORD dwLength; /* waveform length */
DWORD dwLoopStart; /* loop start point */
DWORD dwLoopEnd; /* loop end point */
WORD nSampleRate; /* sampling rate */
WORD wFormat; /* format bits */
} AUDIOWAVE, *LPAUDIOWAVE;
/* audio envelope point structure */
typedef struct {
WORD nFrame; /* envelope frame */
WORD nValue; /* envelope value */
} AUDIOPOINT, *LPAUDIOPOINT;
/* audio envelope structure */
typedef struct {
AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */
BYTE nPoints; /* number of points */
BYTE nSustain; /* sustain point */
BYTE nLoopStart; /* loop start point */
BYTE nLoopEnd; /* loop end point */
WORD wFlags; /* envelope flags */
WORD nSpeed; /* envelope speed */
} AUDIOENVELOPE, *LPAUDIOENVELOPE;
/* audio sample structure */
typedef struct {
CHAR szSampleName[32]; /* sample name */
BYTE nVolume; /* default volume */
BYTE nPanning; /* default panning */
BYTE nRelativeNote; /* relative note */
BYTE nFinetune; /* finetune */
AUDIOWAVE Wave; /* waveform handle */
} AUDIOSAMPLE, *LPAUDIOSAMPLE;
/* audio patch structure */
typedef struct {
CHAR szPatchName[32]; /* patch name */
BYTE aSampleNumber[AUDIO_MAX_NOTES]; /* multi-sample table */
WORD nSamples; /* number of samples */
BYTE nVibratoType; /* vibrato type */
BYTE nVibratoSweep; /* vibrato sweep */
BYTE nVibratoDepth; /* vibrato depth */
BYTE nVibratoRate; /* vibrato rate */
WORD nVolumeFadeout; /* volume fadeout */
AUDIOENVELOPE Volume; /* volume envelope */
AUDIOENVELOPE Panning; /* panning envelope */
LPAUDIOSAMPLE aSampleTable; /* sample table */
} AUDIOPATCH, *LPAUDIOPATCH;
/* audio pattern structure */
typedef struct {
WORD nPacking; /* packing type */
WORD nTracks; /* number of tracks */
WORD nRows; /* number of rows */
WORD nSize; /* data size */
LPBYTE lpData; /* data pointer */
} AUDIOPATTERN, *LPAUDIOPATTERN;
/* audio module structure */
typedef struct {
CHAR szModuleName[32]; /* module name */
WORD wFlags; /* module flags */
WORD nOrders; /* number of orders */
WORD nRestart; /* restart position */
WORD nTracks; /* number of tracks */
WORD nPatterns; /* number of patterns */
WORD nPatches; /* number of patches */
WORD nTempo; /* initial tempo */
WORD nBPM; /* initial BPM */
BYTE aOrderTable[AUDIO_MAX_ORDERS]; /* order table */
BYTE aPanningTable[AUDIO_MAX_VOICES]; /* panning table */
LPAUDIOPATTERN aPatternTable; /* pattern table */
LPAUDIOPATCH aPatchTable; /* patch table */
} AUDIOMODULE, *LPAUDIOMODULE;
/* audio music track structure */
typedef struct {
BYTE nNote; /* note index */
BYTE nPatch; /* patch number */
BYTE nSample; /* sample number */
BYTE nCommand; /* effect command */
BYTE bParams; /* effect params */
BYTE nVolumeCmd; /* volume command */
BYTE nVolume; /* volume level */
BYTE nPanning; /* stereo panning */
LONG dwFrequency; /* note frequency */
WORD wPeriod; /* note period */
} AUDIOTRACK, *LPAUDIOTRACK;
/* audio callback function defines */
typedef VOID (AIAPI* LPFNAUDIOWAVE)(LPBYTE, UINT);
typedef VOID (AIAPI* LPFNAUDIOTIMER)();
typedef VOID (AIAPI* LPFNAUDIOCALLBACK)(BYTE, UINT, UINT);
/* audio handle defines */
typedef HANDLE HAC;
typedef HAC* LPHAC;
#pragma pack()
/* audio interface API prototypes */
UINT AIAPI AInitialize();
UINT AIAPI AGetVersion();
UINT AIAPI AGetAudioNumDevs();
UINT AIAPI AGetAudioDevCaps(UINT nDeviceId, LPAUDIOCAPS lpCaps);
UINT AIAPI AGetErrorText(UINT nErrorCode, LPSTR lpText, UINT nSize);
UINT AIAPI APingAudio(LPUINT lpnDeviceId);
UINT AIAPI AOpenAudio(LPAUDIOINFO lpInfo);
UINT AIAPI ACloseAudio();
UINT AIAPI AUpdateAudio();
UINT AIAPI AUpdateAudioEx(UINT nFrames);
UINT AIAPI ASetAudioMixerValue(UINT nChannel, UINT nValue);
UINT AIAPI AOpenVoices(UINT nVoices);
UINT AIAPI ACloseVoices();
UINT AIAPI ASetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave);
UINT AIAPI ASetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer);
UINT AIAPI ASetAudioTimerRate(UINT nTimerRate);
LONG AIAPI AGetAudioDataAvail();
UINT AIAPI ACreateAudioData(LPAUDIOWAVE lpWave);
UINT AIAPI ADestroyAudioData(LPAUDIOWAVE lpWave);
UINT AIAPI AWriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount);
UINT AIAPI ACreateAudioVoice(LPHAC lphVoice);
UINT AIAPI ADestroyAudioVoice(HAC hVoice);
UINT AIAPI APlayVoice(HAC hVoice, LPAUDIOWAVE lpWave);
UINT AIAPI APrimeVoice(HAC hVoice, LPAUDIOWAVE lpWave);
UINT AIAPI AStartVoice(HAC hVoice);
UINT AIAPI AStopVoice(HAC hVoice);
UINT AIAPI ASetVoicePosition(HAC hVoice, LONG dwPosition);
UINT AIAPI ASetVoiceFrequency(HAC hVoice, LONG dwFrequency);
UINT AIAPI ASetVoiceVolume(HAC hVoice, UINT nVolume);
UINT AIAPI ASetVoicePanning(HAC hVoice, UINT nPanning);
UINT AIAPI AGetVoicePosition(HAC hVoice, LPLONG lpdwPosition);
UINT AIAPI AGetVoiceFrequency(HAC hVoice, LPLONG lpdwFrequency);
UINT AIAPI AGetVoiceVolume(HAC hVoice, LPUINT lpnVolume);
UINT AIAPI AGetVoicePanning(HAC hVoice, LPUINT lpnPanning);
UINT AIAPI AGetVoiceStatus(HAC hVoice, LPBOOL lpnStatus);
UINT AIAPI APlayModule(LPAUDIOMODULE lpModule);
UINT AIAPI AStopModule();
UINT AIAPI APauseModule();
UINT AIAPI AResumeModule();
UINT AIAPI ASetModuleVolume(UINT nVolume);
UINT AIAPI ASetModulePosition(UINT nOrder, UINT nRow);
UINT AIAPI AGetModuleVolume(LPUINT lpnVolume);
UINT AIAPI AGetModulePosition(LPUINT pnOrder, LPUINT lpnRow);
UINT AIAPI AGetModuleStatus(LPBOOL lpnStatus);
UINT AIAPI ASetModuleCallback(LPFNAUDIOCALLBACK lpfnAudioCallback);
UINT AIAPI ALoadModuleFile(LPSTR lpszFileName,
LPAUDIOMODULE* lplpModule, DWORD dwFileOffset);
UINT AIAPI AFreeModuleFile(LPAUDIOMODULE lpModule);
UINT AIAPI ALoadWaveFile(LPSTR lpszFileName,
LPAUDIOWAVE* lplpWave, DWORD dwFileOffset);
UINT AIAPI AFreeWaveFile(LPAUDIOWAVE lpWave);
UINT AIAPI AGetModuleTrack(UINT nTrack, LPAUDIOTRACK lpTrack);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -1,950 +0,0 @@
{*
* $Id: audio.h 1.16 1996/09/25 13:09:09 chasan released $
*
* SEAL Synthetic Audio Library API Interface
*
* Copyright (C) 1995-1999 Carlos Hasan
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*}
unit Audio;
interface
uses
SysUtils, Windows;
const
{ audio system version number }
AUDIO_SYSTEM_VERSION = $0101;
{ audio capabilities bit fields definitions }
AUDIO_FORMAT_1M08 = $00000001;
AUDIO_FORMAT_1S08 = $00000002;
AUDIO_FORMAT_1M16 = $00000004;
AUDIO_FORMAT_1S16 = $00000008;
AUDIO_FORMAT_2M08 = $00000010;
AUDIO_FORMAT_2S08 = $00000020;
AUDIO_FORMAT_2M16 = $00000040;
AUDIO_FORMAT_2S16 = $00000080;
AUDIO_FORMAT_4M08 = $00000100;
AUDIO_FORMAT_4S08 = $00000200;
AUDIO_FORMAT_4M16 = $00000400;
AUDIO_FORMAT_4S16 = $00000800;
{ audio format bit fields defines for devices and waveforms }
AUDIO_FORMAT_8BITS = $0000;
AUDIO_FORMAT_16BITS = $0001;
AUDIO_FORMAT_LOOP = $0010;
AUDIO_FORMAT_BIDILOOP = $0020;
AUDIO_FORMAT_REVERSE = $0080;
AUDIO_FORMAT_MONO = $0000;
AUDIO_FORMAT_STEREO = $0100;
AUDIO_FORMAT_FILTER = $8000;
{ audio resource limits defines }
AUDIO_MAX_VOICES = 32;
AUDIO_MAX_SAMPLES = 16;
AUDIO_MAX_PATCHES = 128;
AUDIO_MAX_PATTERNS = 256;
AUDIO_MAX_ORDERS = 256;
AUDIO_MAX_NOTES = 96;
AUDIO_MAX_POINTS = 12;
AUDIO_MIN_PERIOD = 1;
AUDIO_MAX_PERIOD = 31999;
AUDIO_MIN_VOLUME = $00;
AUDIO_MAX_VOLUME = $40;
AUDIO_MIN_PANNING = $00;
AUDIO_MAX_PANNING = $FF;
AUDIO_MIN_POSITION = $00000000;
AUDIO_MAX_POSITION = $00100000;
AUDIO_MIN_FREQUENCY = $00000200;
AUDIO_MAX_FREQUENCY = $00080000;
{ audio error code defines }
AUDIO_ERROR_NONE = $0000;
AUDIO_ERROR_INVALHANDLE = $0001;
AUDIO_ERROR_INVALPARAM = $0002;
AUDIO_ERROR_NOTSUPPORTED = $0003;
AUDIO_ERROR_BADDEVICEID = $0004;
AUDIO_ERROR_NODEVICE = $0005;
AUDIO_ERROR_DEVICEBUSY = $0006;
AUDIO_ERROR_BADFORMAT = $0007;
AUDIO_ERROR_NOMEMORY = $0008;
AUDIO_ERROR_NODRAMMEMORY = $0009;
AUDIO_ERROR_FILENOTFOUND = $000A;
AUDIO_ERROR_BADFILEFORMAT = $000B;
AUDIO_LAST_ERROR = $000B;
{ audio device identifiers }
AUDIO_DEVICE_NONE = $0000;
AUDIO_DEVICE_MAPPER = $FFFF;
{ audio product identifiers }
AUDIO_PRODUCT_NONE = $0000;
AUDIO_PRODUCT_SB = $0001;
AUDIO_PRODUCT_SB15 = $0002;
AUDIO_PRODUCT_SB20 = $0003;
AUDIO_PRODUCT_SBPRO = $0004;
AUDIO_PRODUCT_SB16 = $0005;
AUDIO_PRODUCT_AWE32 = $0006;
AUDIO_PRODUCT_WSS = $0007;
AUDIO_PRODUCT_ESS = $0008;
AUDIO_PRODUCT_GUS = $0009;
AUDIO_PRODUCT_GUSDB = $000A;
AUDIO_PRODUCT_GUSMAX = $000B;
AUDIO_PRODUCT_IWAVE = $000C;
AUDIO_PRODUCT_PAS = $000D;
AUDIO_PRODUCT_PAS16 = $000E;
AUDIO_PRODUCT_ARIA = $000F;
AUDIO_PRODUCT_WINDOWS = $0100;
AUDIO_PRODUCT_LINUX = $0101;
AUDIO_PRODUCT_SPARC = $0102;
AUDIO_PRODUCT_SGI = $0103;
AUDIO_PRODUCT_DSOUND = $0104;
{ audio envelope bit fields }
AUDIO_ENVELOPE_ON = $0001;
AUDIO_ENVELOPE_SUSTAIN = $0002;
AUDIO_ENVELOPE_LOOP = $0004;
{ audio pattern bit fields }
AUDIO_PATTERN_PACKED = $0080;
AUDIO_PATTERN_NOTE = $0001;
AUDIO_PATTERN_SAMPLE = $0002;
AUDIO_PATTERN_VOLUME = $0004;
AUDIO_PATTERN_COMMAND = $0008;
AUDIO_PATTERN_PARAMS = $0010;
{ audio module bit fields }
AUDIO_MODULE_AMIGA = $0000;
AUDIO_MODULE_LINEAR = $0001;
AUDIO_MODULE_PANNING = $8000;
type
{ audio capabilities structure }
PAudioCaps = ^TAudioCaps;
TAudioCaps = record
wProductId : Word; { product identifier }
szProductName : Array [0..29] of Char; { product name }
dwFormats : Longint; { formats supported }
end;
{ audio format structure }
PAudioInfo = ^TAudioInfo;
TAudioInfo = record
nDeviceId : Integer; { device identifier }
wFormat : Word; { playback format }
nSampleRate : Word; { sampling rate }
end;
{ audio waveform structure }
PAudioWave = ^TAudioWave;
TAudioWave = record
pData : Pointer; { data pointer }
dwHandle : Longint; { waveform handle }
dwLength : Longint; { waveform length }
dwLoopStart : Longint; { loop start point }
dwLoopEnd : Longint; { loop end point }
nSampleRate : Word; { sampling rate }
wFormat : Word; { format bits }
end;
{ audio envelope point structure }
PAudioPoint = ^TAudioPoint;
TAudioPoint = record
nFrame : Word; { envelope frame }
nValue : Word; { envelope value }
end;
{ audio envelope structure }
PAudioEnvelope = ^TAudioEnvelope;
TAudioEnvelope = record
aEnvelope : Array [1..AUDIO_MAX_POINTS] of TAudioPoint; { envelope points }
nPoints : Byte; { number of points }
nSustain : Byte; { sustain point }
nLoopStart : Byte; { loop start point }
nLoopEnd : Byte; { loop end point }
wFlags : Word; { envelope flags }
nSpeed : Word; { envelope speed }
end;
{ audio sample structure }
PAudioSample = ^TAudioSample;
TAudioSample = record
szSampleName : Array [0..31] of Char; { sample name }
nVolume : Byte; { default volume }
nPanning : Byte; { default panning }
nRelativeNote : Byte; { relative note }
nFinetune : Byte; { finetune }
Wave : TAudioWave; { waveform handle }
end;
{ audio patch structure }
PAudioPatch = ^TAudioPatch;
TAudioPatch = record
szPatchName : Array [0..31] of Char; { patch name }
aSampleNumber : Array [1..AUDIO_MAX_NOTES] of Byte; { multi-sample table }
nSamples : Word; { number of samples }
nVibratoType : Byte; { vibrato type }
nVibratoSweep : Byte; { vibrato sweep }
nVibratoDepth : Byte; { vibrato depth }
nVibratoRate : Byte; { vibrato rate }
nVolumeFadeout : Word; { volume fadeout }
Volume : TAudioEnvelope; { volume envelope }
Panning : TAudioEnvelope; { panning envelope }
aSampleTable : PAudioSample; { sample table }
end;
{ audio pattern structure }
PAudioPattern = ^TAudioPattern;
TAudioPattern = record
nPacking : Word; { packing type }
nTracks : Word; { number of tracks }
nRows : Word; { number of rows }
nSize : Word; { data size }
pData : Pointer; { data pointer }
end;
{ audio module structure }
PAudioModule = ^TAudioModule;
TAudioModule = record
szModuleName : Array [0..31] of Char; { module name }
wFlags : Word; { module flags }
nOrders : Word; { number of orders }
nRestart : Word; { restart position }
nTracks : Word; { number of tracks }
nPatterns : Word; { number of patterns }
nPatches : Word; { number of patches }
nTempo : Word; { initial tempo }
nBPM : Word; { initial BPM }
aOrderTable : Array [1..AUDIO_MAX_ORDERS] of Byte; { order table }
aPanningTable : Array [1..AUDIO_MAX_VOICES] of Byte; { panning table }
aPatternTable : PAudioPattern; { pattern table }
aPatchTable : PAudioPatch; { patch table }
end;
{ audio callback function defines }
TAudioWaveProc = procedure (pData: Pointer; nCount: Integer); stdcall;
TAudioTimerProc = procedure; stdcall;
TAudioCallback = procedure(nSyncMark: Byte; nOrder, nRow: Integer); stdcall;
{ audio handle defines }
PHAC = ^HAC;
HAC = Integer;
{ audio interface API prototypes }
function AInitialize: Integer; stdcall;
function AGetVersion: Integer; stdcall;
function AGetAudioNumDevs: Integer; stdcall;
function AGetAudioDevCaps(nDeviceId: Integer; var pCaps: TAudioCaps): Integer; stdcall;
function AGetErrorText(nErrorCode: Integer; pText: PChar; nSize: Integer): Integer; stdcall;
function APingAudio(var pnDeviceId: Integer): Integer; stdcall;
function AOpenAudio(var pInfo: TAudioInfo): Integer; stdcall;
function ACloseAudio: Integer; stdcall;
function AUpdateAudio: Integer; stdcall;
function AOpenVoices(nVoices: Integer): Integer; stdcall;
function ACloseVoices: Integer; stdcall;
function ASetAudioCallback(pfnWaveProc: TAudioWaveProc): Integer; stdcall;
function ASetAudioTimerProc(pfnTimerProc: TAudioTimerProc): Integer; stdcall;
function ASetAudioTimerRate(nTimerRate: Integer): Integer; stdcall;
function AGetAudioDataAvail: Longint; stdcall;
function ACreateAudioData(pWave: PAudioWave): Integer; stdcall;
function ADestroyAudioData(pWave: PAudioWave): Integer; stdcall;
function AWriteAudioData(pWave: PAudioWave; dwOffset: Longint; nCount: Integer): Integer; stdcall;
function ACreateAudioVoice(var phVoice: HAC): Integer; stdcall;
function ADestroyAudioVoice(hVoice: HAC): Integer; stdcall;
function APlayVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall;
function APrimeVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall;
function AStartVoice(hVoice: HAC): Integer; stdcall;
function AStopVoice(hVoice: HAC): Integer; stdcall;
function ASetVoicePosition(hVoice: HAC; dwPosition: Longint): Integer; stdcall;
function ASetVoiceFrequency(hVoice: HAC; dwFrequency: Longint): Integer; stdcall;
function ASetVoiceVolume(hVoice: HAC; nVolume: Integer): Integer; stdcall;
function ASetVoicePanning(hVoice: HAC; nPanning: Integer): Integer; stdcall;
function AGetVoicePosition(hVoice: HAC; var pdwPosition: Longint): Integer; stdcall;
function AGetVoiceFrequency(hVoice: HAC; var pdwFrequency: Longint): Integer; stdcall;
function AGetVoiceVolume(hVoice: HAC; var pnVolume: Integer): Integer; stdcall;
function AGetVoicePanning(hVoice: HAC; var pnPanning: Integer): Integer; stdcall;
function AGetVoiceStatus(hVoice: HAC; var pnStatus: Integer): Integer; stdcall;
function APlayModule(pModule: PAudioModule): Integer; stdcall;
function AStopModule: Integer; stdcall;
function APauseModule: Integer; stdcall;
function AResumeModule: Integer; stdcall;
function ASetModuleVolume(nVolume: Integer): Integer; stdcall;
function ASetModulePosition(nOrder, nRow: Integer): Integer; stdcall;
function AGetModuleVolume(var pnVolume: Integer): Integer; stdcall;
function AGetModulePosition(var pnOrder, pnRow: Integer): Integer; stdcall;
function AGetModuleStatus(var pnStatus: Integer): Integer; stdcall;
function ASetModuleCallback(pfnAudioCallback: TAudioCallback): Integer; stdcall;
function ALoadModuleFile(pszFileName: PChar; var ppModule: PAudioModule; FileOffset: Longint): Integer; stdcall;
function AFreeModuleFile(pModule: PAudioModule): Integer; stdcall;
function ALoadWaveFile(pszFileName: PChar; var ppWave: PAudioWave; FileOffset: Longint): Integer; stdcall;
function AFreeWaveFile(pWave: PAudioWave): Integer; stdcall;
type
TAudio = class(TObject)
constructor Create(Format: Word; SampleRate: Word);
destructor Destroy; override;
procedure Update;
private
FInfo: TAudioInfo;
function GetProductId: Integer;
function GetProductName: String;
public
property DeviceId: Integer read FInfo.nDeviceId;
property ProductId: Integer read GetProductId;
property ProductName: String read GetProductName;
property Format: Word read FInfo.wFormat;
property SampleRate: Word read FInfo.nSampleRate;
end;
TWaveform = class(TObject)
constructor Create(Format: Word; SampleRate: Word;
Length, LoopStart, LoopEnd: Longint);
constructor LoadFromFile(FileName: String);
destructor Destroy; override;
procedure Write(var Buffer; Count: Integer);
private
FHandle: TAudioWave;
PHandle: PAudioWave;
FVolume: Integer;
FPanning: Integer;
FPosition: Longint;
function GetHandle: PAudioWave;
procedure SetSampleRate(Value: Word);
procedure SetVolume(Value: Integer);
procedure SetPanning(Value: Integer);
procedure SetPosition(Value: LongInt);
public
property Handle: PAudioWave read GetHandle;
property Format: Word read FHandle.wFormat;
property Length: Longint read FHandle.dwLength;
property LoopStart: Longint read FHandle.dwLoopStart;
property LoopEnd: Longint read FHandle.dwLoopEnd;
property SampleRate: Word read FHandle.nSampleRate write SetSampleRate;
property Volume: Integer read FVolume write SetVolume;
property Panning: Integer read FPanning write SetPanning;
property Position: Longint read FPosition write SetPosition;
end;
TVoice = class(TObject)
constructor Create;
destructor Destroy; override;
procedure Prime(Wave: TWaveform);
procedure Play(Wave: TWaveform);
procedure Start;
procedure Stop;
private
FHandle: HAC;
FWave: TWaveform;
function GetHandle: HAC;
function GetWaveform: TWaveform;
function GetPosition: Longint;
procedure SetPosition(Value: Longint);
function GetFrequency: Longint;
procedure SetFrequency(Value: Longint);
function GetVolume: Integer;
procedure SetVolume(Value: Integer);
function GetPanning: Integer;
procedure SetPanning(Value: Integer);
function GetStopped: Boolean;
public
property Handle: HAC read GetHandle;
property Waveform: TWaveform read GetWaveform;
property Position: Longint read GetPosition write SetPosition;
property Frequency: Longint read GetFrequency write SetFrequency;
property Volume: Integer read GetVolume write SetVolume;
property Panning: Integer read GetPanning write SetPanning;
property Stopped: Boolean read GetStopped;
end;
TModule = class(TObject)
constructor LoadFromFile(FileName: String);
destructor Destroy; override;
procedure Play;
procedure Stop;
procedure Pause;
procedure Resume;
private
FHandle: PAudioModule;
FCallback: TAudioCallback;
function GetVolume: Integer;
procedure SetVolume(Value: Integer);
function GetOrder: Integer;
procedure SetOrder(Value: Integer);
function GetRow: Integer;
procedure SetRow(Value: Integer);
function GetStopped: Boolean;
procedure SetCallback(Value: TAudioCallback);
public
property Handle: PAudioModule read FHandle;
property Volume: Integer read GetVolume write SetVolume;
property Order: Integer read GetOrder write SetOrder;
property Row: Integer read GetRow write SetRow;
property Stopped: Boolean read GetStopped;
property OnSync: TAudioCallback read FCallback write SetCallback;
private
function GetName: String;
function GetNumOrders: Integer;
function GetNumTracks: Integer;
function GetNumPatterns: Integer;
function GetNumPatches: Integer;
function GetPatch(Index: Integer): PAudioPatch;
public
property Name: String read GetName;
property NumOrders: Integer read GetNumOrders;
property NumTracks: Integer read GetNumTracks;
property NumPatterns: Integer read GetNumPatterns;
property NumPatches: Integer read GetNumPatches;
property Patch[Index: Integer]: PAudioPatch read GetPatch;
end;
implementation
function AInitialize: Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVersion: Integer; stdcall; external 'AUDIOW32.DLL';
function AGetAudioNumDevs: Integer; stdcall; external 'AUDIOW32.DLL';
function AGetAudioDevCaps(nDeviceId: Integer; var pCaps: TAudioCaps): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetErrorText(nErrorCode: Integer; pText: PChar; nSize: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function APingAudio(var pnDeviceId: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AOpenAudio(var pInfo: TAudioInfo): Integer; stdcall; external 'AUDIOW32.DLL';
function ACloseAudio: Integer; stdcall; external 'AUDIOW32.DLL';
function AUpdateAudio: Integer; stdcall; external 'AUDIOW32.DLL';
function AOpenVoices(nVoices: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function ACloseVoices: Integer; stdcall; external 'AUDIOW32.DLL';
function ASetAudioCallback(pfnWaveProc: TAudioWaveProc): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetAudioTimerProc(pfnTimerProc: TAudioTimerProc): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetAudioTimerRate(nTimerRate: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetAudioDataAvail: Longint; stdcall; external 'AUDIOW32.DLL';
function ACreateAudioData(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
function ADestroyAudioData(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
function AWriteAudioData(pWave: PAudioWave; dwOffset: Longint; nCount: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function ACreateAudioVoice(var phVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
function ADestroyAudioVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
function APlayVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
function APrimeVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
function AStartVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
function AStopVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetVoicePosition(hVoice: HAC; dwPosition: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetVoiceFrequency(hVoice: HAC; dwFrequency: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetVoiceVolume(hVoice: HAC; nVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetVoicePanning(hVoice: HAC; nPanning: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVoicePosition(hVoice: HAC; var pdwPosition: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVoiceFrequency(hVoice: HAC; var pdwFrequency: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVoiceVolume(hVoice: HAC; var pnVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVoicePanning(hVoice: HAC; var pnPanning: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetVoiceStatus(hVoice: HAC; var pnStatus: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function APlayModule(pModule: PAudioModule): Integer; stdcall; external 'AUDIOW32.DLL';
function AStopModule: Integer; stdcall; external 'AUDIOW32.DLL';
function APauseModule: Integer; stdcall; external 'AUDIOW32.DLL';
function AResumeModule: Integer; stdcall; external 'AUDIOW32.DLL';
function ASetModuleVolume(nVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetModulePosition(nOrder, nRow: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetModuleVolume(var pnVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetModulePosition(var pnOrder, pnRow: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function AGetModuleStatus(var pnStatus: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
function ASetModuleCallback(pfnAudioCallback: TAudioCallback): Integer; stdcall; external 'AUDIOW32.DLL';
function ALoadModuleFile(pszFileName: PChar; var ppModule: PAudioModule; FileOffset: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function AFreeModuleFile(pModule: PAudioModule): Integer; stdcall; external 'AUDIOW32.DLL';
function ALoadWaveFile(pszFileName: PChar; var ppWave: PAudioWave; FileOffset: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
function AFreeWaveFile(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
const
Semaphore: LongBool = False;
PlayingModule: PAudioModule = nil;
function SetPlayingModule(Value: PAudioModule): Boolean; pascal; assembler;
asm
mov eax,True
xchg eax,Semaphore
cmp eax,False
jne @@1
mov eax,PlayingModule
test eax,eax
jne @@0
mov eax,Value
mov PlayingModule,eax
@@0:
mov Semaphore,False
@@1:
push edx
xor eax,eax
mov edx,PlayingModule
cmp edx,Value
sete al
pop edx
end;
procedure Assert(Header: String; ErrorCode: Integer);
var
szText: Array [0..255] of Char;
begin
if ErrorCode <> AUDIO_ERROR_NONE then
begin
AGetErrorText(ErrorCode, szText, sizeof(szText) - 1);
raise Exception.Create(Header + ': ' + StrPas(szText));
end;
end;
{ TAudio }
constructor TAudio.Create(Format: Word; SampleRate: Word);
begin
inherited Create;
FInfo.nDeviceId := AUDIO_DEVICE_MAPPER;
FInfo.wFormat := Format;
FInfo.nSampleRate := SampleRate;
Assert('AOpenAudio', AOpenAudio(FInfo));
Assert('AOpenVoices', AOpenVoices(32));
end;
destructor TAudio.Destroy;
begin
Assert('ACloseVoices', ACloseVoices);
Assert('ACloseAudio', ACloseAudio);
inherited Destroy;
end;
procedure TAudio.Update;
begin
Assert('AUpdateAudio', AUpdateAudio);
end;
function TAudio.GetProductId: Integer;
var
Caps: TAudioCaps;
begin
Assert('AGetAudioDevCaps', AGetAudioDevCaps(FInfo.nDeviceId, Caps));
Result := Caps.wProductId;
end;
function TAudio.GetProductName: String;
var
Caps: TAudioCaps;
begin
Assert('AGetAudioDevCaps', AGetAudioDevCaps(FInfo.nDeviceId, Caps));
Result := StrPas(Caps.szProductName);
end;
{ TWaveform }
constructor TWaveform.Create(Format: Word; SampleRate: Word;
Length, LoopStart, LoopEnd: Longint);
begin
inherited Create;
FPosition := 0;
FVolume := 64;
FPanning := 128;
FHandle.wFormat := Format;
FHandle.dwLength := Length;
FHandle.dwLoopStart := LoopStart;
FHandle.dwLoopEnd := LoopEnd;
FHandle.nSampleRate := SampleRate;
PHandle := nil;
Assert('ACreateAudioData', ACreateAudioData(@FHandle));
end;
constructor TWaveform.LoadFromFile(FileName: String);
var
szFileName: Array [0..255] of Char;
begin
inherited Create;
FPosition := 0;
FVolume := 64;
FPanning := 128;
FHandle.pData := nil;
FHandle.wFormat := AUDIO_FORMAT_8BITS or AUDIO_FORMAT_MONO;
FHandle.dwLength := 0;
FHandle.dwLoopStart := 0;
FHandle.dwLoopEnd := 0;
FHandle.nSampleRate := 22050;
Assert('ALoadWaveFile', ALoadWaveFile(StrPCopy(szFileName, FileName), PHandle, 0));
if Assigned(PHandle) then
FHandle := PHandle^;
end;
destructor TWaveform.Destroy;
begin
if Assigned(PHandle) then
begin
Assert('AFreeWaveFile', AFreeWaveFile(PHandle));
end
else if Assigned(FHandle.pData) then
begin
Assert('ADestroyAudioData', ADestroyAudioData(@FHandle));
end;
inherited Destroy;
end;
procedure TWaveform.Write(var Buffer; Count: Integer);
var
Size: Integer;
begin
if Assigned(FHandle.pData) then
begin
while (Count > 0) and (FHandle.dwLength > 0) do
begin
Size := Count;
if FPosition + Size > FHandle.dwLength then
Size := FHandle.dwLength - FPosition;
Move(Buffer, PChar(FHandle.pData)[FPosition], Size);
Assert('AWriteAudioData', AWriteAudioData(@FHandle, FPosition, Size));
Inc(FPosition, Size);
if FPosition >= FHandle.dwLength then
Dec(FPosition, FHandle.dwLength);
Dec(Count, Size);
end;
end;
end;
function TWaveform.GetHandle: PAudioWave;
begin
Result := @FHandle;
end;
procedure TWaveform.SetSampleRate(Value: Word);
begin
if (Value >= AUDIO_MIN_FREQUENCY) and (Value <= AUDIO_MAX_FREQUENCY) then
FHandle.nSampleRate := Value;
end;
procedure TWaveform.SetVolume(Value: Integer);
begin
if (Value >= AUDIO_MIN_VOLUME) and (Value <= AUDIO_MAX_VOLUME) then
FVolume := Value;
end;
procedure TWaveform.SetPanning(Value: Integer);
begin
if (Value >= AUDIO_MIN_PANNING) and (Value <= AUDIO_MAX_PANNING) then
FPanning := Value;
end;
procedure TWaveform.SetPosition(Value: LongInt);
begin
if (Value >= 0) and (Value < FHandle.dwLength) then
FPosition := Value;
end;
{ TVoice}
constructor TVoice.Create;
begin
inherited Create;
FWave := nil;
Assert('ACreateAudioVoice', ACreateAudioVoice(FHandle));
end;
destructor TVoice.Destroy;
begin
if FHandle <> 0 then
Assert('ADestroyAudioVoice', ADestroyAudioVoice(FHandle));
inherited Destroy;
end;
procedure TVoice.Prime(Wave: TWaveform);
begin
if Assigned(Wave) then
begin
FWave := Wave;
Assert('APrimeVoice', APrimeVoice(FHandle, FWave.Handle));
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, FWave.SampleRate));
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, FWave.Volume));
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, FWave.Panning));
end;
end;
procedure TVoice.Play(Wave: TWaveform);
begin
if Assigned(Wave) then
begin
FWave := Wave;
Assert('APrimeVoice', APrimeVoice(FHandle, FWave.Handle));
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, FWave.SampleRate));
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, FWave.Volume));
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, FWave.Panning));
Assert('AStartVoice', AStartVoice(FHandle));
end;
end;
procedure TVoice.Start;
begin
Assert('AStartVoice', AStartVoice(FHandle));
end;
procedure TVoice.Stop;
begin
Assert('AStopVoice', AStopVoice(FHandle));
end;
function TVoice.GetHandle: HAC;
begin
Result := FHandle;
end;
function TVoice.GetWaveform: TWaveform;
begin
Result := FWave;
end;
function TVoice.GetPosition: Longint;
var
Value: Longint;
begin
Assert('AGetVoicePosition', AGetVoicePosition(FHandle, Value));
Result := Value;
end;
procedure TVoice.SetPosition(Value: Longint);
begin
Assert('ASetVoicePosition', ASetVoicePosition(FHandle, Value));
end;
function TVoice.GetFrequency: Longint;
var
Value: Longint;
begin
Assert('AGetVoiceFrequency', AGetVoiceFrequency(FHandle, Value));
Result := Value;
end;
procedure TVoice.SetFrequency(Value: Longint);
begin
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, Value));
end;
function TVoice.GetVolume: Integer;
var
Value: Integer;
begin
Assert('AGetVoiceVolume', AGetVoiceVolume(FHandle, Value));
Result := Value;
end;
procedure TVoice.SetVolume(Value: Integer);
begin
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, Value));
end;
function TVoice.GetPanning: Integer;
var
Value: Integer;
begin
Assert('AGetVoicePanning', AGetVoicePanning(FHandle, Value));
Result := Value;
end;
procedure TVoice.SetPanning(Value: Integer);
begin
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, Value));
end;
function TVoice.GetStopped: Boolean;
var
Value: Integer;
begin
Assert('AGetVoiceStatus', AGetVoiceStatus(FHandle, Value));
Result := Value <> 0;
end;
{ TModule }
constructor TModule.LoadFromFile(FileName: String);
var
szFileName: Array [0..255] of Char;
begin
inherited Create;
FHandle := nil;
FCallback := nil;
Assert('ALoadModuleFile', ALoadModuleFile(StrPCopy(szFileName, FileName), FHandle, 0));
end;
destructor TModule.Destroy;
begin
if Assigned(FHandle) then
begin
if not Stopped then Stop;
Assert('AFreeModuleFile', AFreeModuleFile(FHandle));
end;
inherited Destroy;
end;
procedure TModule.Play;
begin
if Assigned(FHandle) and SetPlayingModule(FHandle) then
Assert('APlayModule', APlayModule(FHandle));
end;
procedure TModule.Stop;
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
Assert('AStopModule', AStopModule);
PlayingModule := nil;
end;
end;
procedure TModule.Pause;
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
Assert('APauseModule', APauseModule);
end;
procedure TModule.Resume;
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
Assert('AResumeModule', AResumeModule);
end;
function TModule.GetVolume: Integer;
var
Value: Integer;
begin
Result := 0;
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
Assert('AGetModuleVolume', AGetModuleVolume(Value));
Result := Value;
end;
end;
procedure TModule.SetVolume(Value: Integer);
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
Assert('ASetModuleVolume', ASetModuleVolume(Value));
end;
function TModule.GetOrder: Integer;
var
Order, Row: Integer;
begin
Result := 0;
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
Assert('AGetModulePosition', AGetModulePosition(Order, Row));
Result := Order;
end;
end;
procedure TModule.SetOrder(Value: Integer);
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
Assert('ASetModulePosition', ASetModulePosition(Value, Row));
end;
function TModule.GetRow: Integer;
var
Order, Row: Integer;
begin
Result := 0;
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
Assert('AGetModulePosition', AGetModulePosition(Order, Row));
Result := Row;
end;
end;
procedure TModule.SetRow(Value: Integer);
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
Assert('ASetModulePosition', ASetModulePosition(Order, Value));
end;
function TModule.GetStopped: Boolean;
var
Value: Integer;
begin
Result := True;
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
Assert('AGetModuleStatus', AGetModuleStatus(Value));
Result := Value <> 0;
end;
end;
procedure TModule.SetCallback(Value: TAudioCallback);
begin
if Assigned(FHandle) and (PlayingModule = FHandle) then
begin
FCallback := Value;
Assert('ASetModuleCallback', ASetModuleCallback(Value));
end;
end;
function TModule.GetName: String;
begin
Result := '';
if Assigned(FHandle) then
Result := StrPas(FHandle^.szModuleName);
end;
function TModule.GetNumOrders: Integer;
begin
Result := 0;
if Assigned(FHandle) then
Result := FHandle^.nOrders;
end;
function TModule.GetNumTracks: Integer;
begin
Result := 0;
if Assigned(FHandle) then
Result := FHandle^.nTracks;
end;
function TModule.GetNumPatterns: Integer;
begin
Result := 0;
if Assigned(FHandle) then
Result := FHandle^.nPatterns;
end;
function TModule.GetNumPatches: Integer;
begin
Result := 0;
if Assigned(FHandle) then
Result := FHandle^.nPatches;
end;
function TModule.GetPatch(Index: Integer): PAudioPatch;
begin
Result := nil;
if Assigned(FHandle) then
begin
if (Index >= 1) and (Index <= FHandle^.nPatches) then
Result := PAudioPatch(@PChar(FHandle^.aPatchTable)[sizeof(TAudioPatch) * Pred(Index)]);
end;
end;
end.

View File

@@ -1,36 +0,0 @@
# Makefile for BeOS Release 4 operating systems
CC = gcc
AR = ar
AS = nasm
CFLAGS = -c -O3 -Wall -Wno-multichar -D__ASM__ -D__FLAT__
ARFLAGS = cr
LIBS = -L../lib/BeOS/ -laudio -lroot -lbe -lmedia
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
iofile.o modeng.o nondrv.o mixdrv.o _mixdrv.o be3drv.o bedrv.o
LIB = ../lib/BeOS/libaudio.a
all : mp clean
@echo done.
mp : mp.o $(LIB)
$(CC) -o mp mp.o $(LIBS)
$(LIB) : $(OBJS)
$(AR) $(ARFLAGS) $(LIB) $(OBJS)
.SUFFIXES: .c .cpp .h .obj
.c.o:
$(CC) $(CFLAGS) $<
.cpp.o:
$(CC) $(CFLAGS) $<
.asm.o:
$(AS) $<
clean :
@rm -rf *.o

View File

@@ -1,45 +0,0 @@
/* audio_driver.h */
/* Jon Watte 19971223 */
/* Interface to drivers found in /dev/audio */
/* Devices found in /dev/old follow a different API! */
#if !defined(_AUDIO_DRIVER_H)
#define _AUDIO_DRIVER_H
#if !defined(_SUPPORT_DEFS_H)
#include <SupportDefs.h>
#endif /* _SUPPORT_DEFS_H */
#if !defined(_DRIVERS_H)
#include <Drivers.h>
#endif /* _DRIVERS_H */
enum {
/* arg = ptr to struct audio_format */
B_AUDIO_GET_AUDIO_FORMAT = B_AUDIO_DRIVER_BASE,
B_AUDIO_SET_AUDIO_FORMAT,
/* arg = ptr to float[4] */
B_AUDIO_GET_PREFERRED_SAMPLE_RATES
};
/* this is the definition of what the audio driver can do for you */
typedef struct audio_format {
float sample_rate; /* ~4000 - ~48000, maybe more */
int32 channels; /* 1 or 2 */
int32 format; /* 0x11 (uchar), 0x2 (short) or 0x24 (float) */
int32 big_endian; /* 0 for little endian, 1 for big endian */
size_t buf_header; /* typically 0 or 16 */
size_t play_buf_size; /* size of playback buffer (latency) */
size_t rec_buf_size; /* size of record buffer (latency) */
} audio_format;
/* when buffer header is in effect, this is what gets read before data */
typedef struct audio_buf_header {
bigtime_t capture_time;
uint32 capture_size;
float sample_rate;
} audio_buf_header;
#endif /* _AUDIO_DRIVER_H */

View File

@@ -1,86 +0,0 @@
/* audio_driver.h - BeOS Release 3 interface to sound drivers */
#ifndef _AUDIO_DRIVER_H_
#define _AUDIO_DRIVER_H_
#include <Drivers.h>
enum {
B_AUDIO_GET_PARAMS = B_DEVICE_OP_CODES_END,
B_AUDIO_SET_PARAMS,
B_AUDIO_SET_PLAYBACK_COMPLETION_SEM,
B_AUDIO_SET_CAPTURE_COMPLETION_SEM,
B_AUDIO_RESERVED_1, /* unused */
B_AUDIO_RESERVED_2, /* unused */
B_AUDIO_DEBUG_ON, /* unused */
B_AUDIO_DEBUG_OFF, /* unused */
B_AUDIO_WRITE_BUFFER,
B_AUDIO_READ_BUFFER,
B_AUDIO_LOCK_FOR_DMA
};
enum {
B_AUDIO_ADC_SOURCE_LINE = 0,
B_AUDIO_ADC_SOURCE_CDROM,
B_AUDIO_ADC_SOURCE_MIC,
B_AUDIO_ADC_SOURCE_LOOPBACK
};
enum {
B_AUDIO_SAMPLE_RATE_8000 = 0,
B_AUDIO_SAMPLE_RATE_5510 = 1,
B_AUDIO_SAMPLE_RATE_16000 = 2,
B_AUDIO_SAMPLE_RATE_11025 = 3,
B_AUDIO_SAMPLE_RATE_27420 = 4,
B_AUDIO_SAMPLE_RATE_18900 = 5,
B_AUDIO_SAMPLE_RATE_32000 = 6,
B_AUDIO_SAMPLE_RATE_22050 = 7,
B_AUDIO_SAMPLE_RATE_37800 = 9,
B_AUDIO_SAMPLE_RATE_44100 = 11,
B_AUDIO_SAMPLE_RATE_48000 = 12,
B_AUDIO_SAMPLE_RATE_33075 = 13,
B_AUDIO_SAMPLE_RATE_9600 = 14,
B_AUDIO_SAMPLE_RATE_6620 = 15
};
struct audio_channel {
uint32 adc_source; /* adc input source */
char adc_gain; /* 0-15 adc gain, in 1.5 dB steps */
char mic_gain_enable; /* non-zero enables 20 dB MIC input gain */
char cd_mix_gain; /* 0-31 cd mix to output gain in -1.5dB steps */
char cd_mix_mute; /* non-zero mutes cd mix */
char aux2_mix_gain; /* unused */
char aux2_mix_mute; /* unused */
char line_mix_gain; /* 0-31 line mix to out gain in -1.5dB steps */
char line_mix_mute; /* non-zero mutes line mix */
char dac_attn; /* 0-61 dac attenuation, in -1.5 dB steps */
char dac_mute; /* non-zero mutes dac output */
char reserved_1;
char reserved_2;
};
typedef struct audio_params {
struct audio_channel left; /* left channel setup */
struct audio_channel right; /* right channel setup */
uint32 sample_rate; /* sample rate */
uint32 playback_format; /* ignore (always 16bit-linear) */
uint32 capture_format; /* ignore (always 16bit-linear) */
char dither_enable; /* non-zero enables dither on 16 => 8 bit */
char mic_attn; /* 0..64 mic input level */
char mic_enable; /* non-zero enables mic input */
char output_boost; /* ignore (always on) */
char highpass_enable; /* ignore (always on) */
char mono_gain; /* 0..64 mono speaker gain */
char mono_mute; /* non-zero mutes speaker */
} audio_params;
typedef struct audio_buffer_header {
int32 buffer_number;
int32 subscriber_count;
bigtime_t time;
int32 reserved_1;
int32 reserved_2;
bigtime_t sample_clock;
} audio_buffer_header;
#endif

View File

@@ -1,33 +0,0 @@
# Makefile for Borland C++ 4.5 (DPMI16 protected mode, large memory model)
CC = bcc
AS = tasm
AR = tlib
CFLAGS = -ml -WX -c -w9 -3 -O2 -D__DPMI__ -D__16BIT__
AFLAGS = -t -m -q -zi
LFLAGS = -ml -WX
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
iofile.obj modeng.obj nondrv.obj mixdrv.obj msdos.obj \
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
LIB = ..\lib\DOS\audiobcx.lib
all : mp.exe $(LIB) clean
@echo done.
mp.exe : mp.obj $(LIB)
$(CC) $(LFLAGS) mp.obj $(LIB)
$(LIB) : $(OBJS)
@if exist $(LIB) del $(LIB) > nul
$(AR) $(LIB) @DOS\DPMI16\Borland\audiobcx.lnk
.c.obj :
$(CC) $(CFLAGS) $<
.asm.obj :
$(AS) $(AFLAGS) $<
clean :
@if exist *.obj del *.obj > nul

View File

@@ -1 +0,0 @@
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +msdos.obj +sbdrv.obj +awedrv.obj +pasdrv.obj +wssdrv.obj +gusdrv.obj +ariadrv.obj

View File

@@ -1,33 +0,0 @@
# Makefile for Borland C++ 4.5 (DPMI32 protected mode, flat memory model)
CC = bcc32a
AS = tasm
AR = tlib
CFLAGS = -WX -c -w9 -5 -O2 -D__DPMI__ -D__ASM__
AFLAGS = -t -m -q -ml -zi
LFLAGS = -WX
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj msdos.obj \
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
LIB = ..\lib\DOS\audiobcf.lib
all : mp.exe $(LIB) clean
@echo done.
mp.exe : mp.obj $(LIB)
$(CC) $(LFLAGS) mp.obj $(LIB)
$(LIB) : $(OBJS)
@if exist $(LIB) del $(LIB) > nul
$(AR) $(LIB) @DOS\DPMI32\Borland\audiobcf.lnk
.c.obj :
$(CC) $(CFLAGS) $<
.asm.obj :
$(AS) $(AFLAGS) $<
clean :
@if exist *.obj del *.obj > nul

View File

@@ -1 +0,0 @@
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +_mixdrv.obj +msdos.obj +sbdrv.obj +awedrv.obj +pasdrv.obj +wssdrv.obj +gusdrv.obj +ariadrv.obj

View File

@@ -1,39 +0,0 @@
# Makefile for DJGPP V2.0 (GO32/DPMI32 protected mode, flat memory model)
CC = gcc
AR = ar
RANLIB = ranlib
STRIP = strip
COFF2EXE = stubify
CFLAGS = -c -Wall -mpentium -O2 -D__DPMI__ -D__ASM__
LFLAGS =
#OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
# iofile.o modeng.o nondrv.o mixdrv.o _mixdrv.o msdos.o \
# sbdrv.o awedrv.o pasdrv.o wssdrv.o gusdrv.o ariadrv.o
OBJS = audiodj.o _mixdrv.o
LIB = ../lib/DOS/libaudio.a
all : mp.exe $(LIB) clean
@echo done.
mp.exe : mp.o $(LIB)
$(CC) -o mp mp.o $(LIB) $(LFLAGS)
$(STRIP) mp
$(COFF2EXE) mp
@del mp > nul
$(LIB) : $(OBJS)
@$(AR) rc $(LIB) $(OBJS)
$(RANLIB) $(LIB)
.c.o :
$(CC) $(CFLAGS) $<
.s.o :
$(CC) $(CFLAGS) $*.S
clean :
@if exist *.o del *.o > nul

View File

@@ -1,40 +0,0 @@
# Makefile for WATCOM C/C++32 10.0 (DOS4GW protected mode, flat memory model)
CC = wcc386
LD = wcl386
AS = tasm
AR = wlib -s -t -q -n
CFLAGS = -zq -zu -w9 -we -5r -s -oxt -D__DPMI__ -D__ASM__
AFLAGS = -t -m -q -ml -zi
LFLAGS = -l=dos4g -zq
#AS = wasm
#AFLAGS = -zq -w9 -we -5r
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj msdos.obj \
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
LIB = "..\lib\DOS\audiowcf.lib"
all : mp.exe $(LIB) clean .SYMBOLIC
@echo done.
mp.exe : mp.obj $(LIB)
$(LD) mp.obj $(LIB) $(LFLAGS)
$(LIB) : $(OBJS)
@echo $(OBJS) > audiowcf.lnk
$(AR) $(LIB) @audiowcf.lnk
@del audiowcf.lnk
.SUFFIXES: .c .asm .obj
.c.obj :
$(CC) $(CFLAGS) $<
.asm.obj :
$(AS) $(AFLAGS) $<
clean : .SYMBOLIC
@if exist *.obj del *.obj > nul

View File

@@ -1,33 +0,0 @@
# Makefile for Borland C++ 4.5 (DOS real mode, large memory model)
CC = bcc
AS = tasm
AR = tlib
CFLAGS = -ml -c -w9 -3 -O2 -D__DOS16__ -D__16BIT__
AFLAGS = -t -m -q -zi
LFLAGS = -ml
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
iofile.obj modeng.obj nondrv.obj mixdrv.obj msdos.obj \
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
LIB = ..\lib\DOS\audiobcl.lib
all : mp.exe $(LIB) clean
@echo done.
mp.exe : mp.obj $(LIB)
$(CC) $(LFLAGS) mp.obj $(LIB)
$(LIB) : $(OBJS)
@if exist $(LIB) del $(LIB) > nul
$(AR) $(LIB) @DOS\Large\Borland\audiobcl.lnk
.c.obj :
$(CC) $(CFLAGS) $<
.asm.obj :
$(AS) $(AFLAGS) $<
clean :
@if exist *.obj del *.obj > nul

Some files were not shown because too many files have changed in this diff Show More