DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

It´s driving me nuts ... need some help! ;)
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 274

PostPosted: 02/08/06 18:51    Post subject: Reply with quote

can you try using streams and datapointers? It's safer and less problematic.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 02/08/06 19:21    Post subject: Reply with quote

If anyone´s interested (attention: newbie code Wink):
http://www.prodyon-virtual-gear.com/wrongcode.jpg

@Johnny_Bit: yes? then i should take a closer look at tmemorystream and the like. have to learn all that first, i´m afraid Smile
Back to top
View user's profile Send private message
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 02/08/06 20:15    Post subject: Reply with quote



As you see,not much code, but obviously something must be total wrong Confused
Back to top
View user's profile Send private message
very angry mobster
Member


Joined: 27 Jul 2006
Posts: 3

PostPosted: 03/08/06 11:10    Post subject: Reply with quote

Have you seen Tobybear's wavefile save/load units?WaveIOX.


vam
Back to top
View user's profile Send private message
Johnny_Bit
Moderator


Joined: 15 Jun 2003
Posts: 274

PostPosted: 03/08/06 12:40    Post subject: Reply with quote

vam: give it rest, sonic is close to his own solution, so why waste such effort?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 03/08/06 13:04    Post subject: Reply with quote

@vam: yes i know of this unit Smile but i hope i´m able to do it alone and without it Wink My problem is just - the last "test" in my code JPG ... the rest is working fine Confused
Back to top
View user's profile Send private message
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 03/08/06 15:03    Post subject: Reply with quote

So why on earth has no one an idea??
Shocked Laughing
Back to top
View user's profile Send private message
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 03/08/06 22:06    Post subject: Reply with quote

Procedure TForm1.ProcessWave(FileName: String);
var
Wavbuffer: TSmallIntArray;
Header: TWaveHeader;
i: Integer;
Amp: Double;

begin
Amp := 0.5; // half the volume
LoadTheWave(Outputfile.Text, Wavbuffer, sizeOf(Header)+1); //laden der audio daten
for i := 0 to High(Wavbuffer) do
begin
Wavbuffer[i] := Floor(Wavbuffer[i]*Amp);
end;
SaveTheWave(Outputfile.Text, Wavbuffer, sizeOf(Header)+1);
end;

result: almost white noise in the wav file ... does someone know why? (that worked in my old code before i switched to filestreams) Question

If i use e.g. Amp := 2 it correctly doubles the output volume - why doesn´t the other way around work?
Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 04/08/06 12:11    Post subject: Reply with quote

I just want to remind you that SmallInt has 2 bytes length.
_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 04/08/06 18:57    Post subject: Reply with quote

Thanks, Kambiz - i already found the problem , it was because the "+1"! Smile

However, anoterh little thing that is scarping my head... am i missing something here? Smile :

I want to append a block (50%) of reversed audio data at the end of my main buffer:
Code:

WavEnd := High(Wavbuffer) div 2;


Code:

      begin
          WavAdd := High(Wavbuffer);
          setlength(TempWavbuffer, WavAdd+WavEnd);

          // copy the whole main buffer into temp buffer
          for i := Low(TempWavbuffer) to WavAdd do
          begin
                TempWavbuffer[i] := Wavbuffer[i];
          end;

          // append 50% of main buffer at end
          for i := Low(TempWavbuffer) to WavEnd do
          begin
                TempWavbuffer[WavAdd+i] := Wavbuffer[WavEnd+i];
          end;
       end


Is this a wrong way to try that? Besides this i'm trying to update the
header with the correct length information like so:
Code:

Header.DataBytes := Header.DataBytes + Header.DataBytes div 2;


...but obviously here's something wrong, either it crashes or the WAV files has an "invalid file size"!
Embarassed

Any ideas ? Smile
Back to top
View user's profile Send private message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1044
Location: Tehran, Iran

PostPosted: 04/08/06 19:54    Post subject: Reply with quote

Windows has a set of APIs for manipulating RIFF files (name of these functions start with mmIO). Why you don't use these functions?
_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sonicfire1980
Member


Joined: 25 Jul 2006
Posts: 16
Location: berlin,germany

PostPosted: 04/08/06 20:03    Post subject: Reply with quote

Kambiz wrote:
Windows has a set of APIs for manipulating RIFF files (name of these functions start with mmIO). Why you don't use these functions?


Hmm...dont know, that would mean i would have to rewrite everything the third time Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Goto page Previous  1, 2
Page 2 of 2

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group