mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
parent
dae824ab75
commit
7f3bee15f0
@ -465,6 +465,8 @@ int TPinballTable::Message(int code, float value)
|
|||||||
Sound::Idle();
|
Sound::Idle();
|
||||||
LightGroup->Message(28, 0.2f);
|
LightGroup->Message(28, 0.2f);
|
||||||
auto time = loader::play_sound(SoundIndex1);
|
auto time = loader::play_sound(SoundIndex1);
|
||||||
|
if (time < 0)
|
||||||
|
time = 5.0f;
|
||||||
LightShowTimer = timer::set(time, this, LightShow_timeout);
|
LightShowTimer = timer::set(time, this, LightShow_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +94,7 @@ void loader::loadfrom(datFileStruct* datFile)
|
|||||||
{
|
{
|
||||||
if (sound_count < 65)
|
if (sound_count < 65)
|
||||||
{
|
{
|
||||||
sound_list[sound_count].WavePtr = nullptr;
|
sound_list[sound_count] = {nullptr, groupIndex, 0, 0, nullptr};
|
||||||
sound_list[sound_count].GroupIndex = groupIndex;
|
|
||||||
sound_count++;
|
sound_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,6 +110,7 @@ void loader::unload()
|
|||||||
|
|
||||||
if (sound_list[index].PtrToSmth)
|
if (sound_list[index].PtrToSmth)
|
||||||
memory::free(sound_list[index].PtrToSmth);
|
memory::free(sound_list[index].PtrToSmth);
|
||||||
|
sound_list[index] = {};
|
||||||
sound_count = 1;
|
sound_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,11 +151,17 @@ int loader::get_sound_id(int groupIndex)
|
|||||||
sprintf_s(fileName2, pb::FullTiltMode ? "SOUND\\%s" : "%s", fileName);
|
sprintf_s(fileName2, pb::FullTiltMode ? "SOUND\\%s" : "%s", fileName);
|
||||||
pinball::make_path_name(filePath, fileName2);
|
pinball::make_path_name(filePath, fileName2);
|
||||||
|
|
||||||
|
float duration = -1;
|
||||||
HFILE hFile = _lopen(filePath, 0);
|
HFILE hFile = _lopen(filePath, 0);
|
||||||
_lread(hFile, &wavHeader, sizeof wavHeader);
|
if (hFile != HFILE_ERROR)
|
||||||
_lclose(hFile);
|
{
|
||||||
auto sampleCount = wavHeader.data_size / (wavHeader.channels * (wavHeader.bits_per_sample / 8.0));
|
_lread(hFile, &wavHeader, sizeof wavHeader);
|
||||||
sound_list[soundIndex].Duration = static_cast<float>(sampleCount / wavHeader.sample_rate);
|
_lclose(hFile);
|
||||||
|
auto sampleCount = wavHeader.data_size / (wavHeader.channels * (wavHeader.bits_per_sample / 8.0));
|
||||||
|
duration = static_cast<float>(sampleCount / wavHeader.sample_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
sound_list[soundIndex].Duration = duration;
|
||||||
sound_list[soundIndex].WavePtr = Sound::LoadWaveFile(filePath);
|
sound_list[soundIndex].WavePtr = Sound::LoadWaveFile(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user