Click here to Skip to main content
15,881,882 members
Articles / Desktop Programming / WTL

Multidevice ASIO output plugin for WinAMP

Rate me:
Please Sign up or sign in to vote.
4.80/5 (9 votes)
13 Feb 2009CDDL27 min read 48.1K   728   23  
A tiny WinAMP output DLL that uses a C++ replacement of the official ASIO SDK that supports multiple ASIO devices.
#pragma once

#include "windows.h"

#include "errno.h"


#define DECL_PROLOG inline errno_t __fastcall

DECL_PROLOG strcpy_s
(
    char *strDestination,
    size_t numberOfElements,
    const char *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strcpy( strDestination, strSource );
    return 0;
}


DECL_PROLOG wcscat_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcscat( strDestination, strSource );
    return 0;
}

DECL_PROLOG strcat_s
(
    char * strDestination,
    size_t numberOfElements,
    const char *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strcat( strDestination, strSource );
    return 0;
}

DECL_PROLOG wcscpy_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t *strSource 
)
{
    if ( numberOfElements == 0 )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcscpy( strDestination, strSource );
    return 0;
}

DECL_PROLOG strncpy_s
(
    char * strDestination,
    size_t numberOfElements,
    const char *strSource,
    size_t count
)
{
    if ( numberOfElements < count )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::strncpy( strDestination, strSource, count );
    return 0;
}

DECL_PROLOG wcsncpy_s
(
    wchar_t * strDestination,
    size_t numberOfElements,
    const wchar_t * strSource,
    size_t count
)
{
    if ( numberOfElements < count )
        return ERANGE;
    if ( !strDestination || !strSource )
        return EINVAL;
    ::wcsncpy( strDestination, strSource, count );
    return 0;
}

inline int __fastcall vsprintf_s
(
    char *buffer,
    size_t numberOfElements,
    const char *format,
    va_list argptr
)
{
    if ( numberOfElements > 1024 )
        return -1;
    return ::wvsprintfA( buffer, format, argptr );
}

inline int __fastcall vswprintf_s
(
    wchar_t *buffer,
    size_t numberOfElements,
    const wchar_t *format,
    va_list argptr
)
{
    if ( numberOfElements > 1024 )
        return -1;
    return ::wvsprintfW( buffer, format, argptr );
}


#define wstrcpy_s(dest, destsize, source) ::wstrcpy((dest), (source))
#define wstrncpy_s(dest, destsize, source) ::wstrncpy((dest), (source))

#define swprintf_s _snwprintf
#define sprintf_s _snprintf
//#define _vsnprintf_s _vsnprintf

#undef DECL_PROLOG

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Software Developer Little Endian Ltd.
Croatia Croatia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions