SDL Digest, Vol 22, Issue 44

Hey BIll, thx for the reply, hmm…but I’m supposed to make my own code
manually not by using built-in functions.

So how do I fill the empty space in the buffer to make it the same size?On 10/19/08, sdl-request at lists.libsdl.org wrote:

Send SDL mailing list submissions to
sdl at lists.libsdl.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
or, via email, send a message with subject or body ‘help’ to
sdl-request at lists.libsdl.org

You can reach the person managing the list at
sdl-owner at lists.libsdl.org

When replying, please edit your Subject line so it is more specific
than “Re: Contents of SDL digest…”

Today’s Topics:

  1. writing to file using SDL-mixer (AlgoMantra)
  2. Re: CD supposedly playing, but no audio (Sam Lantinga)
  3. Re: OSX include problem (Scott Harper)
  4. Fwd: SDL Change, raise/lower audio/sound pitch
    (Anonymous Incognito)
  5. Re: Fwd: SDL Change, raise/lower audio/sound pitch (Bill Kendrick)

Message: 1
Date: Sun, 19 Oct 2008 08:32:29 +0530
From: AlgoMantra
Subject: [SDL] writing to file using SDL-mixer
To: sdl at lists.libsdl.org
Message-ID:
<6171110d0810182002y44800db5s60ad2aa4015c3d0b at mail.gmail.com>
Content-Type: text/plain; charset=“iso-8859-1”

hey all,

we’re working on a visual music piece using sdl, and I was wondering
how we could write data to audio files and video files. some of it is
just computer-generated music, and some of it is computer generated
audio-video. we’d like to ‘record’ both the aspects. is it better to do this
with
SDL (if possible) or with some other trick using C/C++?

if you have any relevant links, or examples of code, I’ll be highly obliged.

cheers,
------- -.-
1/f ))) --.
------- …
http://www.algomantra.com
-------------- next part --------------
An HTML attachment was scrubbed…
URL:
http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20081019/66e31e3b/attachment.html


Message: 2
Date: Sat, 18 Oct 2008 20:12:53 -0700
From: Sam Lantinga
Subject: Re: [SDL] CD supposedly playing, but no audio
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID:

It sounds a little out of the scope of SDL, honestly.

Frankly, we should probably drop the CD audio stuff completely from 1.3,
if we haven’t already.

(and maybe provide some drop-in code that does digital audio extraction
that legacy code can use for games that shipped with CD audio tracks.)

That sounds like a good idea to me. Actually the Mac OS X CD support
has always worked that way under the hood. :slight_smile:

See ya!
-Sam Lantinga, Lead Software Engineer, Blizzard Entertainment


Message: 3
Date: Sat, 18 Oct 2008 22:22:18 -0600
From: Scott Harper
Subject: Re: [SDL] OSX include problem
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID: <7A9F195D-A723-4F27-9662-AB663B30356B at gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On Oct 18, 2008, at 1:33 AM, Reinout Roels wrote:

You know what’s weird?
When I write my includes like so:

#include “/opt/local/include/SDL/SDL.h”

