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.
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
? stato 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!
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@interfree.it (Enzo)
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.
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!
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.
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!
Mix_Volume’s prototype is:
int Mix_Volume(int channel, int volume)
Even if you do Mix_Volume(-1, MIX_MAX_VOLUME/4);
the music will still be full volume.
Mix_VolumeChunk’s prototype is:
int Mix_VolumeChunk(Mix_Chunk *chunk, int volume)
and Mix_LoadMUS(“filename.wav”) returns a Mix_music *, not a Mix_Chunk.
but Mix_music is a structure with pointers to (like Mix_music->wave or Mix_music->mp3, depending on what Mix_music->type is…), that we may be able to use…
But that isn’t the point, if it is just a matter of manually going to the root of the data source and setting the volume, why not just set it via the Mix_VolumeMusic command with the code there?
Should it have worked before, and this is just a bug that cropped in?
Jesse> ----- Original Message -----
From: robert@littlebitlost.com (Robert Diel)
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.
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!
From: robert@littlebitlost.com (Robert Diel)
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.
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!
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”
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:
-----Original Message-----
From: Robert Diel
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.
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!
Sorry about that last message, i missed line 116 in there indicating the use
of Mix_Music to play (.mod .s3m .it .xm) file. Dont use Mix_Chunk :)>From: “P. M.” <@P_M>
Reply-To: sdl at libsdl.org
To: sdl at libsdl.org
Subject: Re: Re: [SDL] Mix_VolumeMusic doesn’t work properly
Date: Thu, 23 Jan 2003 03:13:42 +0000
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”
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:
-----Original Message-----
From: Robert Diel
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.
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!
I am thinking about diving into the mixer code and trying to create a patch…
It scares me that it hasn’t been done yet. Makes me think that there must be MANY issues with it, and it isn’t trival at all and is weeks and weeks of work . . .
Jesse> ----- Original Message -----
From: polymorphic_messiah@hotmail.com (P. M.)
To: sdl at libsdl.org
Date: Thu, 23 Jan 2003 03:41:58 +0000
Subject: Re: Re: [SDL] Mix_VolumeMusic doesn’t work properly
Sorry about that last message, i missed line 116 in there indicating the use
of Mix_Music to play (.mod .s3m .it .xm) file. Dont use Mix_Chunk
From: “P. M.” <polymorphic_messiah at hotmail.com>
Reply-To: sdl at libsdl.org
To: sdl at libsdl.org
Subject: Re: Re: [SDL] Mix_VolumeMusic doesn’t work properly
Date: Thu, 23 Jan 2003 03:13:42 +0000
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” <@Jesse_David_Andrews>
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:
-----Original Message-----
From: Robert Diel
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.
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!
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.
I don’t think it’s my fault 'cause it works with mp3 music.
Hi Enzo,
I ran into the same problem, and since at the time my internet service
was down, I dug into it and fixed it my self. Although you got many
responses about Mix_Volume and Mix_VolumeChunk, these don’t seem to
have anything to do with the tracker style music playback (as you
noted, mp3 volume control works perfectly).
The problem seems to be in MikMod. As far as I could tell, MikMod
is overriding the volume you request with the volume encoded into the
song for each note of the track. Here is my patch, which scales
sample to the volume you request after all the volume effects from the
track have been applied:
tmpvol/=128;
/* fade out */
if (pf->sngpos>=pf->numpos) tmpvol=0;
Hope that helps,
Ben> From: enzogupi at interfree.it ()
Date: 22 Jan 2003 13:17:32 -0000
–
Ben Nason
"Until a man is twenty-five, he still thinks, every so often, that under
the right circumstances he could be the baddest mf in the
world." - Neal Stephenson, “Snow Crash”
I ran into the same problem, and since at the time my internet service
was down, I dug into it and fixed it my self. Although you got many
responses about Mix_Volume and Mix_VolumeChunk, these don’t seem to
have anything to do with the tracker style music playback (as you
noted, mp3 volume control works perfectly).
The problem seems to be in MikMod. As far as I could tell, MikMod
is overriding the volume you request with the volume encoded into the
song for each note of the track. Here is my patch, which scales
sample to the volume you request after all the volume effects from the
track have been applied:
Thanks! Your patch has been added to CVS.
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
I am thinking about diving into the mixer code and trying to create a patch…
I’m working on it now. I’ll test it and add it to the next SDL_mixer release.
It scares me that it hasn’t been done yet. Makes me think that there must be MANY issues with it, and it isn’t trival at all and is weeks and weeks of work . . .
No, I was just lazy and didn’t implement it. It’s just a matter of changing
the memcpy to SDL_MixAudio().
See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment