summaryrefslogtreecommitdiff
path: root/src/device_ds_buffer.h
blob: 0be34fbbbb896282c67253b1a51df051988ab733 (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
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef DEVICE_DS_BUFFER_H
#define DEVICE_DS_BUFFER_H


#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "audiere.h"


namespace audiere {

  class DSAudioDevice;

  class DSOutputBuffer : public RefImplementation<OutputStream> {
  public:
    DSOutputBuffer(
      DSAudioDevice* device,
      IDirectSoundBuffer* buffer,
      int length,
      int frame_size);
    ~DSOutputBuffer();

    void ADR_CALL play();
    void ADR_CALL stop();
    bool ADR_CALL isPlaying();
    void ADR_CALL reset();

    void ADR_CALL setRepeat(bool repeat);
    bool ADR_CALL getRepeat();

    void  ADR_CALL setVolume(float volume);
    float ADR_CALL getVolume();

    void  ADR_CALL setPan(float pan);
    float ADR_CALL getPan();

    void  ADR_CALL setPitchShift(float shift);
    float ADR_CALL getPitchShift();

    bool ADR_CALL isSeekable();
    int  ADR_CALL getLength();
    void ADR_CALL setPosition(int position);
    int  ADR_CALL getPosition();

  private:
    void update(); ///< Solely for processing events.

    RefPtr<DSAudioDevice> m_device;
    IDirectSoundBuffer* m_buffer;
    int m_length;
    int m_frame_size;

    int m_base_frequency;

    bool  m_repeating;
    float m_volume;
    float m_pan;

    HANDLE m_stop_event;

    friend class DSAudioDevice;
  };

}


#endif