File: Sound.h

package info (click to toggle)
csmash 0.6.6-6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 13,548 kB
  • ctags: 1,687
  • sloc: cpp: 19,531; sh: 3,515; makefile: 439; ansic: 120; sed: 16
file content (74 lines) | stat: -rw-r--r-- 1,819 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* $Id: Sound.h,v 1.18 2003/08/03 10:12:59 nan Exp $ */

// Copyright (C) 2000-2003  ���� �ȹ�(Kanna Yoshihiro)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#ifndef _Sound_
#define _Sound_

#define SOUND_QUEUESIZE 16

struct buffer {
  unsigned char const *start;
  unsigned long length;
};

class Sound {
public:
  virtual ~Sound();

  static Sound* TheSound();

  virtual bool Init( long sndMode );
  virtual void Clear();

  //bool Play( char *sndData, long count );
  bool Play( long soundID, double x, double y );
  bool PlayScore( long score1, long score2 );
  bool PlayNumber( long number );

  long GetSoundMode();

  long InitBGM( char *filename );
  long PlayBGM();
  long StopBGM();

  // For BGM
  char *m_bgmSound;

#ifdef HAVE_LIBSDL_MIXER
  Mix_Chunk *m_sound[16];
  Mix_Chunk *m_score[31];
  Mix_Music *m_opening;

  static void PlayFinishHandler( int channel );
#endif

  long m_soundMode;
private:
  Sound();
  static Sound *m_theSound;

#ifdef HAVE_LIBSDL_MIXER
  Mix_Chunk *m_chunkqueue[SOUND_QUEUESIZE];
  int m_queuehead;
  int m_queuetail;

  bool PlayBlocking( int channel, Mix_Chunk *chunk );
#endif
};

#endif // _Sound_