~ubuntu-branches/ubuntu/trusty/libsdl2/trusty-proposed

« back to all changes in this revision

Viewing changes to test/loopwave.c

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo
  • Date: 2013-12-28 12:31:19 UTC
  • mto: (7.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: package-import@ubuntu.com-20131228123119-wehupm72qsjvh6vz
Tags: upstream-2.0.1+dfsg1
ImportĀ upstreamĀ versionĀ 2.0.1+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
{
81
81
    int i;
82
82
 
 
83
        /* Enable standard application logging */
 
84
        SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
85
 
83
86
    /* Load the SDL library */
84
87
    if (SDL_Init(SDL_INIT_AUDIO) < 0) {
85
 
        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
 
88
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
86
89
        return (1);
87
90
    }
88
91
 
91
94
    }
92
95
    /* Load the wave file into memory */
93
96
    if (SDL_LoadWAV(argv[1], &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
94
 
        fprintf(stderr, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
 
97
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1], SDL_GetError());
95
98
        quit(1);
96
99
    }
97
100
 
109
112
#endif /* HAVE_SIGNAL_H */
110
113
 
111
114
    /* Show the list of available drivers */
112
 
    printf("Available audio drivers: ");
 
115
    SDL_Log("Available audio drivers:");
113
116
    for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
114
 
        if (i == 0) {
115
 
            printf("%s", SDL_GetAudioDriver(i));
116
 
        } else {
117
 
            printf(", %s", SDL_GetAudioDriver(i));
118
 
        }
 
117
                SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
119
118
    }
120
 
    printf("\n");
121
119
 
122
120
    /* Initialize fillerup() variables */
123
121
    if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
124
 
        fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
 
122
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
125
123
        SDL_FreeWAV(wave.sound);
126
124
        quit(2);
127
125
    }
128
126
 
129
 
    printf("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 
127
    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
130
128
 
131
129
    /* Let the audio run */
132
130
    SDL_PauseAudio(0);