Bon,


j'ai un petit problème avec mon prog qui est censé lire un fichier wav et le ré-écrire dans un autre dossier (je me suis inspiré de http://loulou.developpez.com/tutorie...al/capture/#L2) :

mon Track.h :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
class Track{
 
	public:
		Track ();
		sf_count_t  frames;
		int samplerate;
		int channels;
		int format;
		int sections ;
		int seekable ;
		int SizeOfWav;
		const char* path;
		SF_INFO FileInfos;
		SNDFILE * File;
		vector<float> Samples();
 
Track::Track(const char* INPUT);
};

mon Track.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
 
Track::Track(const char* INPUT){
 
	SF_INFO FileInfos;
	SNDFILE * File;
 
//ouverture et lecture infos Wav
 
	File = sf_open(INPUT, SFM_READ, &FileInfos);
 
    if (!File)
		cout << "pas de fichier" <<  endl;
 
	int *psamplerate=&samplerate;
	int *pformat=&format;
	int *pchannels=&channels;
	sf_count_t  *pframes=&frames;
 
	*psamplerate=FileInfos.samplerate;	
	*pformat=FileInfos.format;
	*pchannels=FileInfos.channels;
	*pframes=FileInfos.frames;
 
 
//vecteurs de samples
 
	int SizeOfWav = *pframes-1;	
	vector<float> Samples(SizeOfWav); 
	sf_read_float(File, &Samples[0], SizeOfWav);
 
	sf_close(File);
}
 
 
void Track::WriteFile(Track INPUT){
 
 
	sf_count_t   z;
	const char* path= "/Users/chercheur/Desktop/Projets/Soundlab/test/testout.wav";
 
	int *psamplerate=&samplerate;
	int *pformat=&format;
	int *pchannels=&channels;
	sf_count_t *pframes=&frames;
 
	FileInfos.samplerate = *psamplerate;
	FileInfos.format = *pformat;
	FileInfos.frames = *pframes-1;
	FileInfos.channels = *pchannels;
 
 
	SNDFILE*  FileOut = sf_open(path, SFM_WRITE, &FileInfos);
    if (!FileOut)
        return;
 
	FileInfos.samplerate = *psamplerate;
	FileInfos.format = *pformat;
	FileInfos.frames = *pframes-1;
	FileInfos.channels = *pchannels;
 
// écriture wave
 
	int SizeOfWavout = *pframes);	
	z=sf_write_float(FileOut, &INPUT.Samples[0], SizeOfWavout);
    sf_close(File);
}
mon main :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
int main ()
{
 
	Track Wav("/blablat/test2.wav");
);
 
WavOut("/blablabla/testout.wav");
	WavOut.WriteFile(Wav);
 
return 0;
}
résultat, j'ai une erreure (pour la partie écriture, la lecture fonctionne) :


162: error: invalid types '<unknown type>[int]' for array subscript

sur la ligne : z=sf_write_float(FileOut, &INPUT.Samples[0],SizeOfWavout);