Sign in to follow this  
ukdeveloper

SDL - Passing Mix_Chunk by reference

Recommended Posts

ukdeveloper    264
Hi, Following my post in For Beginners, I've basically discovered what the problem I faced was - I need to be able to pass Mix_Chunk by reference. I have an audio "surface" called Mix_Chunk *soundbite (it's purely for testing just now, I'm going to expand my solution later). It gets passed into 3 different functions as a parameter - one for loading a wav file, one for playing it and one for freeing it again. At the current time, I'm using pointers, therefore passing by value, which in turn means that the version of soundbite passed in to each function is different, thus causing the error of it being NULL when the player function tries to play it. The correct "version" of soundbite only exists within the load function, as it does when you use pointers. Is it possible to pass Mix_Chunk variables by reference at all? If so, what's the exact syntax for doing it? That would mean the same thing reaches every function, meaning it'll work :) Thanks, ukdeveloper. [Edited by - ukdeveloper on June 11, 2005 10:00:09 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this