Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Do Apr 25, 2024 12:42

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 9 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Sound Length
BeitragVerfasst: Fr Mai 06, 2005 15:10 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Anyone know how long 1 Byte of sound lasts in miliseconds with a frequency of 22050 ?

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 06, 2005 15:15 
Offline
DGL Member

Registriert: Do Mai 30, 2002 18:48
Beiträge: 1617
well, i think you're talking not of one byte but of one sample. an it lasts exactly 1/22050 second, i.e. about 0.0454 ms.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 06, 2005 19:14 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Maybe its how im doing it but the sound doesn't go from one "block" of sound to the next "block" of sound.....

Im trying to get the sound for the ROQ's to work right (Video format used in Q3 Engines). Each frame can have a varible length of sound attached to it. The prog shoves the sound into a array (for each frame that passes) until the current sound "block" has been played. Once its been played it shoves the array into memory, clears it and then begins the process again. The problem being when does the sound finish.

Code:
  1.  
  2. If Cinematic.State = 1 then //if Cinematic.AudioSampleOffset > 0 then
  3.     if Cinematic.AudioTime >= (Cinematic.CurAudioBufferLength/2)*(1/22050) then
  4.     begin
  5.     FSOUND_Sample_Upload(Sound.FEmitters[Cinematic.FmodEmitterID].SamplePtr,Cinematic.AudioBuffer,FSOUND_SIGNED);
  6.     Sound.PlaySound(Cinematic.FmodEmitterID);
  7.  
  8.     Cinematic.CurAudioBufferLength := Cinematic.AudioSampleOffset;
  9.     FillChar(Cinematic.AudioBuffer[0], Cinematic.AudioSampleCount * SizeOf(SmallInt), 0);
  10.     Cinematic.AudioSampleOffset := 0;
  11.     Cinematic.AudioTime := 0;
  12.     end;
  13.  
  14.     If Cinematic.State = 1 then
  15.     Cinematic.AudioTime := Cinematic.AudioTime + gTimer.FrameTime;
  16.  


Sound seems to be a bit off, more noticable in videos which have a short amount of sound per frame.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 07, 2005 11:50 
Offline
DGL Member

Registriert: Sa Jan 22, 2005 21:10
Beiträge: 225
I'm not that familiar with FMod but I think, you should queue the buffers. Right now, you simply play a buffer and wait for it to be finished. Then you play the next one. Now what happens if the souncard is done right after your "if Cinematic.AudioTime >= (Cinematic.CurAudioBufferLength/2)*(1/22050)" and has to wait for the mainloop to repeat? I guess thats your small pause.

I would keep at least one more buffer in the queue, so that your soundcard can switch to the next buffer as soon as it is finished with the current one...


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 07, 2005 12:18 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
What queue? Iv seen only channels and samples in FMOD. There are no queues that i can see.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Mai 08, 2005 16:55 
Offline
DGL Member

Registriert: Sa Jan 22, 2005 21:10
Beiträge: 225
I don't know FMod, but OpenAL and even the Windows API have queues.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 09, 2005 16:57 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Http://www.fmod.org/docs

Above link lists all commands.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 09, 2005 20:48 
Offline
DGL Member

Registriert: Sa Jan 22, 2005 21:10
Beiträge: 225
hmm, looks like FMod doesn't support queues. Another proof, that it's better to write stuff like that yourself (at least sometimes).


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Mai 09, 2005 21:31 
Offline
DGL Member

Registriert: Do Mai 30, 2002 18:48
Beiträge: 1617
I remember some callback mode in fmod, where fmod is asking for new data when needed. This works well as long as your program consumes similar times for preparing the next part of sound. I used this mechanism for my simple synthesizer tutors.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 9 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 44 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.175s | 17 Queries | GZIP : On ]