Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 30

Thread: JEDI-SDL Audio

  1. #11

    JEDI-SDL Audio

    That all works, except one thing. It won't load my audio files. I'm using this code:

    [pascal]
    //{$mode delphi}
    Program testsdl;

    uses sdl, sdl_mixer, sysutils;

    var
    audio_rate: integer;
    audio_format: Uint16;
    audio_channels: integer;
    audio_buffers : integer;
    loops: integer;
    wav : word;
    wave : pmix_chunk;
    baudioopen : boolean;

    begin
    loops := 0;
    SDL_INIT(SDL_INIT_AUDIO);
    if ((SDL_INIT(SDL_INIT_AUDIO) < 0)) then begin
    Sdl_Quit;
    exit;
    end
    else
    begin
    writeln('1');
    audio_rate := 22050;
    audio_format := wav;
    audio_channels := 2;
    audio_buffers := 4064;
    baudioopen := false;
    writeln('2');
    wave := mix_loadwav('wakeup.wav');
    if wave = nil then exit;
    mix_playchannel(0, wave, loops);
    while (mix_playing(0) = 0 ) do sdl_delay(100);
    writeln('3');
    end;
    if wave <> nil then begin
    writeln('free');
    mix_freechunk(wave);
    wave := nil;
    end;
    if ( bAudioOpen ) then // bAudioOpen is just some flag that was used to keep track if the audio device was opened.
    begin
    Mix_CloseAudio;
    writeln('4');
    end;
    readln;
    SDL_Quit;
    end.
    [/pascal]

    If I run it in a command prompt, it shows me up to '2' and then closes... Right where if wave = nil. If I comment that out, it gives me an error- basically, can't play 'nil'.
    --MagicRPG--

  2. #12

    JEDI-SDL Audio

    So where is your wav file located?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #13

    JEDI-SDL Audio

    In the same folder as the app. Originally it was in C:\sounds\wakeup.wav, and the path was appropriate, but I though that MAYBE for some reason it couldn't handle a full path and so switched it to the same directory. The EXE, and the .wav, is in C:\projects\tests\jedisdl\
    --MagicRPG--

  4. #14

    JEDI-SDL Audio

    What type of Wav file is it? Is it using some kind of funky compression?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  5. #15

    JEDI-SDL Audio

    No its not using any... I made it myself. I also tried an MP3 file (it does support mp3's, according to the jedi-sdl site) but that didn't work either.
    --MagicRPG--

  6. #16

    JEDI-SDL Audio

    Have you tried Mix_GetError after the call to mix_loadwav? What does it say? If not, why not?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  7. #17

    JEDI-SDL Audio

    Didn't realize I could I'll try it right now

    OK, Audio Device hasn't been opened.
    --MagicRPG--

  8. #18

    JEDI-SDL Audio

    So what does that tell you? What have you missed?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  9. #19

    JEDI-SDL Audio

    No clue, cause I don't know how to initialize the audio
    --MagicRPG--

  10. #20

    JEDI-SDL Audio

    WILL posted an example earlier. Look for Mix_OpenAudio in this thread.

    If someone posts an example, please make sure that what you have tried is not already mentioned.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

Page 2 of 3 FirstFirst 123 LastLast

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
  •