Post

Replies

Boosts

Views

Activity

Reply to AVAudioSequencer - when has play finished?
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]; }]; }
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’24
Reply to Get AVAudioSequencer to notify completion
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]; }]; } ``
Topic: Media Technologies SubTopic: Audio Tags:
Nov ’24
Reply to Get AVAudioSequencer to notify completion
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
Topic: Media Technologies SubTopic: Audio Tags:
Nov ’24
Reply to AVAudioSequencer - when has play finished?
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
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’24
Reply to SwiftUI List OutlineGroup
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()
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to sem_t in sandbox app
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
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’24
Reply to Swift CPU usage for-loop
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
Topic: Media Technologies SubTopic: Audio Tags:
Jun ’22
Reply to XCode 13 - No Help Book
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.
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’21