1/* 2 * Copyright 2007 Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef NULL_AUDIO_DRIVER_H 6#define NULL_AUDIO_DRIVER_H 7 8#include <drivers/driver_settings.h> 9#include <drivers/Drivers.h> 10#include <drivers/KernelExport.h> 11 12#include <hmulti_audio.h> 13#include <string.h> 14#include <stdlib.h> 15 16#define FRAMES_PER_BUFFER 1024 17#define MULTI_AUDIO_BASE_ID 1024 18#define MULTI_AUDIO_DEV_PATH "audio/hmulti" 19#define MULTI_AUDIO_MASTER_ID 0 20#define STRMINBUF 2 21#define STRMAXBUF 2 22 23typedef struct { 24 spinlock lock; 25 int bits; 26 27 void* buffers[STRMAXBUF]; 28 uint32 num_buffers; 29 uint32 num_channels; 30 uint32 format; 31 uint32 rate; 32 33 uint32 buffer_length; 34 sem_id buffer_ready_sem; 35 uint32 frames_count; 36 uint32 buffer_cycle; 37 bigtime_t real_time; 38 39 area_id buffer_area; 40} device_stream_t; 41 42typedef struct { 43 device_stream_t playback_stream; 44 device_stream_t record_stream; 45 46 thread_id interrupt_thread; 47 bool running; 48} device_t; 49 50extern device_hooks driver_hooks; 51int32 format_to_sample_size(uint32 format); 52 53status_t multi_audio_control(void* cookie, uint32 op, void* arg, size_t len); 54 55status_t null_hw_create_virtual_buffers(device_stream_t* stream, const char* name); 56status_t null_start_hardware(device_t* device); 57void null_stop_hardware(device_t* device); 58 59#endif /* NULL_AUDIO_DRIVER_H */ 60 61