EzDevInfo.com

Tempo

Date and time manager for iOS/OSX written in Swift Tempo by remirobert

In Tempo.js - the JavaScript rendering engine, what is the best way to deal with no results being returned in the JSON array?

Using Tempo.js, I would like to be able to render a message if there are no items in the JSON array. As far as i can tell, you cannot put anything inside the 'data-template' as these are not even called if there are no items in the JSON array to loop through. I would imagine this should work something like the example below (???? = a magical command to display if no rows exist):

<div data-template-?????>Show this if there is no messages</div>

<div data-template>
    Display each message looped through
</div>

<div data-template-fallback>Sorry, JavaScript required!</div>

I cannot find way to do this all through the Tempo.js docs. Have i missed this ? Or is there another way to achieve this ?

I know i could do this is JS before rendering the template, but that kind of defeats the point of keeping the JS and HTML template code seperate so would like to do this completely within the template if possible.

Any ideas would be greatly appreciated.


Source: (StackOverflow)

Soundtouch example to change tempo

I want to build a application which can change tempo, pitch,... of exist audio file and export them to new file. I found SoundTouch can do that. I can find audio's bpm but cannot read data from file to SoundTouch and edit that. Here is a example i found but cannot work:

NSArray *effects = [NSArray arrayWithObjects:@"-rate=-22", nil];
NSURL *audio = [self base:input output:output effects:effects];

- (NSURL *)base:(NSURL *)input output:(NSURL *)output effects:(NSArray *)effects{
    int _argc = 3 + (int)[effects count];

    const char *_argv[]={"createWavWithEffect",[[input path] UTF8String], [[output path] UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String],[@"" UTF8String]};

    for (int i=0; i<[effects count]; i++) {
        _argv[i+3] = [effects[i] UTF8String];
    }
    createWavWithEffect(_argc, _argv);

    // IMPORTANT! Check the file size, maybe you will need to set by yourself

    return output;
}

But i can't find anywhere a example to do that??? Anyone can help? Thanks


Source: (StackOverflow)

Advertisements