[SDL] Mix_VolumeMusic doesn't work properly

P. M. polymorphic_messiah at hotmail.com
Wed Jan 22 19:15:01 PST 2003


Have u tried using Mix_Chunk instead of Mix_Music. The following taken from 
SDL_mixer.h indicates the use of Mix_LoadWAV() or Mix_LoadWAV_RW() for the 
type of data your describing.  Line 115 indicates that Mix_LoadWAV() is 
essentially the same as Mix_LoadWAV_RW only with a couple extra parameters 
ie "rb" and 1 thus Mix_LoadWAV() should be enough.  Change the volume via 
Mix_VolumeChunk() or directly from the Mix_Chunk struct eg

Mix_Chunk *chunk;
chunk->volume = 100;

SDL_mixer.h
00113 /* Load a wave file or a music (.mod .s3m .it .xm) file */
00114 extern DECLSPEC Mix_Chunk *Mix_LoadWAV_RW(SDL_RWops *src, int 
freesrc);
00115 #define Mix_LoadWAV(file)       Mix_LoadWAV_RW(SDL_RWFromFile(file, 
"rb"),1)






>From: "Jesse David Andrews" <jdandr2 at uky.edu>
>Reply-To: sdl at libsdl.org
>To: sdl at libsdl.org
>Subject: Re: Re: [SDL] Mix_VolumeMusic doesn't work properly
>Date: Wed, 22 Jan 2003 15:21:21 -0500
>
>ok, I dug around the source, and here is the problem:
>
>from wavstream.c:
>
>/* Unimplemented */
>extern void WAVStream_SetVolume(int volume)
>{
>}
>
>-----Original Message-----
>From: Robert Diel <robert at littlebitlost.com>
>To: sdl at libsdl.org
>Date: 22 Jan 2003 13:44:14 -0600
>Subject: Re: [SDL] Mix_VolumeMusic doesn't work properly
>
>Have you tried Mix_Volume or Mix_VolumeChunk?
>
>On Wed, 2003-01-22 at 11:30, Jesse David Andrews wrote:
> > What operating system?  I also have .it & .mod files working, but I 
>cannot get the volume to change for .wav (haven't tried MP3).
> >
> > I am on linux.
> >
> > Jesse
> >
> >
> > -----Original Message-----
> > From: enzogupi at interfree.it ()
> > To: sdl at libsdl.org
> > Date: 22 Jan 2003 13:17:32 -0000
> > Subject: [SDL] Mix_VolumeMusic doesn't work properly
> >
> >
> > When I try to use Mix_VolumeMusic on mp3 files everithing goes ok.
> > When I replace mp3 with a "midi+sample" music file (ex. .it or .xm)
> > I obtain no effect.
> >
> > You can try by yourself with this small program and the "music.it"
> > file included in SDL "aliens" demo.
> >
> > Simply type:
> >    gcc -c testmusic.c
> >    gcc -o testmusic testmusic.o -lSDL -lSDL_mixer -lpthread
> >
> > and you'll see that modifing the Mix_VolumeMusic value doesn't
> > change the result.
> >
> > I don't think it's my fault 'cause it works with mp3 music.
> >
> > Thanks,
> > Enzo.
> >
> > --- file testmusic.c
> >
> > #include <SDL/SDL.h>
> > #include <SDL/SDL_mixer.h>
> > char MusicName [] = "music.it";
> > Mix_Music* Music;
> > int main()
> > {
> >   if (SDL_Init (SDL_INIT_AUDIO) >= 0) {
> >     if (Mix_OpenAudio (44100,AUDIO_S16,1,8192) >= 0) {
> >       Music = Mix_LoadMUS (MusicName);
> >       Mix_VolumeMusic (50);
> >       if (Music) {
> > 	Mix_PlayMusic (Music,0);
> > 	while (Mix_PlayingMusic()) SDL_Delay (100);
> > 	Mix_FreeMusic (Music);
> >       }
> >     }
> >   }
> >   SDL_Quit();
> >   return 0;
> > };
> >
> >
> >
> >
> > -----------------------------------------------------
> >
> > Salve, il messaggio che hai ricevuto
> > è ³tato inviato per mezzo del sistema
> > di web mail interfree. Se anche tu vuoi
> > una casella di posta free visita il
> > sito http://club.interfree.it
> > Ti aspettiamo!
> >
> > -----------------------------------------------------
> >
> >
> >
> > _______________________________________________
> > SDL mailing list
> > SDL at libsdl.org
> > http://www.libsdl.org/mailman/listinfo/sdl
> >
> >
> >
> >
> > _______________________________________________
> > SDL mailing list
> > SDL at libsdl.org
> > http://www.libsdl.org/mailman/listinfo/sdl
>
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl
>
>
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl


_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail





More information about the SDL mailing list