Browse Source

WineASIO 0.1.0

tags/v1.0.0
Joakim B Hernberg 10 years ago
parent
commit
db2263b39c
12 changed files with 1941 additions and 2601 deletions
  1. +114
    -0
      Makefile
  2. +0
    -18
      Makefile.in
  3. +35
    -0
      README.TXT
  4. +0
    -39
      ReadMe.txt
  5. +265
    -546
      asio.c
  6. +1070
    -0
      config.h
  7. +0
    -9
      libwineasio.def
  8. +0
    -1
      main.c
  9. +456
    -0
      port.h
  10. +1
    -1
      regsvr.c
  11. +0
    -1987
      wineasio.diff.txt
  12. +0
    -0
      wineasio.dll.spec

+ 114
- 0
Makefile View File

@@ -0,0 +1,114 @@
### Generated by Winemaker

PREFIX = /usr
SRCDIR = .
SUBDIRS =
DLLS = wineasio.dll
EXES =



### Common settings

CEXTRA = -g -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith
CXXEXTRA = -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith
RCEXTRA =
INCLUDE_PATH = -I. -I/usr/include -I$(PREFIX)/include -I$(PREFIX)/include/wine -I$(PREFIX)/include/wine/windows
DLL_PATH =
LIBRARY_PATH =
LIBRARIES =


### wineasio.dll sources and settings

wineasio_dll_MODULE = wineasio.dll
wineasio_dll_C_SRCS = asio.c \
main.c \
regsvr.c
wineasio_dll_CXX_SRCS =
wineasio_dll_RC_SRCS =
wineasio_dll_LDFLAGS = -shared \
$(wineasio_dll_MODULE:%=%.spec) \
-mnocygwin
wineasio_dll_DLL_PATH =
wineasio_dll_DLLS = odbc32 \
ole32 \
oleaut32 \
winspool \
winmm \
pthread
wineasio_dll_LIBRARY_PATH=
wineasio_dll_LIBRARIES= uuid

wineasio_dll_OBJS = $(wineasio_dll_C_SRCS:.c=.o) \
$(wineasio_dll_CXX_SRCS:.cpp=.o) \
$(wineasio_dll_RC_SRCS:.rc=.res)



### Global source lists

C_SRCS = $(wineasio_dll_C_SRCS)
CXX_SRCS = $(wineasio_dll_CXX_SRCS)
RC_SRCS = $(wineasio_dll_RC_SRCS)


### Tools

CC = gcc
CXX = g++
WINECC = winegcc
RC = wrc


### Generic targets

all: $(SUBDIRS) $(DLLS:%=%.so) $(EXES:%=%.so)

### Build rules

.PHONY: all clean dummy

$(SUBDIRS): dummy
@cd $@ && $(MAKE)

# Implicit rules

.SUFFIXES: .cpp .rc .res
DEFINCL = $(INCLUDE_PATH) $(DEFINES) $(OPTIONS)

.c.o:
$(CC) -c $(DEFINCL) $(CFLAGS) $(CEXTRA) -o $@ $<

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(CXXEXTRA) $(DEFINCL) -o $@ $<

.rc.res:
$(RC) $(RCFLAGS) $(RCEXTRA) $(DEFINCL) -fo$@ $<

# Rules for cleaning

CLEAN_FILES = y.tab.c y.tab.h lex.yy.c core *.orig *.rej \
\\\#*\\\# *~ *% .\\\#*

clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(C_SRCS:.c=.o) $(CXX_SRCS:.cpp=.o)
$(RM) $(DLLS:%=%.so) $(EXES:%=%.so) $(EXES:%.exe=%)

$(SUBDIRS:%=%/__clean__): dummy
cd `dirname $@` && $(MAKE) clean

$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)

### Target specific build rules
DEFLIB = $(LIBRARY_PATH) $(LIBRARIES) $(DLL_PATH)

