audio update: loop region
This commit is contained in:
@@ -142,7 +142,7 @@ SoundWindow::SoundWindow(wiGUI* gui) : GUI(gui)
|
||||
loopedCheckbox->SetEnabled(false);
|
||||
|
||||
volumeSlider = new wiSlider(0, 1, 1, 1000, "Volume: ");
|
||||
volumeSlider->SetTooltip("Enable looping for the selected sound instance.");
|
||||
volumeSlider->SetTooltip("Set volume level for the selected sound instance.");
|
||||
volumeSlider->SetPos(XMFLOAT2(x + 60, y += step));
|
||||
volumeSlider->SetSize(XMFLOAT2(240, 30));
|
||||
volumeSlider->OnSlide([&](wiEventArgs args) {
|
||||
|
||||
@@ -302,6 +302,8 @@ namespace wiAudio
|
||||
instanceinternal->buffer.pAudioData = soundinternal->audioData.data();
|
||||
instanceinternal->buffer.Flags = XAUDIO2_END_OF_STREAM;
|
||||
instanceinternal->buffer.LoopCount = XAUDIO2_LOOP_INFINITE;
|
||||
instanceinternal->buffer.LoopBegin = UINT32(instance->loop_begin * masteringVoiceDetails.InputSampleRate);
|
||||
instanceinternal->buffer.LoopLength = UINT32(instance->loop_length * masteringVoiceDetails.InputSampleRate);
|
||||
|
||||
hr = instanceinternal->sourceVoice->SubmitSourceBuffer(&instanceinternal->buffer);
|
||||
if (FAILED(hr))
|
||||
|
||||
@@ -41,12 +41,17 @@ namespace wiAudio
|
||||
struct SoundInstance
|
||||
{
|
||||
SUBMIX_TYPE type = SUBMIX_TYPE_SOUNDEFFECT;
|
||||
float loop_begin = 0; // loop region begin in seconds (0 = from beginning)
|
||||
float loop_length = 0; // loop region legth in seconds (0 = until the end)
|
||||
wiCPUHandle handle = WI_NULL_HANDLE;
|
||||
|
||||
void operator=(SoundInstance&& other)
|
||||
{
|
||||
type = other.type;
|
||||
loop_begin = other.loop_begin;
|
||||
loop_length = other.loop_length;
|
||||
handle = other.handle;
|
||||
|
||||
other.handle = WI_NULL_HANDLE;
|
||||
}
|
||||
|
||||
@@ -54,6 +59,8 @@ namespace wiAudio
|
||||
SoundInstance(SoundInstance&& other)
|
||||
{
|
||||
type = other.type;
|
||||
loop_begin = other.loop_begin;
|
||||
loop_length = other.loop_length;
|
||||
handle = other.handle;
|
||||
|
||||
other.handle = WI_NULL_HANDLE;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates
|
||||
const int minor = 31;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 7;
|
||||
const int revision = 8;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user