summaryrefslogtreecommitdiff
path: root/src/input_mod.h
blob: 0a58e4399f515eec7a027e48cce3f890ff8131d3 (plain)
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
#ifndef INPUT_MOD_H
#define INPUT_MOD_H


#include <dumb.h>
#include "audiere.h"
#include "basic_source.h"
#include "types.h"


namespace audiere {

  class MODInputStream : public BasicSource {
  public:
    MODInputStream();
    ~MODInputStream();

    bool initialize(FilePtr file);

    void ADR_CALL getFormat(
      int& channel_count,
      int& sample_rate,
      SampleFormat& sample_format);
    void ADR_CALL reset();

    int ADR_CALL getOrder();
    bool ADR_CALL setOrder(int order);
    int ADR_CALL getRow();
    float ADR_CALL getChannelVolume(int channel = 0);
    bool ADR_CALL setChannelVolume(int channel, float volume);
    int ADR_CALL getTempo();
    bool ADR_CALL setTempo(int tempo);

    int doRead(int frame_count, void* buffer);

  private:
    DUH* openDUH();

    static void* dfs_open(const char* filename);
    static int   dfs_skip(void* f, long n);
    static int   dfs_getc(void* f);
    static long  dfs_getnc(char* ptr, long n, void* f);
    static void  dfs_close(void* f);

    static int loopCallback(void* ptr);

  private:
    FilePtr          m_file;
    DUH*             m_duh;
    DUH_SIGRENDERER* m_renderer;
  };

}


#endif