direct sound ja parempi syncca
This commit is contained in:
@ -7,7 +7,10 @@
|
||||
#define VC_LEANMEAN
|
||||
#define VC_EXTRALEAN
|
||||
|
||||
#pragma pack(push, 8)
|
||||
#include <windows.h>
|
||||
#pragma pack(pop)
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
// global resolution
|
||||
@ -46,43 +49,44 @@ static DEVMODE screenSettings = {
|
||||
};
|
||||
|
||||
#if USE_AUDIO
|
||||
#include <mmsystem.h>
|
||||
#include <mmreg.h>
|
||||
// this file is auto generated by sointu
|
||||
#include "sointu/song.h"
|
||||
#ifndef DSBCAPS_TRUEPLAYPOSITION // Not defined in MinGW dsound headers, so let's add it
|
||||
#define DSBCAPS_TRUEPLAYPOSITION 0x00080000
|
||||
#endif
|
||||
#include <mmreg.h>
|
||||
#include <dsound.h>
|
||||
|
||||
|
||||
SUsample sound_buffer[SU_LENGTH_IN_SAMPLES * SU_CHANNEL_COUNT];
|
||||
WAVEFORMATEX wave_format = {
|
||||
#ifdef SU_SAMPLE_FLOAT
|
||||
WAVE_FORMAT_IEEE_FLOAT,
|
||||
#else
|
||||
WAVE_FORMAT_PCM,
|
||||
#endif
|
||||
SU_CHANNEL_COUNT,
|
||||
SU_SAMPLE_RATE,
|
||||
SU_SAMPLE_RATE * SU_SAMPLE_SIZE * SU_CHANNEL_COUNT,
|
||||
SU_SAMPLE_SIZE * SU_CHANNEL_COUNT,
|
||||
SU_SAMPLE_SIZE * 8,
|
||||
0
|
||||
};
|
||||
#pragma data_seg(".descfmt")
|
||||
DSBUFFERDESC buffer_description = {
|
||||
sizeof(DSBUFFERDESC),
|
||||
DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_TRUEPLAYPOSITION,
|
||||
SU_LENGTH_IN_SAMPLES * SU_SAMPLE_SIZE * SU_CHANNEL_COUNT,
|
||||
0,
|
||||
&wave_format,
|
||||
0
|
||||
};
|
||||
|
||||
#pragma bss_seg(".syncbuf")
|
||||
extern "C" {
|
||||
int _fltused = 1;
|
||||
float syncBuf[SU_SYNCBUFFER_LENGTH+1];
|
||||
}
|
||||
|
||||
#pragma data_seg(".sointuout")
|
||||
static SUsample lpSoundBuffer[(int)SU_LENGTH_IN_SAMPLES * 2];
|
||||
static HWAVEOUT hWaveOut;
|
||||
|
||||
#pragma data_seg(".wavefmt")
|
||||
static WAVEFORMATEX WaveFMT =
|
||||
{
|
||||
WAVE_FORMAT_IEEE_FLOAT,
|
||||
2, // channels
|
||||
SU_SAMPLE_RATE, // samples per sec
|
||||
SU_SAMPLE_RATE*sizeof(SUsample) * 2, // bytes per sec
|
||||
sizeof(SUsample) * 2, // block alignment;
|
||||
sizeof(SUsample) * 8, // bits per sample
|
||||
0 // extension not needed
|
||||
};
|
||||
|
||||
#pragma data_seg(".wavehdr")
|
||||
static WAVEHDR WaveHDR =
|
||||
{
|
||||
(LPSTR)lpSoundBuffer, SU_LENGTH_IN_SAMPLES * sizeof(SUsample) * 2, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static MMTIME MMTime =
|
||||
{
|
||||
TIME_SAMPLES, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
// currently unused definitions
|
||||
|
||||
Reference in New Issue
Block a user