Click here to Skip to main content
15,884,298 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.
// sprintf.cpp

// based on:
// LIBCTINY - Matt Pietrek 2001
// MSDN Magazine, January 2001

// 08/12/06 (mv)

#include <windows.h>
#include <stdio.h>
#include "libct.h"

#include <cassert>

#define EOF     (-1)

// Force the linker to include USER32.LIB
#pragma comment(linker, "/defaultlib:user32.lib")

EXTERN_C int sprintf(char *buffer, const char *format, ...)
{
    int retValue;
    va_list argptr;
          
    va_start(argptr, format);
    retValue = ::wvsprintfA(buffer, format, argptr);
    va_end(argptr);

    return retValue;
}

EXTERN_C int _snprintf(char *dest, size_t n, const char *fmt, ...)
{
    assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;

	va_list args;
	va_start(args, fmt);
	int retValue = ::wvsprintfA(dest, fmt, args);
	va_end(args);
	return retValue;
}

EXTERN_C int _snwprintf(wchar_t *dest, size_t n, const wchar_t *fmt, ...)
{
    assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;

    va_list args;
    va_start(args, fmt);
    int retValue = ::wvsprintfW(dest, fmt, args);
    va_end(args);
    return retValue;
}

EXTERN_C int vsnprintf(char *dest, size_t n, const char *fmt, va_list args)
{
	assert( ( n < 1024 ) && "wvsprintf() supports an output buffer with a maximum of 1024 bytes." ); n;
	return ::wvsprintfA(dest, fmt, args);
}

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