Replaces the previous reply:
Once the data (or URL ) is loaded I determine the seconds in the tracks; I then issue a Timer at the computed time which calls a delegate method. The delegate triggers a method to deactivate the timer
-(NSTimeInterval)totalLengthInSeconds {
NSTimeInterval result = 0.5;
for(AVMusicTrack *track in _audioSequencer.tracks) {
result = MAX( result, track.lengthInSeconds);
}
return result;
}
-(void) example {
[_audioSequencer prepareToPlay];
NSTimeInterval totalLengthInSeconds = [self totalLengthInSeconds];
[_audioSequencer startAndReturnError:&error];
_audioSequencer.currentPositionInSeconds = 0;
_sequencerTimer = [NSTimer scheduledTimerWithTimeInterval:totalLengthInSeconds repeats:NO block:^(NSTimer * _Nonnull timer) {
[self.delegate midiPlayerDidEnd];
}];
}
Post
Replies
Boosts
Views
Activity
Replace the previous reply:
Once the data (or URL ) is loaded, I determine the seconds in the tracks; I then issue a Timer at the computed time which call a delegate method.
The delegate triggers a method to deactivate the timer
> -(NSTimeInterval)totalLengthInSeconds {
NSTimeInterval result = 0.5;
for(AVMusicTrack *track in _audioSequencer.tracks) {
result = MAX( result, track.lengthInSeconds);
}
return result;
}
-(void) example {
[_audioSequencer prepareToPlay];
NSTimeInterval totalLengthInSeconds = [self totalLengthInSeconds];
[_audioSequencer startAndReturnError:&error];
_audioSequencer.currentPositionInSeconds = 0;
_sequencerTimer = [NSTimer
scheduledTimerWithTimeInterval:totalLengthInSeconds repeats:NO block:^(NSTimer * _Nonnull timer) {
[self.delegate midiPlayerDidEnd];
}];
}
``
Maybe a little late but here is a workaround
Once the data (or URL ) is loaded I determine the seconds in the tracks; I then issue a Timer at the computed time which call a delegate method. The delegate triggers a method to deactivate the timer
-(NSTimeInterval)totalLengthInSeconds {
NSTimeInterval result = 0.5;
for(AVMusicTrack *track in _audioSequencer.tracks) {
result += track.lengthInSeconds;
}
return result;
}
-(void) example {
[_audioSequencer prepareToPlay];
NSTimeInterval totalLengthInSeconds = [self totalLengthInSeconds];
[_audioSequencer startAndReturnError:&error];
_audioSequencer.currentPositionInSeconds = 0;
_sequencerTimer = [NSTimer scheduledTimerWithTimeInterval:totalLengthInSeconds repeats:NO block:^(NSTimer * _Nonnull timer) {
[self.delegate midiPlayerDidEnd];
}];
}
BlockQuote
Maybe a little late but here is a workaround
Once the data (or URL ) is loaded I determine the seconds in the tracks;
I then issue a Timer at the computed time which call a delegate method.
The delegate triggers a method to deactivate the timer
-(NSTimeInterval)totalLengthInSeconds {
NSTimeInterval result = 0.5;
for(AVMusicTrack *track in _audioSequencer.tracks) {
result += track.lengthInSeconds;
}
return result;
}
-(void) example {
[_audioSequencer prepareToPlay];
NSTimeInterval totalLengthInSeconds = [self totalLengthInSeconds];
[_audioSequencer startAndReturnError:&error];
_audioSequencer.currentPositionInSeconds = 0;
_sequencerTimer = [NSTimer scheduledTimerWithTimeInterval:totalLengthInSeconds repeats:NO block:^(NSTimer * _Nonnull timer) {
[self.delegate midiPlayerDidEnd];
}];
}
BlockQuote
I did dig into your suggestion and the first issue is now solved by encapsulating the Text() and a Spacer() in a HStack(), using .contentShape(Rectangle()) and the onTabGesture {} on the HStack(). The frame() modifier is not needed.
The detail view is updated and sync when clicking on any part of the selection
struct MyOutLine: View {
let title:String
@Binding var itemString:String
@State private var selection: FileItem?
var body: some View {
List(selection: $selection) {
OutlineGroup(data, children: \.children) { item in
HStack {
Text ("\(item.description)")
Spacer()
}
.contentShape(Rectangle())
.onTapGesture {
selection = item
itemString = item.description
}
.listRowBackground(
selection == item ?
Color.gray
:nil
)
}
}
.listStyle(.sidebar)
.onAppear { itemString = "No selection"}
}
}
This does not help for listRowBackground()
Indeed it is working fine when using the slash .
I was also using the same string for the group and the semaphore and I understand now the /NNN concerns the semaphore name only.
Thank you so much
Jean Marie
Thank you for the answer.
I followed your instructions but unfortunately I still received SEM_FAILED
Here is my entitlement file, I replace my identifier_ID by TEST12345 as I do not plan to go for the App Store
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>TEST12345.com.OBJCSemaphore</string>
</array>
</dict>
</plist>
The group is created in ~~/Library/Group Containers
The semaphore is created using the same group name: TEST12345.com.OBJCSemaphore
I cannot see what I'm missing
I tried but the swap has no impact on the CPU usage and the result is not the one expected as it will fill all ranges in arrMag that are above the expected one. When I fix this issue using a labeled-statement, the CPU usage remains high
Hi, In fact it is a sandbox issue. I could have the Help Book launched correctly when I run my main app outside Xcode… When I did move the app from the Xcode debug folder to my user application folder, I could call the Help Book without problem after deleting the cache ~/library/caches/com.apple.helpd and log off / log on.
I have the same issue.
The Help Book is working just fine on a Yosemite - Xcode 7 environment.
Also, some .help are recognised as helpViewer bundle, some not.
I suppose it is related to new security requirements in the bundle.