source: abuse/branches/pd/macabuse/imlib/port/unix/sound.c @ 636

Last change on this file since 636 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1#include "sound.hpp"
2
3#include <stdlib.h>
4#include <string.h>
5#include <stdio.h>
6
7sound_effect::sound_effect(char *filename)
8{
9  data=(void *)strcpy((char *)malloc(strlen(filename)+1),filename);      // insert code here 
10}
11
12
13sound_effect::~sound_effect()
14{
15  free(data);
16}
17
18
19void sound_effect::play(int volume, int pitch, int panpot)
20{
21//  printf("Play sound effect %s\n",data);
22}
23
24int sound_init(int argc, char **argv)
25{
26        return 0; 
27}
28
29void sound_uninit()
30{
31  ;
32 
33}
34
35void song::set_volume(int vol)  { ; }
36
37song::song(char *filename)
38{
39  data=NULL;
40  Name=strcpy((char *)malloc(strlen(filename)+1),filename);
41  song_id=0;
42}
43
44song::~song()
45{
46  if (playing())
47    stop(); 
48  if (data) free(data);
49  free(Name); 
50
51
52void song::play(unsigned char volume)
53{
54  printf("play song %s, volume %d\n",name(),volume); 
55  song_id=1; 
56}
57
58
59void song::stop(long fadeout_time)                                       // time in ms
60{
61  printf("stop song %s, fade timeout %d\n",name(),fadeout_time);
62  song_id=0;
63 
64}
65
66int song::playing()
67{
68  return song_id; 
69}
70
71
72
73void set_music_volume(int volume)                  // 0...127
74{
75
76}
Note: See TracBrowser for help on using the repository browser.