aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/audio/source.cpp
blob: ec80a0f038a8cfd48f39c99d1c908c4151668481 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <cstring>
#include "source.h"

namespace jin
{
namespace audio
{

    SourceType Source::getType(const void* mem, int size)
    {
        const char* p = (const char* )mem;
        if (memcmp(p, "RIFF", 4) == 0 && memcmp(p + 8, "WAVE", 4) == 0)
            return SourceType::WAV;
        if (memcmp(p, "OggS", 4) == 0)
            return SourceType::OGG;

        return SourceType::INVALID;
    }

}
}