Ignore:
Timestamp:
Jan 21, 2011, 1:05:06 AM (11 years ago)
Author:
sam
Message:

Add preliminary support for sound samples. Implement click.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sample.cpp

    r251 r253  
    1616#include <cmath>
    1717
    18 #include <SDL.h>
     18#include <SDL_mixer.h>
    1919
    2020#include "core.h"
     
    3030private:
    3131    char *name;
     32    Mix_Chunk *chunk;
    3233};
    3334
     
    4041    data = new SampleData();
    4142    data->name = strdup(path);
     43    data->chunk = Mix_LoadWAV(path);
    4244}
    4345
    4446Sample::~Sample()
    4547{
     48    Mix_FreeChunk(data->chunk);
    4649    free(data->name);
    4750    delete data;
     
    6063void Sample::Play()
    6164{
     65    Mix_PlayChannel(-1, data->chunk, 0);
    6266}
    6367
Note: See TracChangeset for help on using the changeset viewer.