Multimedia
  Home arrow Multimedia arrow Learning Sound for Game Programming using SDL
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MULTIMEDIA

Learning Sound for Game Programming using SDL
By: A.P.Rajshekhar
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2007-03-27


    Table of Contents:
  • Learning Sound for Game Programming using SDL
  • Opening the audio
  • Playing the Audio
  • Playing the sound in the real world

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Learning Sound for Game Programming using SDL
    ( Page 1 of 4 )

    When we think of video games, we often think of the music and sounds that accompany them. Providing those special effects used to be very difficult. Keep reading to learn how SDL makes this important task very easy.

    A game without audio is like a buffet without spice. Without sound bytes games can be played, but they would fail to providing an immersive environment. Before the coming of SDL, sound effects were either very complex to implement or very limited in output.

    Then came SDL with its core and extended libraries. The core library provides the ability to work with wav files. Using the extended libraries, sound formats such as mid, mpeg-1 and others can be integrated into the gaming environment. In the first three sections I will discuss the core audio library. The final section will use the APIs introduced in the first section to create an application that is extensible for future projects.

    Playing the Sound with SDL

    Sound is one of the sub-systems of SDL. But unlike other sub-systems, sound not only needs to be initialized, but also opened in a way that is akin to setting up the video mode. Even then sound can be used only by using playing routines. In essence there are three steps to using sound within an application. They are:

    1. Initializing audio
    2. Opening the audio
    3. Playing the sound

    It is in the second step that the format, track rate and more comes into the picture. The following are the details of each step.

    Initializing audio

    The first step in using audio in an application is initializing the audio subsystem. This is done by passing the parameter referring the audio subsystem i.e. SDL_AUDIO. To put it in code:

    SDL_Init(SDL_AUDIO);

    This is no different than initialization of any other sub-system.



     
     
    >>> More Multimedia Articles          >>> More By A.P.Rajshekhar
     

       

    MULTIMEDIA ARTICLES

    - Basic Lighting in OpenGL and SDL Game Progra...
    - Working with Colors in OpenGL for Game Progr...
    - Animation in OpenGL for Game Programming usi...
    - Game Programming with SDL: Getting Started w...
    - Using OpenGL with SDL for Game Programming
    - Learning Sound for Game Programming using SDL
    - Game Programming using SDL: Raw Graphics and...
    - Game Programming using SDL: Getting Started
    - Network Radio With Icecast
    - Learning To SMILe





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT