• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems porting from C to this new Swift language
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems porting from C to this new Swift language


  • Subject: Problems porting from C to this new Swift language
  • From: Charles Constant <email@hidden>
  • Date: Fri, 06 Jun 2014 00:19:20 -0700

Hi gang,

I'm trying to port some C that gets an "ExtAudioFileRef" to an audio file and reads it, but I'm getting stuck just opening the file.

When I run this code, "ExtAudioFileOpenURL" doesn't throw an error, but I must be doing something bad with memory because my program crashes with:

EXC_BAD_ACCESS(code=1, address=0x...)

Anyone know what I'm doing incorrectly here?

==================================================================

import AVFoundation

                            

let path = NSBundle.mainBundle().pathForSoundResource( "Glass.aiff" )

let audio_path = NSURL.fileURLWithPath( path )


var unmanaged_audio_file: Unmanaged<ExtAudioFile>?

var err = ExtAudioFileOpenURL( audio_path, &unmanaged_audio_file )

var audio_file: ExtAudioFile = unmanaged_audio_file!.takeRetainedValue()


println( "ExtAudioFileOpenURL error code: \(err)" )


// ExtAudioFileDispose( audio_file )


==================================================================

I'm hoping to redo a project in Swift, as it should save my some effort in the long run. In the short run, I'm getting quite lost as it's hard to find reference code for such a new language. 

Cheers!

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Where can I find starter AudioUnit projects?
  • Next by Date: RE: Where can I find starter AudioUnit projects?
  • Previous by thread: Re: Where can I find starter AudioUnit projects?
  • Next by thread: auval x64 Mavericks
  • Index(es):
    • Date
    • Thread