Results 1 to 10 of 27

Thread: Win/Linux/Mac OSX Sound API with no .DLL/.SO dependencies?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ALUT is a bad idea... because this is not a standard functionalty of OpenAL. If you want to play some format(e.g. wav) you should write your own decoder.

  2. #2
    I don't know if you have read them, but the tutorials from Noeska may offer some help: http://www.noeska.com/doal/tutorials.aspx.

  3. #3
    Quote Originally Posted by Andru View Post
    ALUT is a bad idea... because this is not a standard functionalty of OpenAL. If you want to play some format(e.g. wav) you should write your own decoder.
    Usually I would agree with you, but the ALUT stuff I am using in the openal.pas file is software only (has it's own WAV loader code), and doesn't use a DLL at all, so it should be just fine

    @Traveler: thanks, I have seen those, I just had forgotten to do the darn alutInit() call! This is why all my sources/buffers were all at zero.

    cheers,
    Paul

  4. #4
    I was hoping to be able to us BASS for my project that I want to have on pc and Mac and maybe on iOS

    However, the delphi header for Bass requires windows.

    I need to play wav files and mp3.

    Has any got a good solution for this issue?

    I am using dlephi XE2 with firemonkey.

    I am really stuck at the moment.
    The views expressed on this programme are bloody good ones. - Fred Dagg

  5. #5
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    wav, thats the simple side. The problem then is mp3, specifically I would guess you're having trouble finding a decoder to match your license no? I heard of libmpg123 or something like that might be good...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  6. #6
    If you convert the .mp3 to .ogg then I think more 3rd party sound libraries will be able to play the music. Also, .mp3 theoretically requires a license before you can play those

    cheers,
    Paul

  7. #7
    Problem is the app needs to be able to play MP3s because the user has to be able to use their own songs etc. I was hoping to use BASS but the delphi header requires windows.

    I found this which gave me hope

    ----
    Fairly straightforward in Objective Pascal using the ObjC AVAudioPlayer class:

    http://developer.apple.com/library/i.../AVAudioPlayer

    Here's example code:

    var
    snd : AVAudioPlayer;
    {Since sound is played asynchronously, can't release (or autorelease)
    until after sound is done playing, so declare and release somewhere
    outside PlaySound. Call snd.release to release.}

    procedure PlaySound(sndFileName : NSString);
    var
    path : NSString;
    url : NSURL;
    err : NSError;
    begin
    path := NSBundle.mainBundle.resourcePath.
    stringByAppendingPathComponent(sndFileName);

    url := NSURL.fileURLWithPath(path);

    snd := AVAudioPlayer.alloc.initWithContentsOfURL_error(ur l, @err);
    if Assigned(snd) then
    snd.play
    else
    NSLog(NSSTR('Error'));
    end;
    Call it like this:

    PlaySound(NSSTR('Cartoon Boing.mp3'));

    This file is included with iMovie. Just add your audio file(s) to your Xcode project and they'll be copied to your app bundle when you build the app.

    Now, the only thing you'll need is Pascal units for the parsed Foundation and AVFoundation frameworks. Check with Embarc for that.

    Thanks.

    -Phil

    -----

    However, use of the word straightforward was not as straightforward for me. I cannot find a pas file to add to uses that gives me access to the AVAudioPlayer
    The views expressed on this programme are bloody good ones. - Fred Dagg

  8. #8
    Actually he has just replied but I am still in the dark - I will have to read his parsing text and see I get any headway

    ==============
    You'll somehow have to parse the iOS AVFoundation framework on your Mac in order to get access to the Objective C AVAudioPlayer class that you can use in Pascal as in the example code.

    Note that you don't need the entire class, just the methods you need. See this explanation for how to "parse" those methods by hand for now until an updated parser is available:

    https://forums.embarcadero.com/threa...427&tstart=375

    Thanks.

    -Phil
    ===========

    I might have to put it into the too hard basket for a few weeks and come back to it
    The views expressed on this programme are bloody good ones. - Fred Dagg

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •