openTRI 0.1
triWav.h
1/*
2 * triWav.h: Header for WAV playback
3 * This file is part of the "tri Engine".
4 *
5 * Copyright (C) 2007 tri
6 * Copyright (C) 2007 InsertWittyName <tias_dp@hotmail.com>
7 *
8 * $Id: $
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef __TRIWAV_H__
26#define __TRIWAV_H__
27
28#include "triTypes.h"
29
33
37typedef struct
38{
39 triU32 channels;
40 triU32 sampleRate;
41 triU32 sampleCount;
42 triU32 dataLength;
43 triU32 rateRatio;
44 triU32 playPtr;
45 triU32 playPtr_frac;
46 triUInt loop;
47 void *data;
48 triUInt id;
49 triU32 bitPerSample;
50} triWav;
51
57triBool triWavInit();
58
66triWav *triWavLoad(const triChar *filename);
67
71triVoid triWavFree(triWav *theWav);
72
80triBool triWavPlay(triWav *theWav);
81
85triVoid triWavStop(triWav *theWav);
86
90triVoid triWavStopAll();
91
99triVoid triWavSetLoop(triWav *theWav, triUInt loop);
100
102
103#endif // __TRIWAV_H__
triVoid triWavFree(triWav *theWav)
Unload a previously loaded WAV file.
triWav * triWavLoad(const triChar *filename)
Load a WAV file.
triVoid triWavSetLoop(triWav *theWav, triUInt loop)
Set the loop of the WAV playback.
triBool triWavPlay(triWav *theWav)
Start playing a loaded WAV file.
triVoid triWavStop(triWav *theWav)
Stop playing a loaded WAV.
triVoid triWavStopAll()
Stop playing all WAVs.
triBool triWavInit()
Initialise the WAV playback.
A WAV file struct.
Definition triWav.h:38
triU32 bitPerSample
The bit rate of the WAV.
Definition triWav.h:49
triU32 sampleCount
Sample count.
Definition triWav.h:41
triU32 channels
Number of channels.
Definition triWav.h:39
triUInt loop
Loop flag.
Definition triWav.h:46
triU32 playPtr_frac
Internal.
Definition triWav.h:45
triU32 rateRatio
Rate ratio (sampleRate / 44100 * 0x10000)
Definition triWav.h:43
triU32 sampleRate
Sample rate.
Definition triWav.h:40
triUInt id
The ID of the WAV.
Definition triWav.h:48
triU32 dataLength
Data length.
Definition triWav.h:42
triU32 playPtr
Internal.
Definition triWav.h:44
void * data
A pointer to the actual WAV data.
Definition triWav.h:47