0
0

hi,

when somebody changes the current track of a channel im doing this:

[code:2pitwldu]
LoadTrackIntoPlayer(@playerA, Data.path);
FmodSys.result := FMOD_Channel_SetPaused(playerA.Channel, true);
ERRCHECK(FmodSys.result);[/code:2pitwldu]

this function is here:
[code:2pitwldu]
procedure LoadTrackIntoPlayer (pl: pPlayer; track: string );
var
l
begin

FmodSys.result:=FMOD_Channel_Stop(pl.channel);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_CreateStream(pl.system, pchar(track), (FMOD_SOFTWARE or FMOD_2D), nil, Pl.sound);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_PlaySound(pl.system, FMOD_CHANNEL_REUSE, pl.sound, true, pl.Channel);
ErrCheck(FmodSys.result);
end;
[/code:2pitwldu]

after that the settings of the channel are gone. why?
they are all default, like parameq and the volume.
do i have to set them again or is something wrong?

for beeing complete i post my init:
[code:2pitwldu]
FmodSys.result := FMOD_System_Create(pl.system);
ERRCHECK(FmodSys.result);
//Choose the highest mode possible.
//If the user doesn’t have 7.1 speakers, then only the speakers they have will be audible.
FmodSys.result:= FMOD_System_setDriver(pl.system, pl.driver);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_SetSpeakerMode(pl.system, FMOD_SPEAKERMODE_7POINT1);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_Init(pl.system, 32, FMOD_INIT_NORMAL, nil);
ERRCHECK(FmodSys.result);

FModSys.result:= FMOD_SYSTEM_SetOUTPUT(pl.system, FMOD_OUTPUTTYPE_AUTODETECT);

//LoadTrackIntoPlayer(pl,’C:\1.mp3′, Form1.plaTimeslide);
FmodSys.result := FMOD_system_CreateStream(pl.system, ‘C:\Dokumente und Einstellungen\Julia\Eigene Dateien\Meine empfangenen Dateien\eric fish – reden.mp3’, (FMOD_SOFTWARE or FMOD_2D), nil, Pl.sound);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_Sound_SetMode(Pl.sound, FMOD_LOOP_OFF);
ERRCHECK(FmodSys.result);

//DSP

////Init PLayerA
FmodSys.result := FMOD_System_PlaySound(pl.system, FMOD_CHANNEL_REUSE, pl.sound, true, pl.Channel);
ERRCHECK(FmodSys.result);

case pl.channel_int of
0:FmodSys.result := FMOD_Channel_SetSpeakerMix(pl.Channel, 1,1, 0, 0, 0, 0, 0, 0);
1:FmodSys.result := FMOD_Channel_SetSpeakerMix(pl.Channel, 0,0, 1, 1, 0, 0, 0, 0);
2:FmodSys.result := FMOD_Channel_SetSpeakerMix(pl.Channel, 0,0, 0, 0, 1, 1, 0, 0);
3:FmodSys.result := FMOD_Channel_SetSpeakerMix(pl.Channel, 0,0, 0, 0, 0, 0, 1, 1);

end;

ERRCHECK(FmodSys.result);
for i:=0 to 13 do
begin
FMOD_System_createDSPByType(pl.system, FMOD_DSP_TYPE_PARAMEQ, pl.eq_band[i]);
ERRCHECK(FmodSys.result);
FmodSys.result:= FMOD_Channel_addDSP(pl.Channel,pl.eq_band[i]);
ERRCHECK(FmodSys.result);
end;
FMOD_System_createDSPByType(pl.system, FMOD_DSP_TYPE_PITCHSHIFT, pl.eq_band[14]);
ERRCHECK(FmodSys.result);
FmodSys.result:= FMOD_Channel_addDSP(pl.Channel,pl.eq_band[14]);
ERRCHECK(FmodSys.result);[/code:2pitwldu]

is there anything wrong with the init?
cause if the file 1.mp3 which i just put there, doesnt exist, i get loads of error messages…
How can i init the channel/sound without putting a track into it?

thanks in advance, Julian

  • You must to post comments
0
0

Hi,

Playsound gives you a new channel handle, so you will need to set your channel properties on that channel everytime.

When you call channel->stop, that channel handle becomes invalid.

If you are loading your file 1.mp3 that isn’t there, of course you will get error messages. It is up to you to catch these errors and handle it.

  • You must to post comments
0
0

but how to initiliase a channel/sound without setting a file?
so that i can do it afterwards?!
like at the very start of the programm set nothing and the equalizer settings etc and then load a mp3?

  • You must to post comments
0
0

