aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Utils/unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Utils/unittest.cpp')
-rw-r--r--src/libjin/Utils/unittest.cpp108
1 files changed, 0 insertions, 108 deletions
diff --git a/src/libjin/Utils/unittest.cpp b/src/libjin/Utils/unittest.cpp
deleted file mode 100644
index 44f1ae5..0000000
--- a/src/libjin/Utils/unittest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-#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 main(int argc, char* argv[])
-{
- SDLAudio* audio = SDLAudio::get();
- audio->init(0);
- SDLSource* source = SDLSource::createSource("a.ogg");
- SDLSource* source2 = SDLSource::createSource("a.wav");
- //source->play();
- source2->play();
- source->setLoop(true);
- source2->setLoop(true);
- int i = 0;
- while (true)
- {
- SDL_Delay(1000);
- }
- audio->quit();
- return 0;
-}
-
-/*
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "SDL2/SDL.h"
-
-#include <3rdparty/cmixer/cmixer.h>
-
-static SDL_mutex* audio_mutex;
-
-static void lock_handler(cm_Event *e) {
- if (e->type == CM_EVENT_LOCK) {
- SDL_LockMutex(audio_mutex);
- }
- if (e->type == CM_EVENT_UNLOCK) {
- SDL_UnlockMutex(audio_mutex);
- }
-}
-
-
-static void audio_callback(void *udata, Uint8 *stream, int size) {
- cm_process((cm_Int16*)stream, size / 2);
-}
-
-
-int main(int argc, char **argv) {
- SDL_AudioDeviceID dev;
- SDL_AudioSpec fmt, got;
- cm_Source *src;
- cm_Source* src2;
-
-
- SDL_Init(SDL_INIT_AUDIO);
- audio_mutex = SDL_CreateMutex();
-
- memset(&fmt, 0, sizeof(fmt));
- fmt.freq = 44100;
- fmt.format = AUDIO_S16;
- fmt.channels = 2;
- fmt.samples = 1024;
- fmt.callback = audio_callback;
-
- dev = SDL_OpenAudioDevice(NULL, 0, &fmt, &got, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE);
- if (dev == 0) {
- fprintf(stderr, "Error: failed to open audio device '%s'\n", SDL_GetError());
- exit(EXIT_FAILURE);
- }
-
- cm_init(got.freq);
- cm_set_lock(lock_handler);
- cm_set_master_gain(0.5);
-
- SDL_PauseAudioDevice(dev, 0);
-
- src = cm_new_source_from_file("a.ogg");
- src2 = cm_new_source_from_file("loop.wav");
- if (!src) {
- fprintf(stderr, "Error: failed to create source '%s'\n", cm_get_error());
- exit(EXIT_FAILURE);
- }
- cm_set_loop(src2, 1);
-
- cm_play(src);
- cm_play(src2);
-
- printf("Press [return] to exit\n");
- getchar();
-
- cm_destroy_source(src);
- SDL_CloseAudioDevice(dev);
- SDL_Quit();
-
- return EXIT_SUCCESS;
-}
-*/
-
-#endif \ No newline at end of file