File: rawtofile.cc

package info (click to toggle)
splay 0.9.5.2-13
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 756 kB
  • ctags: 1,167
  • sloc: cpp: 7,680; sh: 330; makefile: 83
file content (45 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (3)
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
/* MPEG Sound library

   (C) 1997 by Jung woo-jae */

// Rawtofile.cc
// Output raw data to file.

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <fcntl.h>
#include <unistd.h>

#include "mpegsound.h"

// Rawplayer class
Rawtofile::~Rawtofile()
{
  close(filehandle);
}

bool Rawtofile::initialize(const char *filename)
{
  if(filename==NULL)filehandle=1;
  else if((filehandle=creat(filename,0644))==-1)
    return seterrorcode(SOUND_ERROR_DEVOPENFAIL);

  return true;
}

bool Rawtofile::setsoundtype(int stereo,int samplesize,int speed)
{
  rawstereo=stereo;
  rawsamplesize=samplesize;
  rawspeed=speed;

  return true;
}

bool Rawtofile::putblock(void *buffer,int size)
{
  return (write(filehandle,buffer,size)==size);
};