Giter Club home page Giter Club logo

Comments (7)

rokach avatar rokach commented on June 5, 2024 1

Thank you so much Dennis! your support is awesome I definitely try it

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 5, 2024

Hey, yeah Xcode 14.2 is not supported currently with the latest version. I think 13 was the last one where it was, maybe even 12.

so the solution would be to update to latest Xcode 15.x (15.2 is the current one at this point).

is that an option for you, or why are you still on Xcode 14?

from dswaveformimage.

rokach avatar rokach commented on June 5, 2024

Ok, yeah I'm using Xcode 14 becuase I'm using MacBook Pro 2015 and macOS 12 is the last version for it so I can't update to macOS 13/14 and Xcode 15

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 5, 2024

Hmm ok, that’s of course a good reason. If I’m not mistaken though, isn’t Xcode 15 required (soon?) to publish to the AppStore though anyway? Or will Xcode 14 keep being supported for a longer time?

I suppose there should be another way to do the visionOS checks backwards compatible… just not sure right now how. I’d have to check for that.

from dswaveformimage.

rokach avatar rokach commented on June 5, 2024

Hmm ok, that’s of course a good reason. If I’m not mistaken though, isn’t Xcode 15 required (soon?) to publish to the AppStore though anyway? Or will Xcode 14 keep being supported for a longer time?

I suppose there should be another way to do the visionOS checks backwards compatible… just not sure right now how. I’d have to check for that.

My app can't submit to the AppStore because I'm using Apple private framework.
I don't know about Xcode 15 required but I also have M1 Pro so I don't want to make you hard work
Can we talk on email or twitter (@avirok1)?
Thank you for your quick replay and help

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 5, 2024

Sure, happy to continue conversation on twitter. Seems like I can't message you there however due to your privacy settings. I'm @dmrschmidt there, too.

So, I'm now finally on my laptop and wanted to have a closer look at the issue. And I guess I was simply led astray by the warning in the first screenshot. That doesn't actually cause the problem. The issue is, that WaveformImageView is iOS only. For macOS, the only currently supported utility views are SwiftUI. That's because WaveformImageView inherits from UIImageView. I'm not a macOS developer myself, so not sure what the equivalent there would be, but I assume that the approach would be equally straightforward for a lightweight subclass of NSImageView.

So all things considered, depending on your use case, I'd suggest you either just use images with WaveformImageDrawer directly, or you add your own small convenience NS[Image]View subclass around it. I wouldn't be surprised if the code translates almost 1:1 with only replacing UI for NS prefixes. If you have a look at WaveformImageView, it's really just a dead simple wrapper.

If your app requires any scrolling etc, it's not a great choice anyway, as it's not handling any caching and whatnot. It's designed to be a quick drop in for the majority of simple cases. Any more sophisticated use cases in table or scroll views etc should be implemented with WaveformImageDrawer.

from dswaveformimage.

dmrschmidt avatar dmrschmidt commented on June 5, 2024

Following up on our twitter conversation, to simulate a basic "speech sensitive" view, you could go with something like the following.

You need a WaveformRenderer that ignores the lastOffset to avoid the waveform from scrolling as new samples come in. This can be done easily via composing the existing LinearWaveformRenderer like so:

struct StaticWaveformRenderer: WaveformRenderer {
    let baseRenderer = LinearWaveformRenderer()

    func path(samples: [Float], with configuration: Waveform.Configuration, lastOffset: Int, position: Waveform.Position) -> CGPath {
        return baseRenderer.path(samples: samples, with: configuration, lastOffset: 0)
    }

    func render(samples: [Float], on context: CGContext, with configuration: Waveform.Configuration, lastOffset: Int, position: Waveform.Position) {
        baseRenderer.render(samples: samples, on: context, with: configuration, lastOffset: 0)
    }
}

Then all you need is to use that one in a narrowed-down WaveformLiveCanvas with strong damping on both side, like so:

WaveformLiveCanvas(
    samples: samples,
    configuration: configuration.with(damping: .init(percentage: 0.4, sides: .both)),
    renderer: StaticWaveformRenderer(),
    shouldDrawSilencePadding: true
)
.frame(width: 48, height: 32)

This will result in something like I'd already shared with you:

Screen.Recording.2024-01-14.at.10.03.15.2.mov

from dswaveformimage.

Related Issues (20)

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.