$(wineasio_dll_MODULE).so: $(wineasio_dll_OBJS)
$(WINECC) $(wineasio_dll_LDFLAGS) -o $@ $(wineasio_dll_OBJS) $(wineasio_dll_LIBRARY_PATH) $(DEFLIB) $(wineasio_dll_DLLS:%=-l%) $(wineasio_dll_LIBRARIES:%=-l%)

install:
cp wineasio.dll.so $(PREFIX)/lib/wine

+ 0
- 18
Makefile.in View File

@@ -1,18 +0,0 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wineasio.dll
IMPORTLIB = libwineasio.$(IMPLIBEXT)
IMPORTS = winmm ole32 user32 advapi32 kernel32 ntdll
EXTRAINCL = @ASIOINCL@
EXTRALIBS = -ldxguid -luuid -ljack -lpthread

C_SRCS = \
asio.c \
main.c \
regsvr.c

@MAKE_DLL_RULES@

### Dependencies:

+ 35
- 0
README.TXT View File

@@ -0,0 +1,35 @@
Before installation edit the prefix path in the Makefile
PREFIX = <root path you use>

usually this will either be

PREFIX = /usr
or
PREFIX = /usr/local

Copy the file asio.h from Steinberg's asio-sdk to
the wineasio directory

then execute: make
and as root: make install

then, again as normal user: regsvr32 wineasio.dll

Notes:
The asio.c file uses 32 bit integer buffers, wich is supported by
most asio applications. The asio.c.float uses 32 bit float buffers and
thus avoids the format conversion necessary for jack.
You can set the number of ASIO inputs/outputs using evnironment variables

ASIO_INPUTS
ASIO_OUTPUTS

with bash e.g.:
export ASIO_INPUTS=4
export ASIO_OUTPUTS=8

original code: Robert Reif posted to the wine mailinglist
modified by: Ralf Beck (musical_snake@gmx.de)

todo:
- make timecode sync to jack transport

+ 0
- 39
ReadMe.txt View File

@@ -1,39 +0,0 @@
This is the second release of the wine ASIO driver.

Changes:

1. The ASIO driver now requires that the Steinberg ASIO SDK be installed to get ASIO support.
This appears to be how other open source projects deal with the ASIO technology licencing.

2. The first version was able to call Windows functions from the ASIO callback which was
called from the Jack thread. This only worked for programs that didn't call Windows
functions. The ASIO callback is now called from a Windows thread.

3. You should now be able to compile a dummy driver if Jack or the ASIO SDK are not installed.

4. A buffer swap bug was fixed.

Install:

1. Download the Steinberg ASIO SDK from: http://www.steinberg.net/324_1.html and
install it somewhere like: /usr/local/asiosdk2.1.

2. Patch wine with the wineasio.diff.txt patch.

3. Run autoconf to generate a new configure.

4. Run ./configure --with-asio-sdk=/usr/local/asiosdk2.1 (or wherever you installed the SDK).

5. Do the normal make depend, make and make install

6. Register the wineasio.dll by doing:
cd wine/dlls/wineasio
regsvr32 wineasio.dll.so

To Do:
ASIO control panel to set Jack parameters (devices, sample rate, buffer size, ...).
Better integration with wine.
You tell me.

Please send feeback to: reif@earthlink.net


+ 265
- 546
asio.c
File diff suppressed because it is too large
View File


+ 1070
- 0
config.h
File diff suppressed because it is too large
View File


+ 0
- 9
libwineasio.def View File

@@ -1,9 +0,0 @@
; File generated automatically from ./wineasio.spec; do not edit!

LIBRARY wineasio.dll

EXPORTS
DllRegisterServer@0 @1 PRIVATE
DllGetClassObject@12 @2 PRIVATE
DllCanUnloadNow@0 @3 PRIVATE
DllUnregisterServer@0 @4 PRIVATE

+ 0
- 1
main.c View File

@@ -152,7 +152,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return CLASS_E_CLASSNOTAVAILABLE;
}


