test/automated/audio/audio.c
author David Ludwig <dludwig@pobox.com>
Tue, 12 Feb 2013 12:57:06 -0500
changeset 8424 3cf9501008f1
parent 3481 c32c53fca10d
permissions -rw-r--r--
WinRT: fixed bug: SDL_CreateWindow wouldn't work after an initial window was created + destroyed
     1 /**
     2  * Automated SDL_RWops test.
     3  *
     4  * Written by Edgar Simo "bobbens"
     5  *
     6  * Released under Public Domain.
     7  */
     8 
     9 
    10 #include "SDL.h"
    11 #include "../SDL_at.h"
    12 
    13 
    14 /**
    15  * @brief Prints available devices.
    16  */
    17 static int audio_printDevices( int iscapture )
    18 {
    19    int i, n;
    20 
    21    /* Get number of devices. */
    22    n = SDL_GetNumAudioDevices(iscapture);
    23    SDL_ATprintVerbose( 1, "%d %s Audio Devices\n",
    24          n, iscapture ? "Capture" : "Output" );
    25 
    26    /* List devices. */
    27    for (i=0; i<n; i++) {
    28       SDL_ATprintVerbose( 1, "   %d) %s\n", i+1, SDL_GetAudioDeviceName( i, iscapture ) );
    29    }
    30 
    31    return 0;
    32 }
    33 
    34 
    35 /**
    36  * @brief Makes sure parameters work properly.
    37  */
    38 static void audio_testOpen (void)
    39 {
    40    int i, n;
    41    int ret;
    42 
    43    /* Begin testcase. */
    44    SDL_ATbegin( "Audio Open" );
    45 
    46    /* List drivers. */
    47    n = SDL_GetNumAudioDrivers();
    48    SDL_ATprintVerbose( 1, "%d Audio Drivers\n", n );
    49    for (i=0; i<n; i++) {
    50       SDL_ATprintVerbose( 1, "   %s\n", SDL_GetAudioDriver(i) );
    51    }
    52 
    53    /* Start SDL. */
    54    ret = SDL_Init( SDL_INIT_AUDIO );
    55    if (SDL_ATvassert( ret==0, "SDL_Init( SDL_INIT_AUDIO ): %s", SDL_GetError()))
    56       return;
    57 
    58    /* Print devices. */
    59    SDL_ATprintVerbose( 1, "Using Audio Driver '%s'\n", SDL_GetCurrentAudioDriver() );
    60    audio_printDevices(0);
    61    audio_printDevices(1);
    62 
    63    /* Quit SDL. */
    64    SDL_Quit();
    65 
    66    /* End testcase. */
    67    SDL_ATend();
    68 }
    69 
    70 
    71 /**
    72  * @brief Entry point.
    73  */
    74 #ifdef TEST_STANDALONE
    75 int main( int argc, const char *argv[] )
    76 {
    77    (void) argc;
    78    (void) argv;
    79 #else /* TEST_STANDALONE */
    80 int test_audio (void)
    81 {
    82 #endif /* TEST_STANDALONE */
    83 
    84    SDL_ATinit( "SDL_Audio" );
    85 
    86    audio_testOpen();
    87 
    88    return SDL_ATfinish();
    89 }