IT WORKS! but when I just write “SDL.h” it can’t find it (and i’m sure
sdl-config tells gcc it should look in /opt/local/include/SDL
Any idea why this happens? I would like my code to be compilable in
linux too, so writing the full path is not really a good solution

Just an off-the-wall idea, what if you write your include as #include
<SDL.h>? I’m not an expert, and therefore don’t know how it’s
supposed to work, but I’ve observed that for headers used in the build
vid -I, I want to use the angle-brackets, and not quotes.

– Scott


Message: 4
Date: Sun, 19 Oct 2008 13:04:11 +0700
From: “Anonymous Incognito” <@Anonymous_Incognito>
Subject: [SDL] Fwd: SDL Change, raise/lower audio/sound pitch
To: sdl at lists.libsdl.org
Message-ID:

Content-Type: text/plain; charset=UTF-8

---------- Forwarded message ----------
From: Anonymous Incognito <@Anonymous_Incognito>
Date: Sun, 19 Oct 2008 12:22:38 +0700
Subject: SDL Change, raise/lower audio/sound pitch
To: sdl at lists.libsdl.org

Hi guys, I’m trying to raise the audio pitch when the up arrow key is
pressed and lower it when the down arrow key is pressed. I wrote a
code but I’m wondering why it doesn’t work, the reasons are probably
idiotic since it’s my first time playing with SDL.

void process_pitch(Uint8 *stream, int length) //same as audio_buf and
buf_size

{

Uint32 size=length;

int i;

float pos=wave.soundpos;

Uint8 *sound_buffer=SDL_malloc(sizeof(Uint8)*length);

int factor=1;

float steps =0;

SDL_LockAudio();

for (i=0;i+(factor-1)<size;i+=factor)

{

SDL_memcpy(sound_buffer+i,wave.sound,factor);

steps+=speed;

pos=wave.soundpos+(steps*factor);

}

SDL_memcpy(stream,sound_buffer,length);

wave.soundpos=pos;

SDL_UnlockAudio();

SDL_free(sound_buffer);

}

----------------------------Here’s my callback
function:-------------------------
void audio_callback(void *unused, Uint8 *stream, int len) //used for
SDL audio callback
{
printf(“fillerup”);
Uint8 *waveptr;
int waveleft; //the amount of wave left to play XD
Uint8 *keys;

// Uint8 sound; / Pointer to wave data /
// Uint32 soundlen; /
Length of wave data /
// int soundpos; /
Current play position */

/*
int pos, i;

for(i = 0; i < len; i++){
pos = (int)wav_position;
my_sample[i] = wav_buffer[pos];
wav_position += speed;
while(wav_position >= wav_length){
wav_position -= wav_length;
}
}
*/

/* Set up the pointers, initialization */
waveptr = wave.sound + wave.soundpos;
waveleft = wave.soundlen - wave.soundpos;

/* Go! /
while ( len >= waveleft ) {
/
Process samples */
Uint8 process_buf[waveleft];
SDL_memcpy(process_buf, waveptr, waveleft);
process_audio(process_buf, waveleft);
process_pitch(process_buf, waveleft);

  // play until the end of the audio
  SDL_memcpy(stream, process_buf, waveleft);
  stream += waveleft; //stream is the cumulative amount of waveleft XD
  len -= waveleft;

  // REPEAT
  waveptr = wave.sound;
  waveleft = wave.soundlen;
  wave.soundpos = 0;

}

/* Process samples */
Uint8 process_buf[len];
SDL_memcpy(process_buf, waveptr, len);
process_audio(process_buf, len);
process_pitch(process_buf, waveleft);

// play the processed samples
SDL_memcpy(stream, process_buf, len);
wave.soundpos += len;
}


Message: 5
Date: Sun, 19 Oct 2008 10:41:54 -0700
From: Bill Kendrick
Subject: Re: [SDL] Fwd: SDL Change, raise/lower audio/sound pitch
To: “A list for developers using the SDL library. (includes
SDL-announce)”
Message-ID: <20081019174154.GA16767 at sonic.net>
Content-Type: text/plain; charset=us-ascii

On Sun, Oct 19, 2008 at 01:04:11PM +0700, Anonymous Incognito wrote:

---------- Forwarded message ----------
From: Anonymous Incognito <@Anonymous_Incognito>
Date: Sun, 19 Oct 2008 12:22:38 +0700
Subject: SDL Change, raise/lower audio/sound pitch
To: sdl at lists.libsdl.org

Hi guys, I’m trying to raise the audio pitch when the up arrow key is
pressed and lower it when the down arrow key is pressed. I wrote a
code but I’m wondering why it doesn’t work, the reasons are probably
idiotic since it’s my first time playing with SDL.

I didn’t look at your code too closely, but one thing to worry about
here is buffer size. Raising the pitch and ending up with a smaller
sample will cause under-runs. (Callback system expects same amount of
data to come back, if I recall correctly.)

FWIW, I believe SDL 1.3 will have proper pitch shifting built-in.
See: http://code.google.com/soc/2008/sdl/appinfo.html?csaid=5CFE0967CB98719B

-bill!



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

End of SDL Digest, Vol 22, Issue 44