~ubuntu-branches/ubuntu/wily/ecasound/wily-proposed

« back to all changes in this revision

Viewing changes to libecasound/audioio-null.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-12 17:58:03 UTC
  • Revision ID: james.westby@ubuntu.com-20110512175803-zy3lodjecabt9r3v
Tags: upstream-2.8.0
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef INCLUDED_AUDIOIO_NULL_H
 
2
#define INCLUDED_AUDIOIO_NULL_H
 
3
 
 
4
#include "audioio-buffered.h"
 
5
 
 
6
/**
 
7
 * Audio object that endlessly consumes and produces audio data.
 
8
 * And is incredibly fast. :)
 
9
 */
 
10
class NULLFILE : public AUDIO_IO_BUFFERED {
 
11
 public:
 
12
 
 
13
  virtual std::string name(void) const { return("Null audio object"); }
 
14
 
 
15
  virtual void open(void) throw (AUDIO_IO::SETUP_ERROR &) { AUDIO_IO::open(); }
 
16
  virtual void close(void) { AUDIO_IO::close(); }
 
17
 
 
18
  virtual long int read_samples(void* target_buffer, long int samples) { 
 
19
    for(long int n = 0; n < static_cast<long int>(samples * frame_size()); n++) ((char*)target_buffer)[n] = 0;
 
20
    return(samples); 
 
21
  }
 
22
  virtual void write_samples(void* target_buffer, long int samples) { }
 
23
 
 
24
  virtual bool finished(void) const { return false; }
 
25
  virtual bool supports_seeking(void) const { return true; }
 
26
  virtual bool finite_length_stream(void) const { return false; }
 
27
  virtual SAMPLE_SPECS::sample_pos_t seek_position(SAMPLE_SPECS::sample_pos_t pos) { return pos; }
 
28
 
 
29
  NULLFILE(const std::string& name = "null");
 
30
  virtual ~NULLFILE(void);
 
31
  NULLFILE* clone(void) const { return new NULLFILE(*this); }
 
32
  NULLFILE* new_expr(void) const { return new NULLFILE(); }
 
33
};
 
34
 
 
35
#endif