aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Output/out_ds/cnv_ds2.h
blob: 91e01ab3e9d6b3c6837b5c5d1785444d20e5343d (plain) (blame)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef _CNV_DS2_H
#define _CNV_DS2_H

#include "../studio/wac.h"
#include "../common/rootcomp.h"
#include "../attribs/cfgitemi.h"
#include "../attribs/attrint.h"
#include "../attribs/attrbool.h"
#include "../attribs/attrfloat.h"
#include "../attribs/attrstr.h"

#include "../studio/services/svc_mediaconverter.h"
#include "../studio/services/servicei.h"
#include "../studio/corecb.h"

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

#include "ds2.h"

#define WACNAME WACcnv_ds2

class WACNAME : public WAComponentClient {
public:
  WACNAME();
  virtual ~WACNAME();

  virtual const char *getName() { return "DirectSound Output"; };
  virtual GUID getGUID();

  virtual void onCreate();
  virtual void onDestroy();
  
  virtual int getDisplayComponent() { return FALSE; };

  virtual CfgItem *getCfgInterface(int n) { return this; }
};


class cnvDS2 : public svc_mediaConverterI {
public:
  cnvDS2();
  virtual ~cnvDS2();

  // service
  static const char *getServiceName() { return "DirectSound Output"; }

  virtual int canConvertFrom(svc_fileReader *reader, const char *name, const char *chunktype) { 
    if(chunktype && !STRICMP(chunktype,"pcm")) return 1;
    return 0;
  }
  virtual const char *getConverterTo() { return "OUTPUT:DirectSound"; }

  virtual int getInfos(MediaInfo *infos);

	virtual int processData(MediaInfo *infos, ChunkList *chunk_list, bool *killswitch);

  virtual int getLatency(void);

  virtual int isSelectableOutput(void) { return 1; }

  // callbacks
  virtual int corecb_onSeeked(int newpos);

	virtual int sortPlacement(const char *oc);

	virtual int corecb_onVolumeChange(int v);
	virtual int corecb_onPanChange(int v);
	virtual int corecb_onAbortCurrentSong();
	virtual int corecb_onPaused();
	virtual int corecb_onUnpaused();
	virtual int corecb_onEndOfDecode();
private:
	DS2 * m_ds2;
	UINT sr,nch,bps,chan;
	bool ds2_paused;
	UINT fadenow;
	bool use_vol;
	bool use_pitch;
	double pitch_set;
};


#endif