Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
Io

Data Structures

struct  AudioFileMetadata
 
struct  AudioFile
 Audio file struct. More...
 
struct  FileImportInfo
 
struct  FileImport
 An object used for importing files asynchronously. More...
 

Macros

#define FILE_IMPORT_TYPE   (file_import_get_type ())
 

Functions

NONNULL AudioFileaudio_file_new (const char *filepath)
 Creates a new instance of an AudioFile for the given path.
 
bool audio_file_read_metadata (AudioFile *self, GError **error)
 Reads the metadata for the given file.
 
bool audio_file_read_samples (AudioFile *self, bool in_parts, float *samples, size_t start_from, size_t num_frames_to_read, GError **error)
 Reads the file into an internal float array (interleaved).
 
 NONNULL_ARGS (1) bool audio_file_finish(AudioFile *self
 Must be called when done reading or writing files (or when the operation was cancelled).
 
bool audio_file_read_simple (const char *filepath, float **frames, size_t *num_frames, AudioFileMetadata *metadata, size_t samplerate, GError **error)
 Simple blocking API for reading and optionally resampling audio files.
 
NONNULL void audio_file_free (AudioFile *self)
 
 G_DECLARE_FINAL_TYPE (FileImport, file_import, Z, FILE_IMPORT, GObject)
 
FileImportInfofile_import_info_new (void)
 
FileImportInfofile_import_info_clone (const FileImportInfo *src)
 
void file_import_info_free (FileImportInfo *self)
 
FileImportfile_import_new (const char *filepath, const FileImportInfo *import_nfo)
 Returns a new FileImport instance.
 
void file_import_async (FileImport *self, GObject *owner, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer callback_data)
 Begins file import for a single file.
 
GPtrArray * file_import_sync (FileImport *self, GError **error)
 
GPtrArray * file_import_finish (FileImport *self, GAsyncResult *result, GError **error)
 To be called by the provided GAsyncReadyCallback to retrieve retun values and error details, passing the GAsyncResult which was passed to the callback.
 
bool midi_file_track_has_data (const char *abs_path, int track_idx)
 Returns whether the given track in the midi file has data.
 
int midi_file_get_num_tracks (const char *abs_path, bool non_empty_only)
 Returns the number of tracks in the MIDI file.
 

Variables

GError ** error
 

Detailed Description

Macro Definition Documentation

◆ FILE_IMPORT_TYPE

#define FILE_IMPORT_TYPE   (file_import_get_type ())

Definition at line 27 of file file_import.h.

Function Documentation

◆ audio_file_new()

NONNULL AudioFile * audio_file_new ( const char * filepath)

Creates a new instance of an AudioFile for the given path.

This may be a file to read from or a file to write to.

◆ audio_file_read_samples()

bool audio_file_read_samples ( AudioFile * self,
bool in_parts,
float * samples,
size_t start_from,
size_t num_frames_to_read,
GError ** error )

Reads the file into an internal float array (interleaved).

Parameters
samplesSamples to fill in.
in_partsWhether to read the file in parts. If true, start_from and num_frames_to_read must be specified.
samples[out]Pre-allocated frame array. Caller must ensure there is enough space (ie, number of frames * number of channels).

◆ audio_file_read_simple()

bool audio_file_read_simple ( const char * filepath,
float ** frames,
size_t * num_frames,
AudioFileMetadata * metadata,
size_t samplerate,
GError ** error )

Simple blocking API for reading and optionally resampling audio files.

Only to be used on small files.

Parameters
[out]framesPointer to store newly allocated interlaved frames to.
[out]metadataFile metadata will be pasted here if non-NULL.
samplerateIf specified, the audio will be resampled to the given samplerate. Pass 0 to avoid resampling.

◆ file_import_async()

void file_import_async ( FileImport * self,
GObject * owner,
GCancellable * cancellable,
GAsyncReadyCallback callback,
gpointer callback_data )

Begins file import for a single file.

Parameters
ownerPassed to the task as the owner object. This is to avoid the task callback being called after the owner object is deleted.
callback_dataUser data to pass to the callback.

◆ file_import_finish()

GPtrArray * file_import_finish ( FileImport * self,
GAsyncResult * result,
GError ** error )

To be called by the provided GAsyncReadyCallback to retrieve retun values and error details, passing the GAsyncResult which was passed to the callback.

Returns
A pointer array of regions. The caller is responsible for freeing the pointer array and the regions.

◆ NONNULL_ARGS()

NONNULL_ARGS ( 1 )

Must be called when done reading or writing files (or when the operation was cancelled).

This is not needed when only reading metadata.

Variable Documentation

◆ error

GError** error

Definition at line 104 of file audio_file.h.