/*******************************************************************************
* DllCanUnloadNow
* Determines whether the DLL is in use.


+ 456
- 0
port.h View File

@@ -0,0 +1,456 @@
/*
* Wine porting definitions
*
* Copyright 1996 Alexandre Julliard
*
* 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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/

#ifndef __WINE_WINE_PORT_H
#define __WINE_WINE_PORT_H

#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif

#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE /* for pread/pwrite */
#include <fcntl.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_DIRECT_H
# include <direct.h>
#endif
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifdef HAVE_PROCESS_H
# include <process.h>
#endif
#include <string.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif


/****************************************************************
* Type definitions
*/

#if !defined(_MSC_VER) && !defined(__int64)
# if defined(__x86_64__) || defined(_WIN64)
# define __int64 long
# else
# define __int64 long long
# endif
#endif

#ifndef HAVE_MODE_T
typedef int mode_t;
#endif
#ifndef HAVE_OFF_T
typedef long off_t;
#endif
#ifndef HAVE_PID_T
typedef int pid_t;
#endif
#ifndef HAVE_SIZE_T
typedef unsigned int size_t;
#endif
#ifndef HAVE_SSIZE_T
typedef int ssize_t;
#endif
#ifndef HAVE_FSBLKCNT_T
typedef unsigned long fsblkcnt_t;
#endif
#ifndef HAVE_FSFILCNT_T
typedef unsigned long fsfilcnt_t;
#endif

#ifndef HAVE_STRUCT_STATVFS_F_BLOCKS
struct statvfs
{
unsigned long f_bsize;
unsigned long f_frsize;
fsblkcnt_t f_blocks;
fsblkcnt_t f_bfree;
fsblkcnt_t f_bavail;
fsfilcnt_t f_files;
fsfilcnt_t f_ffree;
fsfilcnt_t f_favail;
unsigned long f_fsid;
unsigned long f_flag;
unsigned long f_namemax;
};
#endif /* HAVE_STRUCT_STATVFS_F_BLOCKS */


/****************************************************************
* Macro definitions
*/

#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#else
#define RTLD_LAZY 0x001
#define RTLD_NOW 0x002
#define RTLD_GLOBAL 0x100
#endif

#if !defined(HAVE_FTRUNCATE) && defined(HAVE_CHSIZE)
#define ftruncate chsize
#endif

#if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
#define popen _popen
#endif

#if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
#define pclose _pclose
#endif

#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
#define snprintf _snprintf
#endif

#if !defined(HAVE_VSNPRINTF) && defined(HAVE__VSNPRINTF)
#define vsnprintf _vsnprintf
#endif

#ifndef S_ISLNK
# define S_ISLNK(mod) (0)
#endif

#ifndef S_ISSOCK
# define S_ISSOCK(mod) (0)
#endif

#ifndef S_ISDIR
# define S_ISDIR(mod) (((mod) & _S_IFMT) == _S_IFDIR)
#endif

#ifndef S_ISCHR
# define S_ISCHR(mod) (((mod) & _S_IFMT) == _S_IFCHR)
#endif

#ifndef S_ISFIFO
# define S_ISFIFO(mod) (((mod) & _S_IFMT) == _S_IFIFO)
#endif

#ifndef S_ISREG
# define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG)
#endif

#ifndef S_IWUSR
# define S_IWUSR 0
#endif

/* So we open files in 64 bit access mode on Linux */
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif

#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif

#ifndef O_BINARY
# define O_BINARY 0
#endif

#if !defined(S_IXUSR) && defined(S_IEXEC)
# define S_IXUSR S_IEXEC
#endif
#if !defined(S_IXGRP) && defined(S_IEXEC)
# define S_IXGRP S_IEXEC
#endif
#if !defined(S_IXOTH) && defined(S_IEXEC)
# define S_IXOTH S_IEXEC
#endif


/****************************************************************
* Constants
*/

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

#ifndef M_PI_2
#define M_PI_2 1.570796326794896619
#endif


/* Macros to define assembler functions somewhat portably */

