Compare commits
4 Commits
Release_1.
...
Release_1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10c83e8bf5 | ||
|
|
d5b44e44e1 | ||
|
|
dcd488c48c | ||
|
|
db08631ab9 |
@@ -23,32 +23,32 @@
|
|||||||
<ProjectGuid>{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}</ProjectGuid>
|
<ProjectGuid>{F7B78CC7-6984-4F79-9486-ABCF87DF9F06}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>SpaceCadetPinball</RootNamespace>
|
<RootNamespace>SpaceCadetPinball</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
<CharacterSet>NotSet</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -2377,6 +2377,12 @@ HPSTR WaveMix::SamplesPerSecAlign(HPSTR lpInData, DWORD nInSamplesPerSec, DWORD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dump raw PCM for analysis.
|
||||||
|
/*FILE* file;
|
||||||
|
fopen_s(&file,"wav1_dump.raw", "w");
|
||||||
|
fwrite(dataBufBup, 1, sampleSize * dwNumSamples2, file);
|
||||||
|
fclose(file);*/
|
||||||
|
|
||||||
GlobalUnlock(GlobalHandle(lpInDataBup));
|
GlobalUnlock(GlobalHandle(lpInDataBup));
|
||||||
GlobalFree(GlobalHandle(lpInDataBup));
|
GlobalFree(GlobalHandle(lpInDataBup));
|
||||||
return dataBufBup;
|
return dataBufBup;
|
||||||
@@ -2427,7 +2433,7 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
|
|||||||
{
|
{
|
||||||
auto sample = *src;
|
auto sample = *src;
|
||||||
auto dst2 = &dst[nChannels];
|
auto dst2 = &dst[nChannels];
|
||||||
auto delta = (src[nChannels] - src[0]) / nRep;
|
auto delta = (src[nChannels] - src[0]) / static_cast<int>(nRep);
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
dst++;
|
dst++;
|
||||||
for (auto repeatIndex = nRep - 1; repeatIndex; repeatIndex--)
|
for (auto repeatIndex = nRep - 1; repeatIndex; repeatIndex--)
|
||||||
@@ -2447,7 +2453,7 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
|
|||||||
{
|
{
|
||||||
auto sample = *src;
|
auto sample = *src;
|
||||||
auto dst2 = &dst[nChannels];
|
auto dst2 = &dst[nChannels];
|
||||||
auto delta = (src[nChannels] - src[0]) / nRep; /*Was dst[nChannels] - */
|
auto delta = (src[nChannels] - src[0]) / static_cast<int>(nRep); /*Was dst[nChannels] - */
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
++dst;
|
++dst;
|
||||||
for (auto repeatIndex2 = nRep - 1; repeatIndex2; --repeatIndex2)
|
for (auto repeatIndex2 = nRep - 1; repeatIndex2; --repeatIndex2)
|
||||||
|
|||||||
@@ -135,6 +135,8 @@ int loader::get_sound_id(int groupIndex)
|
|||||||
|
|
||||||
if (!sound_list[soundIndex].Loaded && !sound_list[soundIndex].WavePtr)
|
if (!sound_list[soundIndex].Loaded && !sound_list[soundIndex].WavePtr)
|
||||||
{
|
{
|
||||||
|
WaveHeader wavHeader{};
|
||||||
|
|
||||||
int soundGroupId = sound_list[soundIndex].GroupIndex;
|
int soundGroupId = sound_list[soundIndex].GroupIndex;
|
||||||
sound_list[soundIndex].Duration = 0.0;
|
sound_list[soundIndex].Duration = 0.0;
|
||||||
if (soundGroupId > 0 && !pinball::quickFlag)
|
if (soundGroupId > 0 && !pinball::quickFlag)
|
||||||
@@ -150,9 +152,10 @@ int loader::get_sound_id(int groupIndex)
|
|||||||
pinball::make_path_name(filePath, fileName2);
|
pinball::make_path_name(filePath, fileName2);
|
||||||
|
|
||||||
HFILE hFile = _lopen(filePath, 0);
|
HFILE hFile = _lopen(filePath, 0);
|
||||||
sound_list[soundIndex].Duration = static_cast<float>(static_cast<double>(_llseek(hFile, 0, SEEK_END)) *
|
_lread(hFile, &wavHeader, sizeof wavHeader);
|
||||||
0.0000909090909090909);
|
|
||||||
_lclose(hFile);
|
_lclose(hFile);
|
||||||
|
auto sampleCount = wavHeader.data_size / (wavHeader.channels * (wavHeader.bits_per_sample / 8.0));
|
||||||
|
sound_list[soundIndex].Duration = static_cast<float>(sampleCount / wavHeader.sample_rate);
|
||||||
sound_list[soundIndex].WavePtr = Sound::LoadWaveFile(filePath);
|
sound_list[soundIndex].WavePtr = Sound::LoadWaveFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,40 @@ struct visualStruct
|
|||||||
zmap_header_type* ZMap;
|
zmap_header_type* ZMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
// WAVE file header format
|
||||||
|
struct WaveHeader
|
||||||
|
{
|
||||||
|
unsigned char riff[4]; // RIFF string
|
||||||
|
|
||||||
|
unsigned int overall_size; // overall size of file in bytes
|
||||||
|
|
||||||
|
unsigned char wave[4]; // WAVE string
|
||||||
|
|
||||||
|
unsigned char fmt_chunk_marker[4]; // fmt string with trailing null char
|
||||||
|
|
||||||
|
unsigned int length_of_fmt; // length of the format data
|
||||||
|
|
||||||
|
unsigned short format_type; // format type. 1-PCM, 3- IEEE float, 6 - 8bit A law, 7 - 8bit mu law
|
||||||
|
|
||||||
|
unsigned short channels; // no.of channels
|
||||||
|
|
||||||
|
unsigned int sample_rate; // sampling rate (blocks per second)
|
||||||
|
|
||||||
|
unsigned int byterate; // SampleRate * NumChannels * BitsPerSample/8
|
||||||
|
|
||||||
|
unsigned short block_align; // NumChannels * BitsPerSample/8
|
||||||
|
|
||||||
|
unsigned short bits_per_sample; // bits per sample, 8- 8bits, 16- 16 bits etc
|
||||||
|
|
||||||
|
unsigned char data_chunk_header[4]; // DATA string or FLLR string
|
||||||
|
|
||||||
|
unsigned int data_size; // NumSamples * NumChannels * BitsPerSample/8 - size of the next chunk that will be read
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
static_assert(sizeof(WaveHeader) == 44, "Wrong size of WaveHeader");
|
||||||
|
|
||||||
|
|
||||||
class loader
|
class loader
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "pinball.h"
|
#include "pinball.h"
|
||||||
|
|
||||||
tagMCI_OPEN_PARMSA midi::mci_open_info;
|
tagMCI_OPEN_PARMSA midi::mci_open_info;
|
||||||
char midi::midi_device_type[28];
|
char midi::midi_file_name[28];
|
||||||
HWND midi::midi_notify_hwnd;
|
HWND midi::midi_notify_hwnd;
|
||||||
int midi::midi_seq1_open, midi::midi_seq1_playing;
|
int midi::midi_seq1_open, midi::midi_seq1_playing;
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ int midi::music_init(HWND hwnd)
|
|||||||
|
|
||||||
mci_open_info.wDeviceID = 0;
|
mci_open_info.wDeviceID = 0;
|
||||||
midi_notify_hwnd = hwnd;
|
midi_notify_hwnd = hwnd;
|
||||||
lstrcpyA(midi_device_type, pinball::get_rc_string(156, 0));
|
lstrcpyA(midi_file_name, pinball::get_rc_string(156, 0));
|
||||||
mci_open_info.lpstrElementName = nullptr;
|
mci_open_info.lpstrElementName = midi_file_name;
|
||||||
mci_open_info.lpstrDeviceType = midi_device_type;
|
mci_open_info.lpstrDeviceType = nullptr;
|
||||||
auto result = mciSendCommandA(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_NOTIFY_SUPERSEDED, (DWORD_PTR)&mci_open_info);
|
auto result = mciSendCommandA(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_NOTIFY_SUPERSEDED, (DWORD_PTR)&mci_open_info);
|
||||||
midi_seq1_open = result == 0;
|
midi_seq1_open = result == 0;
|
||||||
return midi_seq1_open;
|
return midi_seq1_open;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
static void music_shutdown();
|
static void music_shutdown();
|
||||||
private:
|
private:
|
||||||
static tagMCI_OPEN_PARMSA mci_open_info;
|
static tagMCI_OPEN_PARMSA mci_open_info;
|
||||||
static char midi_device_type[28];
|
static char midi_file_name[28];
|
||||||
static HWND midi_notify_hwnd;
|
static HWND midi_notify_hwnd;
|
||||||
static int midi_seq1_open, midi_seq1_playing;
|
static int midi_seq1_open, midi_seq1_playing;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user