aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/utils/unittest.cpp
blob: df1a2b6ce4fd39a1408ddadaa1defc823d666464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "utils.h"
#if UNITTEST

#include <iostream>
#include <stdio.h>
#include <fstream>
#include "../audio/sdl/source.h"
#include "../audio/sdl/audio.h"

using namespace jin::audio;
using namespace std;
int length = 2226052;
char buf[2226052];
int main(int argc, char* argv[])
{
    Audio* audio = SDLAudio::get();
    audio->init(0);
    ifstream fs;
    fs.open("a.wav", ios::binary);
    fs.read(buf, length);
    SDLSource source(SDLSource::WAV, buf, length);
    source.play();
    source.setLoop(true);
    while (true)
    {
        SDL_Delay(100);
    }
    audio->quit();
    return 0;
}

#endif