#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__APPLE__)
# define __ASM_GLOBAL_FUNC(name,code) \
__asm__( ".text\n\t" \
".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
__ASM_FUNC(#name) "\n" \
__ASM_NAME(#name) ":\n\t" \
code \
"\n\t.previous" );
#else /* defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__) */
# define __ASM_GLOBAL_FUNC(name,code) \
void __asm_dummy_##name(void) { \
asm( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
__ASM_FUNC(#name) "\n" \
__ASM_NAME(#name) ":\n\t" \
code ); \
}
#endif /* __GNUC__ */


/* Register functions */

#ifdef __i386__
#define DEFINE_REGS_ENTRYPOINT( name, args, pop_args ) \
__ASM_GLOBAL_FUNC( name, \
"pushl %eax\n\t" \
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
".long " __ASM_NAME("__regs_") #name "-.\n\t" \
".byte " #args "," #pop_args )
/* FIXME: add support for other CPUs */
#endif /* __i386__ */


/****************************************************************
* Function definitions (only when using libwine_port)
*/

#ifndef NO_LIBWINE_PORT

#ifndef HAVE_FSTATVFS
int fstatvfs( int fd, struct statvfs *buf );
#endif

#ifndef HAVE_GETOPT_LONG
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
struct option;

#ifndef HAVE_STRUCT_OPTION_NAME
struct option
{
const char *name;
int has_arg;
int *flag;
int val;
};
#endif

extern int getopt_long (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
extern int getopt_long_only (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
#endif /* HAVE_GETOPT_LONG */

#ifndef HAVE_FFS
int ffs( int x );
#endif

#ifndef HAVE_FUTIMES
struct timeval;
int futimes(int fd, const struct timeval tv[2]);
#endif

#ifndef HAVE_GETPAGESIZE
size_t getpagesize(void);
#endif /* HAVE_GETPAGESIZE */

#ifndef HAVE_GETTID
pid_t gettid(void);
#endif /* HAVE_GETTID */

#ifndef HAVE_LSTAT
int lstat(const char *file_name, struct stat *buf);
#endif /* HAVE_LSTAT */

#ifndef HAVE_MEMMOVE
void *memmove(void *dest, const void *src, size_t len);
#endif /* !defined(HAVE_MEMMOVE) */

#ifndef HAVE_PREAD
ssize_t pread( int fd, void *buf, size_t count, off_t offset );
#endif /* HAVE_PREAD */

#ifndef HAVE_PWRITE
ssize_t pwrite( int fd, const void *buf, size_t count, off_t offset );
#endif /* HAVE_PWRITE */

#ifndef HAVE_READLINK
int readlink( const char *path, char *buf, size_t size );
#endif /* HAVE_READLINK */

#ifndef HAVE_SIGSETJMP
# include <setjmp.h>
typedef jmp_buf sigjmp_buf;
int sigsetjmp( sigjmp_buf buf, int savesigs );
void siglongjmp( sigjmp_buf buf, int val );
#endif /* HAVE_SIGSETJMP */

#ifndef HAVE_STATVFS
int statvfs( const char *path, struct statvfs *buf );
#endif

#ifndef HAVE_STRNCASECMP
# ifndef HAVE__STRNICMP
int strncasecmp(const char *str1, const char *str2, size_t n);
# else
# define strncasecmp _strnicmp
# endif
#endif /* !defined(HAVE_STRNCASECMP) */

#ifndef HAVE_STRERROR
const char *strerror(int err);
#endif /* !defined(HAVE_STRERROR) */

#ifndef HAVE_STRCASECMP
# ifndef HAVE__STRICMP
int strcasecmp(const char *str1, const char *str2);
# else
# define strcasecmp _stricmp
# endif
#endif /* !defined(HAVE_STRCASECMP) */

#ifndef HAVE_USLEEP
int usleep (unsigned int useconds);
#endif /* !defined(HAVE_USLEEP) */

#ifdef __i386__
static inline void *memcpy_unaligned( void *dst, const void *src, size_t size )
{
return memcpy( dst, src, size );
}
#else
extern void *memcpy_unaligned( void *dst, const void *src, size_t size );
#endif /* __i386__ */

extern int mkstemps(char *template, int suffix_len);

/* Process creation flags */
#ifndef _P_WAIT
# define _P_WAIT 0
# define _P_NOWAIT 1
# define _P_OVERLAY 2
# define _P_NOWAITO 3
# define _P_DETACH 4
#endif
#ifndef HAVE_SPAWNVP
extern int spawnvp(int mode, const char *cmdname, const char * const argv[]);
#endif

/* Interlocked functions */

#if defined(__i386__) && defined(__GNUC__)

extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare );
extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
extern inline int interlocked_xchg( int *dest, int val );
extern inline void *interlocked_xchg_ptr( void **dest, void *val );
extern inline int interlocked_xchg_add( int *dest, int incr );

extern inline int interlocked_cmpxchg( int *dest, int xchg, int compare )
{
int ret;
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
return ret;
}

extern inline void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare )
{
void *ret;
__asm__ __volatile__( "lock; cmpxchgl %2,(%1)"
: "=a" (ret) : "r" (dest), "r" (xchg), "0" (compare) : "memory" );
return ret;
}

extern inline int interlocked_xchg( int *dest, int val )
{
int ret;
__asm__ __volatile__( "lock; xchgl %0,(%1)"
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
return ret;
}

extern inline void *interlocked_xchg_ptr( void **dest, void *val )
{
void *ret;
__asm__ __volatile__( "lock; xchgl %0,(%1)"
: "=r" (ret) : "r" (dest), "0" (val) : "memory" );
return ret;
}

extern inline int interlocked_xchg_add( int *dest, int incr )
{
int ret;
__asm__ __volatile__( "lock; xaddl %0,(%1)"
: "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
return ret;
}

#else /* __i386___ && __GNUC__ */

extern int interlocked_cmpxchg( int *dest, int xchg, int compare );
extern void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare );
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
extern int interlocked_xchg( int *dest, int val );
extern void *interlocked_xchg_ptr( void **dest, void *val );
extern int interlocked_xchg_add( int *dest, int incr );

#endif /* __i386___ && __GNUC__ */

#else /* NO_LIBWINE_PORT */

#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable

#define ffs __WINE_NOT_PORTABLE(ffs)
#define fstatvfs __WINE_NOT_PORTABLE(fstatvfs)
#define futimes __WINE_NOT_PORTABLE(futimes)
#define getopt_long __WINE_NOT_PORTABLE(getopt_long)
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
#define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg)
#define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
#define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg)
#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
#define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add)
#define lstat __WINE_NOT_PORTABLE(lstat)
#define memcpy_unaligned __WINE_NOT_PORTABLE(memcpy_unaligned)
#undef memmove
#define memmove __WINE_NOT_PORTABLE(memmove)
#define pread __WINE_NOT_PORTABLE(pread)
#define pwrite __WINE_NOT_PORTABLE(pwrite)
#define spawnvp __WINE_NOT_PORTABLE(spawnvp)
#define statvfs __WINE_NOT_PORTABLE(statvfs)
#define strcasecmp __WINE_NOT_PORTABLE(strcasecmp)
#define strerror __WINE_NOT_PORTABLE(strerror)
#define strncasecmp __WINE_NOT_PORTABLE(strncasecmp)
#define usleep __WINE_NOT_PORTABLE(usleep)

#endif /* NO_LIBWINE_PORT */

#endif /* !defined(__WINE_WINE_PORT_H) */

+ 1
- 1
regsvr.c View File

@@ -529,7 +529,7 @@ static HRESULT register_driver(void)
{
LPCSTR asio_key = "Software\\ASIO\\Wine ASIO";
LPCSTR clsid = "CLSID";
LPCSTR wine_clsid = "{48D0C522-BFCC-45cc-8B84-17F25F33E6E8}";
LPCSTR wine_clsid = "{48D0C522-BFCC-45CC-8B84-17F25F33E6E8}";
LPCSTR desc = "Description";
LPCSTR wine_desc = "Wine ASIO Driver";
HKEY key;


+ 0
- 1987
wineasio.diff.txt
File diff suppressed because it is too large
View File


wineasio.spec → wineasio.dll.spec View File


Loading…
Cancel
Save