Skip to content

Commit

Permalink
update to most recent SMPSPlay version, can now use DirectSound/XAudio2
Browse files Browse the repository at this point in the history
External audio output libraries are now required.
In the future, cross-referencing SMPSPlay files would be optimal.
  • Loading branch information
ValleyBell committed Aug 26, 2015
1 parent c987e18 commit e206ef5
Show file tree
Hide file tree
Showing 34 changed files with 6,892 additions and 2,029 deletions.
515 changes: 368 additions & 147 deletions SMPSOUT/Engine/dac.c

Large diffs are not rendered by default.

56 changes: 36 additions & 20 deletions SMPSOUT/Engine/dac.h
@@ -1,47 +1,60 @@
#ifndef __DAC_H__
#define __DAC_H__

#ifdef __cplusplus
extern "C"
{
#endif

#define COMPR_PCM 0x00
#define COMPR_DPCM 0x01

typedef struct _dac_sample
{
char* File;
UINT8* Data;
const UINT8* DPCMArr;
UINT8* DPCMArr;
UINT32 Size;
UINT8 Compr;
UINT8 Flags;
#ifdef ENABLE_VGM_LOGGING
UINT8 UsageID;
#endif
} DAC_SAMPLE;
typedef struct _dac_table
{
UINT16 Sample;
UINT8 Pan;
UINT8 reserved;
UINT8 Flags;
UINT8 Algo;
UINT32 Rate;
UINT32 OverriddenRate;
} DAC_TABLE;

#define DACRM_DELAY 0x00
#define DACRM_OVERFLOW 0x01
#define DACRM_NOVERFLOW 0x02
typedef struct _dac_settings
#define DACSM_NORMAL 0x00
#define DACSM_INTERPLT 0x01 // do linear interpolation between samples
typedef struct _dac_algorithm
{
UINT8 DefCompr; // default compression mode
UINT8 RateMode;
UINT32 BaseCycles;
UINT32 LoopCycles;
UINT32 LoopSamples;
UINT32 RateOverflow;

UINT32 BaseRate;
UINT32 Divider; // Note: .2 (decimal) Fixed Point, i.e. 123 means 1.23
UINT8 RateMode;
union
{
// RM_DELAY: use Divider, RM_[N]OVERFLOW: use RateOverflow
UINT32 Divider; // Note: .2 (decimal) Fixed Point, i.e. 123 means 1.23
UINT32 RateOverflow;
};
} DAC_ALGO;
typedef struct _dac_settings
{
UINT8 AlgoAlloc;
UINT8 AlgoCount;
DAC_ALGO* Algos;

UINT8 SmplMode; // Resample Mode
UINT8 Channels;
UINT8 VolDiv;
INT8 VolDiv;
} DAC_SETTINGS;

typedef struct _dac_config
Expand All @@ -55,11 +68,17 @@ typedef struct _dac_config
UINT16 TblCount;
UINT16 TblAlloc;
DAC_TABLE* SmplTbl;

UINT8 BankCount;
UINT8 BankAlloc;
UINT16* BankTbl; // stores the Base Sample for each bank
} DAC_CFG;


#define DACFLAG_LOOP 0x01
#define DACFLAG_REVERSE 0x02
#define DACFLAG_LOOP 0x01
#define DACFLAG_REVERSE 0x02
#define DACFLAG_FLIP_FLOP 0x04
#define DACFLAG_FF_STATE 0x08


void SetDACDriver(DAC_CFG* DACSet);
Expand All @@ -72,14 +91,11 @@ void DAC_SetRateOverride(UINT16 SmplID, UINT32 Rate);
void DAC_SetVolume(UINT8 Chn, UINT16 Volume);

void DAC_Stop(UINT8 Chn);
void DAC_Play(UINT8 Chn, UINT16 SmplID);
UINT8 DAC_Play(UINT8 Chn, UINT16 SmplID);
void DAC_SetBank(UINT8 Chn, UINT8 BankID);
void DAC_SetRate(UINT8 Chn, UINT32 Rate, UINT8 MidNote);
void DAC_SetFrequency(UINT8 Chn, UINT32 Freq, UINT8 MidNote);

void UpdateDAC(UINT32 Samples);

#ifdef __cplusplus
}
#endif

#endif // __DAC_H__

0 comments on commit e206ef5

Please sign in to comment.