You’ll have to use System::getChannel to get a channel index, set its properties, and then, when calling playSound, specify FMOD_CHANNEL_REUSE for channelid and the handle you got from getChannel for channel handle.

  • You must to post comments
0
0

sorry i dont understand that.
i tried several things.
but always get an Fmod error.

where to get the channel before playing?
or before the initialise can you do a little example code?
doesnt have to be right syntax, just the initial and change track a little bit.
Just the right order and how you mean it.. cant get it working.

Thank you,
Julian

  • You must to post comments
0
0

let me try what i want to achieve:

At first when programm starts:
i want to init the system, the channel and the player.
when the form shows,

set the dsps, like pitch and equalizer

i want to get the first track out of a line of tracks, if no track is there what to do?

when choose another track, it should get the same volume as before and
the dsps should work also.

In which order do i have to do the stuff?

At the moment im doing it like this:

[code:13ykrk8g]
type
pPlayer= ^TPlayer;
TPlayer = record
system: FMOD_SYSTEM;
channel: FMOD_CHANNEL;
channel_id:integer;
sound: FMOD_SOUND;
volume: integer;
track: String;
track_pointer: pointer;
track_time: integer;
eq_band: array[0..16] of FMOD_DSP;
pitch:integer;
temp: integer;
driver:integer;
channel_int:integer;
playing:boolean;
Visualizer:TminiSpectrum;
paused:boolean;
end;
end;

procedure PlayerInit( pl: pPlayer);
var
i:integer;
begin

FmodSys.result := FMOD_System_Create(pl.system);
ERRCHECK(FmodSys.result);

FmodSys.result:= FMOD_System_setDriver(pl.system, pl.driver);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_SetSpeakerMode(pl.system, FMOD_SPEAKERMODE_7POINT1);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_Init(pl.system, 32, FMOD_INIT_NORMAL, nil);
ERRCHECK(FmodSys.result);

FModSys.result:= FMOD_SYSTEM_SetOUTPUT(pl.system, FMOD_OUTPUTTYPE_AUTODETECT);

FmodSys.result := FMOD_system_CreateStream(pl.system, ‘C:\1.mp3’, (FMOD_SOFTWARE or FMOD_2D), nil, Pl.sound);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_System_PlaySound(pl.system, FMOD_CHANNEL_REUSE, pl.sound, true, pl.Channel);
ERRCHECK(FmodSys.result);

FmodSys.result := FMOD_Sound_SetMode(Pl.sound, FMOD_LOOP_OFF);
ERRCHECK(FmodSys.result);

//DSP

////Init PLayer
case pl.channel_int of
FMOD_Channel_SetSpeakerMix(pl.Channel, 1,1, 0, 0, 0, 0, 0, 0);
ERRCHECK(FmodSys.result);

//here i init the dsps
for i:=0 to 13 do
begin
FMOD_System_createDSPByType(pl.system, FMOD_DSP_TYPE_PARAMEQ, pl.eq_band[i]);
ERRCHECK(FmodSys.result);
FmodSys.result:= FMOD_Channel_addDSP(pl.Channel,pl.eq_band[i]);
ERRCHECK(FmodSys.result);
end;
FMOD_System_createDSPByType(pl.system, FMOD_DSP_TYPE_PITCHSHIFT, pl.eq_band[14]);
ERRCHECK(FmodSys.result);
FmodSys.result:= FMOD_Channel_addDSP(pl.Channel,pl.eq_band[14]);
ERRCHECK(FmodSys.result);

pl.paused:=true;

end;

procedure LoadTrackIntoPlayer (pl: pPlayer; track: string; timeslide: TProgressbar);
var
lenms: cardinal;
playing: boolean;
begin

FmodSys.result := FMOD_System_CreateStream(pl.system, pchar(track), (FMOD_SOFTWARE or FMOD_2D), nil, Pl.sound);
ERRCHECK(FmodSys.result);

FMoDSys.Result:=FMOD_System_GetChannel(pl.system,pl.channel_id, pl.channel);
ErrCheck(FMoDSys.Result);
//WHERE TO PUT THE pl.channel_id now????

FmodSys.result := FMOD_System_PlaySound(pl.system, FMOD_CHANNEL_REUSE, pl.sound, true, pl.Channel);
ErrCheck(FmodSys.result);

end;

[/code:13ykrk8g]

When i now hit the playbutton (which just sets pause to false)
the eq, the volume and the pitch arent working??

Where is the error?
Which order is wrong?

  • You must to post comments
0
0

solved: added groupchannel set the volume of the group everything works fine!

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.