• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

CruzWoman

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

150 Neutral

About CruzWoman

  • Rank
    Newbie
  1. Hello, I'm new to SDL and also new to audioprocessing and have problems by generating 3D sound. I'using SDL_Mixer for the sound output and I'm trying to make 3D sound by convolution of a Mix_Chunk with a head related transfer function (HRTF). I tried it by registering an effect and make the convolution with the hrtf in the callback function of the effect. But I got no 3D sound, just the originally sound. Then I tried to make the convolution before playing the sound. I make the convolution of the HRTF directly with the Mix_Chunk->abuf. But when I play the sound, there is only noise...? Is there a possibility to make 3D sound with my approach at all? I've loaded my wav file in Matlab and compared it with my loaded wav file by using Mix_LoadWav and wrote it in a .txt file. The data is not the same...? Here's my convolution of the second approach (Mix_Chunk with HRTF): [CODE] Mix_Chunk* PlaySDLAudio::makeConvolution(LeftRightHRTF myHRTFs, Mix_Chunk* audioChunk){ short* Y; short* HL; short* HR; int m = audioChunk->alen/2;// ? alen in byte, so /2 because short 16 bit = 2 byte ? int n = myHRTFs.nTaps; short* X = (short*)audioChunk->abuf; HL = new short[n+m]; HR = new short[n+m]; Y = new short[n+m-1]; for( int i = 0 ; i < n; i++ ){ HL[i] = *myHRTFs.leftHRTF; myHRTFs.leftHRTF++; HR[i] = *myHRTFs.rightHRTF; myHRTFs.rightHRTF++; } for ( int i = n; i < n+m; i++ ){//fill rest with 0 HL[i] = 0; HR[i] = 0; } //convolution for ( int i = 0; i < (n+m-1)/2; i++ ) { Y[i*2] = 0; Y[i*2+1] = 0; for ( int j = 0; j < m/2; j++ ) { if (i-j>=0){ Y[i*2] = Y[i*2] + X[j*2] * HL[i-j]; Y[i*2+1] = Y[i*2+1] + X[j*2+1] * HR[i-j]; } } } //load result in new Mix_Chunk Mix_Chunk *wave_chunk; if(!(wave_chunk=Mix_QuickLoad_RAW((Uint8*)Y,m+n))) { printf("Mix_QuickLoad_WAV: %s\n", Mix_GetError());// handle error } return wave_chunk; } [/CODE] I hope that someone has an idea where's my mistake or knows whether my first or second approach is a dead-end road... Thanks a lot. Greetings.
  2. Hello, everything works now. I use the function lineRGBA from SDL_gfx for now to draw a horizontal line. Hope it'll be not too slow, but I guess it'll be ok. Thanks for your help. Greetings.
  3. Thanks for all replies. I got the SDL_gfx compiled I got a diagonal line when compiling the Release Version, but in Debug mode I got an error (LINK : fatal error LNK1104: Datei "SDL_gfx.lib" kann nicht geöffnet werden.(=>could not open file "SDL_gfx.lib")) The configuration for Debug and Release seem to be the same. @ zacaj: I tried your lib-file, but got the same error in Debug mode... Thanks for sharing it I guess it's a problem with my preferences. Tomorrow I'll go on... In germany it's late and my kids will wake me up early in the morning. Greetings and good night for now.
  4. Thanks for your reply. Do you use SDL_gfx? I tried to compile it with VC++ 2010 Express, but got compile errors. I tried SDL_draw lib too, but I got an uncaught exception while running my program with SDL_draw lib. And the debugger shows me that the problem was in der SDL_draw code... I'll try to compile SDL_gfx once more. I guess it's just a problem with setting the paths or with the linker... If someone knows why my code above only draws horizontal lines, feel free to give me a hint. Greetings.
  5. Hello, I tried to draw a diagonal line with SDL, but I only get a dashed horizontal line. I have no idea what's the problem. I tried a simple algorithm (commented out) and then I found some soucecode for the bresenham algorithm. Both draw only dashed horizontal lines (the first and half of the second line of the surface) [source lang="cpp"]void ProcessSDL::DrawLine(SDL_Surface *screen, int x1, int y1, int x2, int y2, Uint8 r, Uint8 g, Uint8 b) { //simple algorithm /*double x = x2 - x1; double y = y2 - y1; double length = sqrt( x*x + y*y ); double addx = x / length; double addy = y / length; x = x1; y = y1; if( SDL_MUSTLOCK( m_pScreen ) ) { SDL_LockSurface( m_pScreen ); } for(double i = 0; i < length; i += 1) { setSdlPixel( screen, (int)x, (int)y, c_green); x += addx; y += addy; } if( SDL_MUSTLOCK( m_pScreen ) ) { SDL_UnlockSurface( m_pScreen ); } SDL_Flip(screen);*/ bresenham_line(screen, x1, y1, x2, y2, c_green); SDL_Flip(screen); } void ProcessSDL::bresenham_line(SDL_Surface *screen, Uint32 x1, Uint32 y1, Uint32 x2, Uint32 y2, Uint32 color) { int lg_delta; int sh_delta; int cycle; int lg_step; int sh_step; lg_delta = x2 - x1; sh_delta = y2 - y1; lg_step = SGN(lg_delta); lg_delta = ABS(lg_delta); sh_step = SGN(sh_delta); sh_delta = ABS(sh_delta); if (sh_delta < lg_delta) { cycle = lg_delta >> 1; while (x1 != x2) { setSdlPixel(screen, x1, y1, color); cycle += sh_delta; if (cycle > lg_delta) { cycle -= lg_delta; y1 += sh_step; } x1 += lg_step; } setSdlPixel(screen, x1, y1, color); } cycle = sh_delta >> 1; while (y1 != y2) { setSdlPixel(screen, x1, y1, color); cycle += lg_delta; if (cycle > sh_delta) { cycle -= sh_delta; x1 += lg_step; } y1 += sh_step; } setSdlPixel(screen, x1, y1, color); } void ProcessSDL::setSdlPixel(SDL_Surface *screen, int x, int y, Uint32 color) { Uint32 *pixmem32; Uint32 colour; //colour = SDL_MapRGB( screen->format, r, g, b ); pixmem32 = (Uint32*) screen->pixels + y + x; *pixmem32 = color; }[/source] My init_SDL looks like this. Perhaps here's the problem: [source lang="cpp"]bool ProcessSDL::initSDL() { //Initialize all SDL subsystems if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) { return false; } // atexit(SDL_Quit); // init screen SDL_putenv("SDL_VIDEO_CENTERED=center"); SDL_WM_SetCaption("Ear Tracker", NULL); m_pScreen = SDL_SetVideoMode( 1280,720, 32, SDL_SWSURFACE); if ( m_pScreen == NULL ) { return false; } //init colours c_white = SDL_MapRGB(m_pScreen->format, 255,255,255); c_gray = SDL_MapRGB(m_pScreen->format, 200,200,200); c_dgray= SDL_MapRGB(m_pScreen->format, 64,64,64); c_cyan = SDL_MapRGB(m_pScreen->format, 32,255,255); c_magenta = SDL_MapRGB(m_pScreen->format, 255,0,255); c_yellow = SDL_MapRGB(m_pScreen->format, 255,255,0); c_black = SDL_MapRGB(m_pScreen->format, 0,0,0); c_red = SDL_MapRGB(m_pScreen->format, 255,0,0); c_green = SDL_MapRGB(m_pScreen->format, 0,255,0); c_blue = SDL_MapRGB(m_pScreen->format, 0,0,255); //If everything initialized fine return true; }[/source] Could anyone help me to find out whats wrong? Thank you very much. Greetings.