aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/utils/unittest.cpp
blob: 2c2985bb35492fee1db219904674ed2d2868abb5 (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
33
34
35
36
37
38
#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.ogg", ios::binary);
    fs.read(buf, length);
    SDLSource source(SDLSource::OGG, buf, length);
    source.play();
    source.setLoop(true);
    int i = 0;
    while (true)
    {
        i += 1; 
        if (i == 10)
        {
            source.resume();
        }
        SDL_Delay(1000);
    }
    audio->quit();
    return 0;
}

#endif