Lines Matching refs:sndfile

44     Sound_file* sndfile;  in open_sound_file()  local
54 sndfile = g_malloc(sizeof(Sound_file)); in open_sound_file()
55 sndfile->sffile = sffile; in open_sound_file()
57 if (sfinfo.format & SF_FORMAT_PCM_S8) sndfile->metadata.bits = 8; in open_sound_file()
58 else if (sfinfo.format & SF_FORMAT_PCM_16) sndfile->metadata.bits = 16; in open_sound_file()
59 else if (sfinfo.format & SF_FORMAT_PCM_24) sndfile->metadata.bits = 24; in open_sound_file()
60 else if (sfinfo.format & SF_FORMAT_PCM_32) sndfile->metadata.bits = 32; in open_sound_file()
66 sndfile->metadata.filename = g_strdup(filename); in open_sound_file()
67 sndfile->metadata.rate = sfinfo.samplerate; in open_sound_file()
68 sndfile->metadata.channels = sfinfo.channels; in open_sound_file()
69 sndfile->metadata.frames = sfinfo.frames; in open_sound_file()
70 sndfile->metadata.duration = (1.0 * sndfile->metadata.frames in open_sound_file()
71 / sndfile->metadata.rate); in open_sound_file()
72 sndfile->metadata.minutes = in open_sound_file()
73 (int) sndfile->metadata.duration / 60; in open_sound_file()
74 sndfile->metadata.seconds = in open_sound_file()
75 (int) sndfile->metadata.duration % 60; in open_sound_file()
88 return sndfile; in open_sound_file()
95 close_sound_file(Sound_file *sndfile) in close_sound_file() argument
98 assert(sndfile); in close_sound_file()
99 rval = sf_close(sndfile->sffile); in close_sound_file()
100 g_free(sndfile->metadata.filename); in close_sound_file()
101 g_free(sndfile); in close_sound_file()
109 get_metadata(Sound_file *sndfile) in get_metadata() argument
111 assert(sndfile); in get_metadata()
112 return sndfile->metadata; in get_metadata()
120 seek_sound_file(Sound_file *sndfile, double offset, int whence) in seek_sound_file() argument
123 assert(sndfile); in seek_sound_file()
125 frames = sndfile->metadata.rate * offset; in seek_sound_file()
126 loc = sf_seek(sndfile->sffile, frames, whence); in seek_sound_file()
127 if (loc != -1) loc = 1.0 * loc / sndfile->metadata.rate; in seek_sound_file()
136 read_pcm_data(Sound_file *sndfile, float *buf, unsigned int nframes) in read_pcm_data() argument
138 assert(sndfile && buf && nframes >= 0); in read_pcm_data()
139 return sf_readf_float(sndfile->sffile, buf, nframes); in read_pcm_data()