source: rtems/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c @ 0d34641c

4.104.115
Last change on this file since 0d34641c was 0d34641c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 04:14:38

Remove CVS-'s.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*---------------------------------------------------------------------------------
2        $Id$
3
4        Sound Functions
5
6        Copyright (C) 2005
7                Dave Murphy (WinterMute)
8
9        This software is provided 'as-is', without any express or implied
10        warranty.  In no event will the authors be held liable for any
11        damages arising from the use of this software.
12
13        Permission is granted to anyone to use this software for any
14        purpose, including commercial applications, and to alter it and
15        redistribute it freely, subject to the following restrictions:
16
17        1.      The origin of this software must not be misrepresented; you
18                must not claim that you wrote the original software. If you use
19                this software in a product, an acknowledgment in the product
20                documentation would be appreciated but is not required.
21        2.      Altered source versions must be plainly marked as such, and
22                must not be misrepresented as being the original software.
23        3.      This notice may not be removed or altered from any source
24                distribution.
25
26---------------------------------------------------------------------------------*/
27#include <nds/arm9/sound.h>
28#include <nds/arm9/cache.h>
29#include <string.h>
30
31//---------------------------------------------------------------------------------
32static void playSoundBlock(TransferSound *snd) {
33//---------------------------------------------------------------------------------
34        DC_FlushRange( snd, sizeof(TransferSound) );
35
36        IPC->soundData = snd;
37}
38
39//---------------------------------------------------------------------------------
40static TransferSound Snd;
41static TransferSoundData SndDat =               { (void *)0 , 0, 11025, 64, 64, 1 };
42
43//---------------------------------------------------------------------------------
44void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format) {
45//---------------------------------------------------------------------------------
46
47        SndDat.rate             = rate;
48        SndDat.vol              = vol;
49        SndDat.pan              = pan;
50        SndDat.format   = format;
51}
52
53//---------------------------------------------------------------------------------
54void playSound( pTransferSoundData sound) {
55//---------------------------------------------------------------------------------
56        Snd.count = 1;
57
58        memcpy( &Snd.data[0], sound, sizeof(TransferSoundData) );
59
60        playSoundBlock(&Snd);
61
62}
63
64//---------------------------------------------------------------------------------
65void playGenericSound(const void* data, u32 length) {
66//---------------------------------------------------------------------------------
67        Snd.count = 1;
68
69        memcpy( &Snd.data[0], &SndDat, sizeof(TransferSoundData) );
70        Snd.data[0].data = data;
71        Snd.data[0].len = length;
72
73        playSoundBlock(&Snd);
74}
Note: See TracBrowser for help on using the repository browser.