Code Monkey home page Code Monkey logo

Comments (12)

SolraBizna avatar SolraBizna commented on June 16, 2024 1

My application now works with the latest git.

Thanks for the timely fix!

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024 1

Ai, it just show you should never rust a new release ;-) Thanks. I've removed the println in 0.2.7

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

Thanks for this report. I've got a fix for a buffer problem locally (SEGFAULT). Do you have test or a minimal example that triggers this crash?

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

I just pushed a fix for the SEGFAULT that I found. Could you check if this fixes your issue?

from libsoxr-rs.

SolraBizna avatar SolraBizna commented on June 16, 2024

I'll be able to test it with my code in about ten hours. Looking at the commit in question, it looks like that might fix the crash if set_input is used, but not if Soxr::process is used instead.

I produced a very barebones test program:

use libsoxr::Soxr;

fn main() {
    let mut soxr = Soxr::create(1.0, 2.0, 2, None, None, None).unwrap();
    let mut in_buf: [f32; 2000] = [1.0; 2000];
    for n in 1000..2000 { in_buf[n] = -1.0 }
    let mut out_buf: [f32; 4000] = [999.0; 4000];
    let (i, o) = soxr.process(Some(&in_buf[0..1000]), &mut out_buf[0..2000]).unwrap();
    println!("i = {}, o = {}", i, o);
    let mut has_negative = false;
    for v in out_buf.iter() {
        if *v < 0.0 { has_negative = true; break }
    }
    if has_negative {
        println!("Output contains negative samples. in_buf was read out of bounds!");
    }
    if out_buf[2000] != 999.0 {
        println!("Output sentinel overwritten. out_buf was written out of bounds!");
    }
}

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

I was able to reproduce. I'll look into it further. Thanks!

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

I have just pushed a fix which lets your example pass. I've added your example as a test. Could you check if this works for you? I'll then push to crates.io if it works

from libsoxr-rs.

SolraBizna avatar SolraBizna commented on June 16, 2024

The test_process_stereo_2 test should probably panic! instead of println! for the out-of-bounds checks. Also, you might want to add a note in the documentation for Soxr::process that "number of samples" and "number of array elements" won't be the same if the channel count is greater than one, so that nobody finds the return value surprising. Otherwise, looks good to me; though I won't be able to test it in my application until ten-ish hours from now.

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

good points. I'll make asserts for these cases.

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

I will push a new version tomorrow. Thanks for the report and testing!

from libsoxr-rs.

lrbalt avatar lrbalt commented on June 16, 2024

just pushed 0.2.6 to crates.io

from libsoxr-rs.

SolraBizna avatar SolraBizna commented on June 16, 2024

You left a debug println! on line 231 of soxr.rs in bb57921 :)

from libsoxr-rs.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.