void SamplerState::set_lod_bias(double lod_bias) { if (sampler_desc.MipLODBias != (double)lod_bias) { sampler_desc.MipLODBias = (double)lod_bias; sampler_state_changed(); } }
void SamplerState::set_max_lod(double max_lod) { if (sampler_desc.MaxLOD != (float)max_lod) { sampler_desc.MaxLOD = (float)max_lod; sampler_state_changed(); } }
void SamplerState::set_mag_filter(TextureFilter filter) { if (mag_filter != filter) { mag_filter = filter; sampler_desc.Filter = to_d3d_filter(min_filter, mag_filter, compare_mode, max_anisotropy); sampler_state_changed(); } }
void SamplerState::set_wrap_mode(TextureWrapMode wrap_s) { D3D11_TEXTURE_ADDRESS_MODE mode_u = to_d3d_texture_address(wrap_s); if (mode_u != sampler_desc.AddressU) { sampler_desc.AddressU = mode_u; sampler_state_changed(); } }
void SamplerState::set_max_anisotropy(float v) { if (max_anisotropy != v) { max_anisotropy = v; sampler_desc.Filter = to_d3d_filter(min_filter, mag_filter, compare_mode, max_anisotropy); sampler_desc.MaxAnisotropy = clamp((int)v, 1, 16); sampler_state_changed(); } }
void SamplerState::set_border_color(float r, float g, float b, float a) { if (sampler_desc.BorderColor[0] != r || sampler_desc.BorderColor[1] != g || sampler_desc.BorderColor[2] != b || sampler_desc.BorderColor[3] != a) { sampler_desc.BorderColor[0] = r; sampler_desc.BorderColor[1] = g; sampler_desc.BorderColor[2] = b; sampler_desc.BorderColor[3] = a; sampler_state_changed(); } }
void SamplerState::set_texture_compare(TextureCompareMode mode, CompareFunction func) { D3D11_COMPARISON_FUNC comp_func = to_d3d_compare_func(func); if (compare_mode != mode || sampler_desc.ComparisonFunc != comp_func) { compare_mode = mode; sampler_desc.Filter = to_d3d_filter(min_filter, mag_filter, compare_mode, max_anisotropy); sampler_desc.ComparisonFunc = comp_func; sampler_state_changed(); } }
void SamplerState::set_wrap_mode(TextureWrapMode wrap_s, TextureWrapMode wrap_t, TextureWrapMode wrap_r) { D3D11_TEXTURE_ADDRESS_MODE mode_u = to_d3d_texture_address(wrap_s); D3D11_TEXTURE_ADDRESS_MODE mode_v = to_d3d_texture_address(wrap_t); D3D11_TEXTURE_ADDRESS_MODE mode_w = to_d3d_texture_address(wrap_r); if (mode_u != sampler_desc.AddressU || mode_v != sampler_desc.AddressV || mode_w != sampler_desc.AddressW) { sampler_desc.AddressU = mode_u; sampler_desc.AddressV = mode_v; sampler_desc.AddressW = mode_w; sampler_state_changed(); } }
bool Deck_playback_process::play_samplers(QVector<float*> &io_playback_bufs, const unsigned short int &buf_size) { short signed int *sample_pointer = nullptr; float sample = 0.0; int index = 0; // For each sampler of this particular deck: // - check if it is still possible to play nb_samples, if so, add 1 to nb_playable_sampler. // - add nb_samples from audio track to existing table of samples // - update current sample for (int i = 0; i < this->nb_samplers; i++) { // Check if sampler is not empty. if (this->at_samplers[i]->get_end_of_samples() > 0) { // Check if sampler is stopped. if (this->get_sampler_state(i) == true) { // Prevent sample table overflow. if ((this->sampler_current_samples[i] + 1) <= (this->at_samplers[i]->get_end_of_samples() - (buf_size * 2))) { sample_pointer = &((this->at_samplers[i]->get_samples())[this->sampler_current_samples[i]]); for (int j = 0; j < buf_size; j++) { sample = (float)*sample_pointer / (float)SHRT_MAX; io_playback_bufs[index][j] = io_playback_bufs[0][j] + sample - (io_playback_bufs[index][j] * sample); sample = (float)*(sample_pointer++) / (float)SHRT_MAX; io_playback_bufs[index+1][j] = io_playback_bufs[1][j] + sample - (io_playback_bufs[index+1][j] * sample); sample_pointer++; } this->sampler_current_samples[i] += buf_size * 2; } else { // Stop playback of this sample. this->set_sampler_state(i, false); emit sampler_state_changed(i, false); } } } } return true; }